-
Notifications
You must be signed in to change notification settings - Fork 534
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 #4746: Update app to target SDK 31 #4747
Conversation
Properly moving tests over will be fixed with #4748.
The configurations for these were incorrect before--they should have been using target SDK version, not max.
PTAL @seanlip. I'm pretty sure CI will pass at this 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.
LGTM, just had one question.
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 @seanlip! Resolving your conversation thread since it didn't request any changes & you already approved the PR (but please reach out if you have follow-up concerns; happy to address them in a subsequent PR). |
Merging since there's no other outstanding work here. |
## Explanation Fixes #4746 This PR updates the app to target SDK 31 instead of 30 as this is now required for continued Play Store releases. Verification from the PR standpoint heavily relies on CI checks passing. Beyond that, manual testing is needed to ensure no Android behavior changes have led to regressions or new breakages. This PR does NOT include updating Robolectric tests to run on SDK 31 since it's actually much harder than I had expected, and would lead to potential production-affecting changes (as it would require updating Kotlin & potentially other dependencies). #4748 is tracking fixing this in the long-term. ## 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 N/A, mostly. While this is an infrastructure change, Android component behaviors change with different target SDKs so it's quite possible for there to be UI regressions or issues. Fortunately, most of the UI used by the app is material and Jetpack (meaning it ships with the app and will be mostly unaffected by target SDK changes).
This reverts commit 7cb38ff
…)"" This reverts commit 912c357.
## 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.
## 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.
Explanation
Fixes #4746
This PR updates the app to target SDK 31 instead of 30 as this is now required for continued Play Store releases.
Verification from the PR standpoint heavily relies on CI checks passing. Beyond that, manual testing is needed to ensure no Android behavior changes have led to regressions or new breakages.
This PR does NOT include updating Robolectric tests to run on SDK 31 since it's actually much harder than I had expected, and would lead to potential production-affecting changes (as it would require updating Kotlin & potentially other dependencies). #4748 is tracking fixing this in the long-term.
Essential Checklist
For UI-specific PRs only
N/A, mostly. While this is an infrastructure change, Android component behaviors change with different target SDKs so it's quite possible for there to be UI regressions or issues. Fortunately, most of the UI used by the app is material and Jetpack (meaning it ships with the app and will be mostly unaffected by target SDK changes).