-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Android 12: Performance - Remove notification trampoline #16090
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
Conversation
…m a broadcast receiver. Share action from post published notification was started from a broadcast receiver that acted as a notification trampoline. It is now directly started using a pending intent without having to depend on a broadcast receiver. For more details see: https://developer.android.com/about/versions/12/behavior-changes-12#notification-trampolines
|
You can trigger optional UI/connected tests for these changes by visiting CircleCI here. |
|
You can test the changes on this Pull Request by downloading the APKs: |
# Conflicts: # WordPress/src/main/java/org/wordpress/android/ui/uploads/PostUploadNotifier.java
Notification trampoline in this method is addressed in 235231b.
…ShowNotificationFromNoteData(...) This new method will be needed in the next commit that fixes a bug.
This fixes a bug where inline actions were not added to notification because the notification was sometimes shown before full note with actions info was downloaded.
Opening comments screen when there's an empty message looks like a fail-safe. We cannot reply with an empty message either from the app or from the website as send button is disabled till we enter a text. Even in the case of voice reply from a wearable, an empty voice reply doesn't make sense. User can tap the notification itself to go straight to the comments screen in case there's ever an empty reply and so this logic to open comments activity from service on empty reply is removed.
This was added in PR#15602 to fix lint issues complaining of a missing permission as the app used Intent.ACTION_CLOSE_SYSTEM_DIALOGS at two places: NativeNotificationsUtils, ShareAndDismissNotificationReceiver. As we've removed Intent.ACTION_CLOSE_SYSTEM_DIALOGS in both the classes, we can remove this permission now.
AjeshRPai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ashiagr I have tested the changes as described.
- I checked that we're not starting an activity from inside any other services by checking the code itself 🟢
- I have tested the notification reply and share option. Its working as expected. 🟢
However I came across two issues which I couldn't find the root cause. I am not sure whether the changes in this PR is the root cause of the issue
Issue 1
- Go to MySite-> Comments
- Select a comment("Test Comment") to reply to from list
- Type reply -> Click send
- Notice that the reply is send but the edit text is still filled with the comment
- Go back and come back to reply to the original comment("Test Comment")
- Notice that the reply is still filled
Screen_Recording_20220602-123327_WordPress.Pre-Alpha.mp4
Screen_Recording_20220602-133140_WordPress.Pre-Alpha.mp4
First video capture is from the build from this PR
Second Video capture Time stamp 0:00 - 0:30 - This is the behaviour of the comment reply in the current Playstore app.
Issue 2
When the user logs out from the app, the comment notification doesnt go away.
Screen_Recording_20220602-121643_WordPress.Pre-Alpha.mp4
Let me know if these issues are not related to this PR, I will approve the PR and we can take it up as a seperate task.
AjeshRPai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closes #15875
Closes #16069
Description
This PR
ShareAndDismissNotificationReceiver(that acted as a notification trampoline) and starts the post published share action without having to depend on a broadcast receiver. - 235231bNotificationsProcessingServicethat acted as a notification trampoline. - 2db34f6 (see commit message for details)Also,
BROADCAST_CLOSE_SYSTEM_DIALOGSpermission. - 0a43a35 (see commit message for details)Since we removed
Intent.ACTION_CLOSE_SYSTEM_DIALOGSat both places:NativeNotificationsUtils,ShareAndDismissNotificationReceiver, this PR closes issue Android 12: Security and privacy - Apps can't close system dialogs #16069 as well.To test
Test.1 Post published share action
post publishednotification is shown.Shareaction button from the notification.Before
After
Test.2 Inline actions present in comment notification
wpcomaccount having sites on your device.Calypso.Steps 2-5 can be repeated a few times to check that comment actions are present in the notification every time.
Test.3 Post empty comment
The failsafe logic that started comments activity on an empty reply from inside a notification service is removed. Below are a few tests to check that one cannot post an empty comment from the app or from the website.
Test.3.1 Reply from notification
Test.3.2 Reply from website
Test.3.2 Reply from
Commentssection in the appMy Site->Comments->Comments Details).Test.4 Check other services and broadcast receivers for start activity logic
I checked that we're not starting an activity from inside any other services(1, 2) and broadcast receivers (1, 2) by checking the code itself. I'll appreciate another pair of eyes that confirms it. 🙏
Regression Notes
Changes are limited to
I've tried to include tests in the
To testsection to test these areas and can't think of potential unintended areas at this point.What I did to test those areas of impact (or what existing automated tests I relied on) - N/A
See
To testsectionWhat automated tests I added (or what prevented me from doing so) - N/A
N/A
PR submission checklist:
RELEASE-NOTES.txtif necessary.