-
Notifications
You must be signed in to change notification settings - Fork 549
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
Fix(pinpoint) 2762: Resolve Android 12 notification trampolining restrictions and ADM Push Notifications #2925
Conversation
@@ -0,0 +1,59 @@ | |||
/** | |||
* Copyright 2016-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. |
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.
2022
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.
Thanks, I'll update. In making the change, I had renamed PinpointNotificationReceiver to PinpointNotificationActivity. PinpointNotificationActivity now looks like a new file, since I added a shell PinpointNotificationReciever back.
|
||
/** | ||
* The Amazon Pinpoint push notification receiver. | ||
* @deprecated This class is no longer functional and will soon be removed. At one point, |
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.
Nice!
…fix' into tjroach/notification-trampoline-fix
e6bf12c
This PR will also fix issue: 2927 |
|
||
@Before | ||
public void setup() { | ||
PinpointNotificationActivity.setNotificationClient((NotificationClient) null); |
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.
why are we setting this to null
here before immediately overriding it with a mock?
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.
We could remove here. It was just an effort to make sure we first started all tests in a clean slate (ex: this static variable being wiped out), before moving on to additional setup configuration. Went ahead and removed.
Issue #, if available: 2762 and 2927
Description of changes:
Android 12 introduced the restriction of not allowing the "trampolining" of push notifications from a BroadcastReceiver to an Activity. The proposed solution is moving the trampoline effect from a BroadcastReceiver to an Activity. Google's original intent on the restriction was performance concerns by trampolining, where the user could experience a delay between notification click and app launch. We should ensure PinpointNotificationActivity remains light to keep these concerns to a minimum. An alternative involving backstack manipulation was explored, but this option appears less fragile / more simple.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.