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

Fix(pinpoint) 2762: Resolve Android 12 notification trampolining restrictions and ADM Push Notifications #2925

Merged
merged 7 commits into from Jun 9, 2022

Conversation

tylerjroach
Copy link
Contributor

@tylerjroach tylerjroach commented Jun 8, 2022

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.

@tylerjroach tylerjroach requested a review from a team as a code owner June 8, 2022 13:17
@@ -0,0 +1,59 @@
/**
* Copyright 2016-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2022

Copy link
Contributor Author

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

sdhuka
sdhuka previously approved these changes Jun 8, 2022
sktimalsina
sktimalsina previously approved these changes Jun 8, 2022
sdhuka
sdhuka previously approved these changes Jun 8, 2022
tjleing
tjleing previously approved these changes Jun 8, 2022
@tylerjroach tylerjroach dismissed stale reviews from tjleing, sdhuka, and sktimalsina via e6bf12c June 9, 2022 12:52
@tylerjroach
Copy link
Contributor Author

This PR will also fix issue: 2927

@tylerjroach tylerjroach changed the title Fix 2762: Resolve Android 12 notification trampolining restrictions Fix 2762: Resolve Android 12 notification trampolining restrictions and ADM Push Notifications Jun 9, 2022

@Before
public void setup() {
PinpointNotificationActivity.setNotificationClient((NotificationClient) null);
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@div5yesh div5yesh changed the title Fix 2762: Resolve Android 12 notification trampolining restrictions and ADM Push Notifications Fix(pinpoint) 2762: Resolve Android 12 notification trampolining restrictions and ADM Push Notifications Jun 9, 2022
@tylerjroach tylerjroach merged commit a544544 into main Jun 9, 2022
@tylerjroach tylerjroach deleted the tjroach/notification-trampoline-fix branch June 9, 2022 19:12
@div5yesh div5yesh linked an issue Jun 9, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pinpoint notifications not opening app targeting Android 12
5 participants