-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
## 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.
- Loading branch information
1 parent
fdd2956
commit 0818246
Showing
17 changed files
with
101 additions
and
23 deletions.
There are no files selected for viewing
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 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 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 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 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
15 changes: 15 additions & 0 deletions
15
.../src/main/java/org/oppia/android/domain/oppialogger/analytics/AnalyticsStartupListener.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package org.oppia.android.domain.oppialogger.analytics | ||
|
||
import androidx.work.WorkManager | ||
|
||
/** | ||
* Analytics-specific application startup listener that receives an instance of [WorkManager] to | ||
* perform analytics-specific initialization. | ||
*/ | ||
interface AnalyticsStartupListener { | ||
/** | ||
* Called on application creation with the singleton, application-wide [WorkManager] that should | ||
* be used for scheduling background analytics tasks. | ||
*/ | ||
fun onCreate(workManager: WorkManager) | ||
} |
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 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 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 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 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 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 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 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 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 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 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