Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOLD for payment 2023-01-05] [HOLD #13392] [$1000] Android - Avatar is not displayed on push notification #12967

Closed
kbecciv opened this issue Nov 23, 2022 · 40 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review

Comments

@kbecciv
Copy link

kbecciv commented Nov 23, 2022

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Issue found when executing PR #12540

Action Performed:

  1. Sign into the Android app
  2. Sign into another account on web and upload a custom profile picture for that account
  3. Background the Android app
  4. Send a message from the account signed in on web to the account signed in on Android
  5. Verify that a push notification appears and that the notification appears a message style notification, including the avatar image of the web user.

Expected Result:

Avatar image of the web user is displayed after received a push notification in Android app

Actual Result:

Avatar image of the web user isn't displayed after received a push notification in Android app

Workaround:

Unknown

Platform:

Where is this issue occurring?

  • Android

Version Number: 1.2.30.0

Reproducible in staging?: Yes

Reproducible in production?: Yes

Email or phone of affected tester (no customers):

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

Screen_Recording_20221123-115704_New.Expensify.1.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal Team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit

@kbecciv kbecciv added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Nov 23, 2022
@melvin-bot
Copy link

melvin-bot bot commented Nov 23, 2022

Triggered auto assignment to @arielgreen (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Nov 29, 2022

@arielgreen Eep! 4 days overdue now. Issues have feelings too...

@arielgreen
Copy link
Contributor

arielgreen commented Nov 30, 2022

Bug0 Triage Checklist

Note: see this SO for more information.

  • The "bug" is actually a bug
  • The bug is not a duplicate report of an existing GH.
    • If it is, close the GH and add any novel details to the original GH instead
  • The bug is reproducible, following the reproduction steps.
    • If the GH doesn’t have steps to reliably reproduce the bug and you figure it out, then please add them.
    • If you’re unable to reproduce the bug, add the Needs reproduction label.
    • Comment on the issue outlining the steps you took to try to reproduce the bug, your results and tag the issue reporter and the Applause QA member who created the issue. Ask them to clarify reproduction steps and/or to check the reproduction steps again. Close issue.
  • The GH template is filled out as fully as possible
    • The GH body and title are clear (ie. could an external contributor understand it and work on it?)
  • The GH was created by an Expensify employee or a QA tester
  • If the bug is an OldDot issue, you should decide whether it is widespread enough to justify fixing or it is better to wait for reunification. If it’s better to wait, close the GH & provide this justification
  • If there's a link to Slack, check the discussion to see if we decided not to fix it
  • Decide if the GH should be resolved by an External contributor or Internal engineer, add the appropriate label

@melvin-bot melvin-bot bot removed the Overdue label Nov 30, 2022
@arielgreen arielgreen changed the title Android - Notification- Avatar image of the web user isn't displayed after received a push notification on Android app Android - Avatar is not displayed on push notification Dec 1, 2022
@arielgreen arielgreen added the External Added to denote the issue can be worked on by a contributor label Dec 1, 2022
@melvin-bot
Copy link

melvin-bot bot commented Dec 1, 2022

Current assignee @arielgreen is eligible for the External assigner, not assigning anyone new.

@melvin-bot melvin-bot bot changed the title Android - Avatar is not displayed on push notification [$1000] Android - Avatar is not displayed on push notification Dec 1, 2022
@melvin-bot
Copy link

melvin-bot bot commented Dec 1, 2022

Job added to Upwork: https://www.upwork.com/jobs/~0171d7d835c1969527

@melvin-bot
Copy link

melvin-bot bot commented Dec 1, 2022

Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (External)

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 1, 2022
@melvin-bot
Copy link

melvin-bot bot commented Dec 1, 2022

Triggered auto assignment to @robertjchen (External), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@arielgreen
Copy link
Contributor

Reproduced following the steps in OP:
image

@StefanNemeth
Copy link
Contributor

StefanNemeth commented Dec 1, 2022

I could reproduce the issue as well on the debug build and started to debug the issue.

The following error occurred when fetching the icon and appears to occur on Android O (onwards):

12-01 17:21:31.539 24579 24622 E NotificationProvider: Failed to fetch icon
12-01 17:21:31.539 24579 24622 E NotificationProvider: java.lang.IllegalArgumentException: Software rendering doesn't support hardware bitmaps
12-01 17:21:31.539 24579 24622 E NotificationProvider: 	at android.graphics.BaseCanvas.throwIfHwBitmapInSwMode(BaseCanvas.java:706)
12-01 17:21:31.539 24579 24622 E NotificationProvider: 	at android.graphics.BaseCanvas.throwIfCannotDraw(BaseCanvas.java:81)
12-01 17:21:31.539 24579 24622 E NotificationProvider: 	at android.graphics.BaseCanvas.drawBitmap(BaseCanvas.java:139)
12-01 17:21:31.539 24579 24622 E NotificationProvider: 	at android.graphics.Canvas.drawBitmap(Canvas.java:1604)
12-01 17:21:31.539 24579 24622 E NotificationProvider: 	at com.expensify.chat.customairshipextender.CustomNotificationProvider.getCroppedBitmap(CustomNotificationProvider.java:110)
12-01 17:21:31.539 24579 24622 E NotificationProvider: 	at com.expensify.chat.customairshipextender.CustomNotificationProvider.fetchIcon(CustomNotificationProvider.java:265)
12-01 17:21:31.539 24579 24622 E NotificationProvider: 	at com.expensify.chat.customairshipextender.CustomNotificationProvider.applyMessageStyle(CustomNotificationProvider.java:151)
12-01 17:21:31.539 24579 24622 E NotificationProvider: 	at com.expensify.chat.customairshipextender.CustomNotificationProvider.onExtendBuilder(CustomNotificationProvider.java:76)
12-01 17:21:31.539 24579 24622 E NotificationProvider: 	at com.urbanairship.push.notifications.AirshipNotificationProvider.onCreateNotification(AirshipNotificationProvider.java:210)
12-01 17:21:31.539 24579 24622 E NotificationProvider: 	at com.urbanairship.push.IncomingPushRunnable.postProcessPush(IncomingPushRunnable.java:196)
12-01 17:21:31.539 24579 24622 E NotificationProvider: 	at com.urbanairship.push.IncomingPushRunnable.processPush(IncomingPushRunnable.java:144)
12-01 17:21:31.539 24579 24622 E NotificationProvider: 	at com.urbanairship.push.IncomingPushRunnable.run(IncomingPushRunnable.java:97)
12-01 17:21:31.539 24579 24622 E NotificationProvider: 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
12-01 17:21:31.539 24579 24622 E NotificationProvider: 	at java.util.concurrent.FutureTask.run(FutureTask.java:264)
12-01 17:21:31.539 24579 24622 E NotificationProvider: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
12-01 17:21:31.539 24579 24622 E NotificationProvider: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
12-01 17:21:31.539 24579 24622 E NotificationProvider: 	at com.urbanairship.util.AirshipThreadFactory$1.run(AirshipThreadFactory.java:50)
12-01 17:21:31.539 24579 24622 E NotificationProvider: 	at java.lang.Thread.run(Thread.java:1012)

To resolve the issue, we could convert the avatar to the desired bitmap (as used by the canvas we create in getCroppedBitmap)

// android/app/src/main/java/com/expensify/chat/customairshipextender/CustomNotificationProvider.java
public Bitmap getCroppedBitmap(Bitmap bitmap) {
        // Convert to ARGB_8888
        bitmap = bitmap.copy(Config.ARGB_8888, true);

        Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
                bitmap.getHeight(), Config.ARGB_8888);
        Canvas canvas = new Canvas(output);
        // ..
}

That would resolve the bug as seen here.

@melvin-bot melvin-bot bot added the Overdue label Dec 5, 2022
@robertjchen
Copy link
Contributor

robertjchen commented Dec 6, 2022

@StefanNemeth Thanks for the proposal, it looks like this is indeed the source of the issue! Just out of curiosity, is there a reason why we don't use PixelCopy? https://bumptech.github.io/glide/doc/hardwarebitmaps.html

@melvin-bot melvin-bot bot removed the Overdue label Dec 6, 2022
@StefanNemeth
Copy link
Contributor

@StefanNemeth Thanks for the proposal, it looks like this is indeed the source of the issue! Just out of curiosity, is there a reason why we don't use PixelCopy? https://bumptech.github.io/glide/doc/hardwarebitmaps.html

According to the documentation PixelCopy allows for copy operations from Surface to Bitmap (e.g. for screenshots). We are dealing with bitmaps here so bitmap.copy is the proper way to do it afaik.

@robertjchen
Copy link
Contributor

Got it, that makes sense. @parasharrajat What are your thoughts on the above proposal? 🙏

@parasharrajat
Copy link
Member

I am not an Android native guy but can we just use bitmap.setConfig(Config.ARGB_8888) before drawing? it seems that it will have the same effect.
https://github.com/Expensify/App/blame/main/android/app/src/main/java/com/expensify/chat/customairshipextender/CustomNotificationProvider.java#L107

I don't see where we create the Bitmap with Hardware config. It may be coming directly from AirShip.

@StefanNemeth
Copy link
Contributor

StefanNemeth commented Dec 6, 2022

Practically it will have the same effect, yes. However, I chose to use the immutable copy option as it is usually bad practice to alter input objects in a function like getCroppedBitmap as a hidden side-effect and the performance impact of copying is negligible. I'd be good with both options though.

Edit: Actually it won't work with bitmap.setConfig as only mutable bitmaps can be reconfigured, which the given one is not.

@parasharrajat
Copy link
Member

Ok, Thanks for the explanation. I am good with both. I have asked internally to review it before we proceed.

@parasharrajat
Copy link
Member

Ok @StefanNemeth 's proposal looks good to me.

Cc: @robertjchen

🎀 👀 🎀 C+ reviewed

@dylanexpensify
Copy link
Contributor

@StefanNemeth offer sent! @parasharrajat please apply when you get a moment 😄

@dylanexpensify
Copy link
Contributor

ah, @robertjchen looks like @arielgreen is the BZ member for this 😂

@robertjchen
Copy link
Contributor

@dylanexpensify Ah, my bad! I was getting these issues mixed up 😵

@robertjchen robertjchen added the Reviewing Has a PR in review label Dec 8, 2022
@robertjchen robertjchen changed the title [$1000] Android - Avatar is not displayed on push notification [HOLD #13392] [$1000] Android - Avatar is not displayed on push notification Dec 8, 2022
@parasharrajat
Copy link
Member

PR is on HOLD for #13392.

@melvin-bot
Copy link

melvin-bot bot commented Dec 15, 2022

@robertjchen, @StefanNemeth, @parasharrajat, @arielgreen Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@parasharrajat
Copy link
Member

Having issues signing in the app. #13392 is done so we can remove the HOLD.

@melvin-bot
Copy link

melvin-bot bot commented Dec 23, 2022

@robertjchen, @StefanNemeth, @parasharrajat, @arielgreen Whoops! This issue is 2 days overdue. Let's get this updated quick!

@parasharrajat
Copy link
Member

This is no more on hold and is ready for merge. Someone, please remove the HOLD from the title.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Daily KSv2 labels Dec 29, 2022
@melvin-bot melvin-bot bot changed the title [HOLD #13392] [$1000] Android - Avatar is not displayed on push notification [HOLD for payment 2023-01-05] [HOLD #13392] [$1000] Android - Avatar is not displayed on push notification Dec 29, 2022
@melvin-bot
Copy link

melvin-bot bot commented Dec 29, 2022

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.2.45-0 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2023-01-05. 🎊

After the hold period, please check if any of the following need payment for this issue, and if so check them off after paying:

  • External issue reporter N/A
  • Contributor that fixed the issue @StefanNemeth
  • Contributor+ that helped on the issue and/or PR @parasharrajat

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Dec 29, 2022

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

@StefanNemeth
Copy link
Contributor

Am I eligible for the 50% bonus as the PR created within a few hours after assignment was held?

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Jan 5, 2023
@arielgreen
Copy link
Contributor

@StefanNemeth yes, I think that is fair. Paid. @parasharrajat sending offer now.

@parasharrajat
Copy link
Member

[@parasharrajat / @robertjchen] The PR that introduced the bug has been identified. Link to the PR:

#6770

[@parasharrajat / @robertjchen] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:

#6770 (comment)

[@parasharrajat / @robertjchen] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:

https://expensify.slack.com/archives/C049HHMV9SM/p1673432839280069

@robertjchen Please update the checklist at #12967 (comment)

@Julesssss
Copy link
Contributor

Julesssss commented Jan 11, 2023

[@parasharrajat / @robertjchen] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:

it's not clear to me what exactly caused the regression in the linked PR. I recall that notification profile images have been broken for weeks/months now. Perhaps they were recently fixed? But I can't recall.

@Julesssss
Copy link
Contributor

Ahhh, I see. That PR was January 2022, not 2023 😄

@arielgreen
Copy link
Contributor

All payments have been issued.

@arielgreen
Copy link
Contributor

Just need to look into whether we can create a regression test and then this will be good to close out.

@Julesssss
Copy link
Contributor

Hey @arielgreen I think this should be added as a new regression test, as it ensures we test for custom profile pics as well as the default icons:

Ensure rounded profile images are displayed for notifications

  • Android and iOS only
  • Sign in as a new account (userA) on the test platform (iOS/Android)
  • Sign in as userB on a different device/browser/platformfor that account
  • Background the app as userA
  • Send a message from userB to userA
  • Verify that a push notification appears for userA and that the notification includes a rounded default avatar
  • As userB upload a custom profile picture for that account
  • Send a message from userB to userA
  • Verify that a push notification appears for userA and that the notification includes a rounded version of the custom profile image

@arielgreen
Copy link
Contributor

Discussing regression test here.

@arielgreen
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review
Projects
None yet
Development

No branches or pull requests

8 participants