-
Notifications
You must be signed in to change notification settings - Fork 499
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 #4750: Fixes SDK 31 support #4752
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This ensures SplashActivity is properly exported, and that WorkManager is disabled on SDK 31+ (since it requires a non-trivial version upgrade).
BenHenning
added
the
PR: Cherrypick requested
Indicates that a PR is being requested for being cherrypicked into the ongoing release branch.
label
Nov 21, 2022
seanlip
approved these changes
Nov 21, 2022
rt4914
approved these changes
Nov 22, 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.
LGTM, thanks.
Hi @BenHenning, this PR is ready to be merged. Please address any remaining comments prior to merging, and feel free to merge this PR once the CI checks pass and you're happy with it. Thanks! |
Thanks all! |
BenHenning
added a commit
that referenced
this pull request
Nov 23, 2022
## Explanation Fixes #4750 This PR fixes issues that were introduced in #4747 when trying to use the app on an actual API 31 device. The problems come from two breaking changes in Android 12: - Public activities, services, and providers must be marked as exported (this only affected our SplashActivity). - PendingIntents must be explicitly marked as mutable/immutable (this only affects WorkManager, but that's tricky for us). The WorkManager issue was fixed in version 2.7.0 (where we currently depend on version 2.4.0), but we can't actually updated in a way that would be low-risk to cherry-pick (since it would require updating our Kotlin SDK to 1.5.x instead of 1.4.x). A safer option is to disable WorkManager outright, but while doing this I discovered that we have unrestricted getInstance() calls that will force WorkManager to get created regardless. This was fixed by introducing a new analytics-specific application creation listener and ensuring those do not get called for SDK 31+. #4751 is tracking fixing this longer term. Approximately 9% of our users will have analytics disabled until we properly fix it & push a new release. Note that I opted for a fix-forward instead of rolling back #4747 since these are small PRs that need to be easily cherry-picked, and it's guaranteed that the target SDK change be isolated to SDK 31 devices (so developers would still be able to use the app on lower versions). Proper testing for ensuring this works requires manual testing, for now (as we don't have automated end-to-end tests). I manually verified that the app opens and can be used on Android 12. One test exemption was added for the new listener since it's an interface and thus not testable. A new regex check was also added to ensure WorkManager.getInstance calls always go through the new listener to avoid future situations where they can accidentally trigger an instance creation when it's not wanted. ## Essential Checklist - [x] The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".) - [x] Any changes to [scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets) files have their rationale included in the PR explanation. - [x] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)). ## For UI-specific PRs only This is mainly an infrastructural change as it's literally fixing whether the app can open at all on SDK 31+ devices, so there's not much to show.
BenHenning
added
the
PR: Cherrypick completed
Indicates a cherrypick request was approved & completed for a PR.
label
Nov 23, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
PR: Cherrypick completed
Indicates a cherrypick request was approved & completed for a PR.
PR: Cherrypick requested
Indicates that a PR is being requested for being cherrypicked into the ongoing release branch.
PR: LGTM
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation
Fixes #4750
This PR fixes issues that were introduced in #4747 when trying to use the app on an actual API 31 device. The problems come from two breaking changes in Android 12:
The WorkManager issue was fixed in version 2.7.0 (where we currently depend on version 2.4.0), but we can't actually updated in a way that would be low-risk to cherry-pick (since it would require updating our Kotlin SDK to 1.5.x instead of 1.4.x). A safer option is to disable WorkManager outright, but while doing this I discovered that we have unrestricted getInstance() calls that will force WorkManager to get created regardless. This was fixed by introducing a new analytics-specific application creation listener and ensuring those do not get called for SDK 31+. #4751 is tracking fixing this longer term. Approximately 9% of our users will have analytics disabled until we properly fix it & push a new release.
Note that I opted for a fix-forward instead of rolling back #4747 since these are small PRs that need to be easily cherry-picked, and it's guaranteed that the target SDK change be isolated to SDK 31 devices (so developers would still be able to use the app on lower versions).
Proper testing for ensuring this works requires manual testing, for now (as we don't have automated end-to-end tests). I manually verified that the app opens and can be used on Android 12. One test exemption was added for the new listener since it's an interface and thus not testable.
A new regex check was also added to ensure WorkManager.getInstance calls always go through the new listener to avoid future situations where they can accidentally trigger an instance creation when it's not wanted.
Essential Checklist
For UI-specific PRs only
This is mainly an infrastructural change as it's literally fixing whether the app can open at all on SDK 31+ devices, so there's not much to show.