avatar displayed incorrectly in notification

Bug #1296777 reported by Bill Filler
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu UI Toolkit
Fix Released
Critical
Loïc Molinari
qtdeclarative (Ubuntu)
Fix Released
Undecided
Timo Jyrinki
unity8 (Ubuntu)
Invalid
High
Mirco Müller

Bug Description

image 256

The contact's avatar picture is no longer displayed correctly in the notification on a new phone call or text message. This is a regression.

- open camera and take a picture of yourself
- open address-book and create a contact, and select the picture you just took as the contact's avatar
- call the phone or send a sms from the phone number you created the above contact with

Expected results:
- notification shown with contact's avatar scaled properly to fit in notification

Actual results:
- notifcation shown, contact's avatar is not scaled correctly. You see the top left corner of the avatar in the notifcation, not the complete avatar.

Tags: regression

Related branches

Bill Filler (bfiller)
tags: added: regression
Changed in unity8:
importance: Undecided → High
Michał Sawicz (saviq)
Changed in unity8:
assignee: nobody → Mirco Müller (macslow)
Revision history for this message
Mirco Müller (macslow) wrote :

Hm... I'm on image 259 after the update and can't no longer start any application from the shell. Also I could not figure out how to start the camera-app manually while being ssh'ed into the my Nexus4.

Still to try to reproduce your reported error, I used one of the snap-decision examples from lp:unity-notifications (examples/sd-example-incoming-file.py) and passed it the desktop-wallpaper /usr/share/backgrounds/Forever_by_Shady_S.jpg (copied over from my desktop-system), which is a huge 2560x1695 JPG. I triggered the notification with and without the "x-canonical-non-shaped-icon" hint. In both cases the image was correctly/fully displayed in the shown notification.

Thus I assume the way the image is processed before it is passed to the notification changed. So this does not seem to be an issue introduced by the move to Qt 5.2

Revision history for this message
Mirco Müller (macslow) wrote :

Have been able to replicate bfiller's process and get the same results. Looking into the passed image now...

Revision history for this message
Mirco Müller (macslow) wrote :

Hm... I've added some print() to the notification-renderer. When running on the phone and either calling or texting I see the contacts avatar-photo (in this oddly cropped state of a too large image) in the notification. But in the print I get "/usr/share/telephony-service/assets/avatar-default@18.png".

Which app is triggering those snap-decisions?

Revision history for this message
Mirco Müller (macslow) wrote :

Also with image260 I'm no longer getting notifications for SMS.

Revision history for this message
Mirco Müller (macslow) wrote :

With phone-image 261 I get correct avatar-photos displayed in the call-notifications. Still no notifications triggered by incoming SMS.

Revision history for this message
Mirco Müller (macslow) wrote :

After looking through lp:telephony-service I found that the icon initially gets set to...

* QUrl(telephonyServiceDir() + "assets/avatar-default@18.png").toEncoded();

... which ends up being "/usr/share/telephony-service/assets/avatar-default@18.png". Then afterwards it is updated to...

* QContact contact.detail<QContactAvatar>().imageUrl().toEncoded();

... but that new string I can get never reported back by the notification-renderer. Only always the "avatar-default@18.png" gets spit out by my debug-print.

Since updating a notification's icon works flawlessly - even with very large images - as tested with lp:unity-notifications/examples/update-notifications.py, I can only make out contact.detail<QContactAvatar>() to be the source of the error. But to verify that, somebody more familiar with that codebase and how it is hooked up, needs to look at this.

Changed in unity8:
status: New → Confirmed
Revision history for this message
Mirco Müller (macslow) wrote :

I still don't think this is a bug in unity8 (or rather the notification-renderer), but somewhere in the telephony/contact stack.

Revision history for this message
Mirco Müller (macslow) wrote :

After further looking through the sources of telephony-service I can't see a call to notify_notification_show(...) after calls to notify_notification_update(...). This has to be done. See the lp:unity-notifications/examples/update-notifications.py or libnotify API-doc.

Revision history for this message
Mirco Müller (macslow) wrote :

Trying to debug lp:telephony-service on the N4 directly (with r262) I get this error from "dpkg-buildpackage -b" with build-dependencies installed using "sudo apt-get build-dep telephony-service":

CMake Error at /usr/lib/arm-linux-gnueabihf/cmake/Qt5Multimedia/Qt5MultimediaConfig.cmake:27 (message):
  The imported target "Qt5::Multimedia" references the file

     "/usr/lib/arm-linux-gnueabihf/libQt5Multimedia.so.5.2.1"

  but this file does not exist. Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/usr/lib/arm-linux-gnueabihf/cmake/Qt5Multimedia/Qt5MultimediaConfig.cmake"

  but not all the files it references.

Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

This error is due to some packaging diversions that are done in the qt5multimedia package to support the touch environment.
If you really need/want to build telephony-service, the way to do that is to build on a pbuild armhf chroot.

But I have created a simple program that reproduces exactly what telephony-service is doing. In today's image the situation is a bit different though: now the notification is not updated at all when I call notify_notification_update() && notify_notification_show().

Mirco Müller (macslow)
Changed in unity8:
status: Confirmed → In Progress
Revision history for this message
Mirco Müller (macslow) wrote :

Sofar I could narrow this regression down to an issue related to UbuntuShape. If it's UbuntuShape itself, a regression in Qt 5.2 in combination with UbuntuShape or just Qt 5.2 itself I'm still figuring out.

For the time being - until it is fixed for real - you can use the "x-canonical-non-shaped-icon" as a work-around to correct the rendering of the avatar-icons right now. This hint is actually meant to allow an application to avoid masking the icon (e.g. SVGs, PNGs with alpha) with the UbuntuShape.

In C/C++ code do...

notify_notification_set_hint (notification, "x-canonical-non-shaped-icon", g_variant_new_string ("true"));

... to set said hint. Do that after notify_notification_new(...) but before notify_notification_show (...)

Revision history for this message
Mirco Müller (macslow) wrote :
Revision history for this message
Mirco Müller (macslow) wrote :

Reassigning to Ubuntu-UI-Toolkit.

It turns out that setting the icon to "" before setting it to the real new image works around the bug in UbuntuShape not updating the icon correctly. This is a valid method for the time being, to get the intended behaviour, until it is fixed in the SDK.

Revision history for this message
Mirco Müller (macslow) wrote :

Here is the mentioned workaround implemented to use notification-updates and still get the correct image displayed as the icon. What you have to do is set the icon of the notification to "" for a brief moment (duration of 250ms seems to be enough) and then set it to the intented image. That way UbuntuShape can be forced to correctly update the icon.

Revision history for this message
Mirco Müller (macslow) wrote :

Just for clarification... this is caused by a bug in UbuntuShape and needs to be fixed in ubuntu-ui-toolkit.

Bill Filler (bfiller)
Changed in ubuntu-ui-toolkit:
importance: Undecided → Critical
Changed in ubuntu-ui-toolkit:
assignee: nobody → Loïc Molinari (loic.molinari)
Revision history for this message
Loïc Molinari (loic.molinari) wrote :

The QtDeclarative version we depend on doesn't emit a signal when an Image item's texture is changed, the UbuntuShape used to simply ignore that fact. Since Qt 5.2, Image items use texture atlases for storing multiple images in the same OpenGL texture. That new behavior triggered the issue. When an Image source is changed, all the UbuntuShapes using the same texture atlas can potentially display junk since they don't know the atlas changed.

The needed signal is present available on the QSGTextureProvider since Qt 5.0 but is not correctly emitted in Qt 5.2. It is emitted in the coming Qt 5.3 though. So we need to backport that QtDeclarative patch [1] as well as that ubuntu-ui-toolkit patch [2].

[1] https://qt.gitorious.org/qt/qtdeclarative/commit/9e345ab3c549851a273df62497f93ad9593385c9
[2] lp:~loic.molinari/ubuntu-ui-toolkit/watch-for-shape-item-source-updates

Revision history for this message
Bill Filler (bfiller) wrote :

@Mirv
Would you be able to help backport the QtDeclarative patch?

Changed in qtdeclarative (Ubuntu):
assignee: nobody → Timo Jyrinki (timo-jyrinki)
Revision history for this message
Loïc Molinari (loic.molinari) wrote :

Note that It could potentially trigger some side effects in apps considering the UbuntuShape not updating its content when the image source changes as a standard behavior. I haven't checked that yet.

Michał Sawicz (saviq)
Changed in ubuntu-ui-toolkit:
status: New → Fix Released
Changed in qtdeclarative (Ubuntu):
status: New → Fix Released
Changed in unity8:
status: In Progress → Invalid
Michał Sawicz (saviq)
affects: unity8 → unity8 (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.