Skip to content

Conversation

adhiamboperes
Copy link
Collaborator

@adhiamboperes adhiamboperes commented Aug 18, 2025

Explanation

Fix #5898: Update the app to target sdk 35 or android 15. This is a compulsory update.

There is a list of issues detailed in https://developer.android.com/about/versions/15/behavior-changes-all that came up during the upgrade, and are fixed in this PR. They are summarized in the issue comments.

Fix #5941
In order to upgrade the compileSdk and workaround #5943, build tools needed to be updated as well.

Fix #5923
Collision with MutableList.removeFirst() and MutableList.removeLast() extension functions in kotlin-stdlib

The List type in Java is mapped to the MutableList type in Kotlin. Because the List.removeFirst() and List.removeLast() APIs have been introduced in Android 15 (API level 35), the Kotlin compiler resolves function calls, for example list.removeFirst(), statically to the new List APIs instead of to the extension functions in kotlin-stdlib.

These new methods affect List and Deque classes.

Even though the docs recommend implementing interfaces to override the method with a compatible return type, I have opted to replace them with removeAt() which is supported.

Custom tags work correctly.
Screenshot_1756947283

Fix #5924
setStatusBarColor and R.attr#statusBarColor are deprecated and have no effect on Android 15.

No suggestion was provided for a workaround. I added a supress annotation to the setter.

Screens with custom status bar colors are still being displayed correctly.

Screenshot_1756942463 Screenshot_1756942511 Screenshot_1756947283

Fix #5926
packageManager.getPackageInfo(this.packageName, /* flags = */ 0).versionName now returns a nullable string, so changes were made to support this.

Consequently, NetworkConfigTestModuleTest.testModule_withoutInjectingMockWebServer_doesNotSetAppTestVersionName was changed because it was nolonger valid.

App version is fetched correctly

Screenshot_1756947120

Fix #5927
Added a supress annotation, see #5927 (comment).

Latex still renders correctly.

Screenshot_1756941549

Fix #5928
ApplicationInfo is nullable. This affects PerformanceMetricsAssessorImpl and has been fixed.

Fix #5884
AndroidExceptionPreHandler lives in the kotlinx-coroutines-android artifact, and we possibly have an older version of it. Proguard strips it. Coroutines still work, but as soon as exception hadling kicks in, the ServiceLoader blows up.
Our Kotlin proguard rules cover CoroutineExceptionHandler and other core classes, but they don’t explicitly keep the Android-specific implementations (AndroidExceptionPreHandler). Since that class is loaded via ServiceLoader, ProGuard can (and often will) strip it out unless explicitly kept.

Adding -keep class kotlinx.coroutines.android.** { *; } covers AndroidExceptionPreHandler and also AndroidDispatcherFactory (the Main dispatcher) which are both discovered reflectively.

Essential Checklist

  • 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: ...".)
  • Any changes to scripts/assets files have their rationale included in the PR explanation.
  • The PR follows the style guide.
  • The PR does not contain any unnecessary code changes from Android Studio (reference).
  • The PR is made from a branch that's not called "develop" and is up-to-date with "develop".
  • The PR is assigned to the appropriate reviewers (reference).

For UI-specific PRs only

If your PR includes UI-related changes, then:

  • Add screenshots for portrait/landscape for both a tablet & phone of the before & after UI changes
  • For the screenshots above, include both English and pseudo-localized (RTL) screenshots (see RTL guide)
  • Add a video showing the full UX flow with a screen reader enabled (see accessibility guide)
  • For PRs introducing new UI elements or color changes, both light and dark mode screenshots must be included
  • Add a screenshot demonstrating that you ran affected Espresso tests locally & that they're passing

@adhiamboperes adhiamboperes self-assigned this Aug 18, 2025
@adhiamboperes

This comment was marked as resolved.

Copy link
Collaborator Author

@adhiamboperes adhiamboperes left a comment

Choose a reason for hiding this comment

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

Self-reviewed.

@adhiamboperes adhiamboperes changed the title Fix #5898: Target Sdk 35 Fix #5898, Fix #5923, Fix #5924, Fix #5925, Fix #5926, Fix #59237 Fix #5928: Target Sdk 35 and fix resulting issues Aug 21, 2025
@adhiamboperes adhiamboperes changed the title Fix #5898, Fix #5923, Fix #5924, Fix #5925, Fix #5926, Fix #59237 Fix #5928: Target Sdk 35 and fix resulting issues Fix #5898, Fix #5923, Fix #5924, Fix #5925, Fix #5926, Fix #5927 Fix #5928: Target Sdk 35 and fix resulting issues Aug 21, 2025
@adhiamboperes adhiamboperes changed the title Fix #5898, Fix #5923, Fix #5924, Fix #5925, Fix #5926, Fix #5927 Fix #5928: Target Sdk 35 and fix resulting issues Fix #5898, Fix #5923, Fix #5924, nFix #5926, Fix #5928: Target Sdk 35 and fix resulting issues Aug 21, 2025
@adhiamboperes adhiamboperes marked this pull request as ready for review August 21, 2025 21:02
@adhiamboperes adhiamboperes requested review from a team as code owners August 21, 2025 21:02
@adhiamboperes
Copy link
Collaborator Author

@BenHenning and @manas-yu, could you please look at this PR as part of the 0.16 release -- it is urgent for QA to receive the update soon for testing.

Copy link

Coverage Report

Results

Number of files assessed: 23
Overall Coverage: 85.09%
Coverage Analysis: PASS

Passing coverage

Files with passing code coverage
File Coverage Lines Hit Status Min Required
DataProviderTestMonitor.kttesting/src/main/java/org/oppia/android/testing/data/DataProviderTestMonitor.kt
95.08% 58 / 61 70%
NetworkConfigTestModule.ktdata/src/main/java/org/oppia/android/data/backends/gae/testing/NetworkConfigTestModule.kt
100.00% 23 / 23 70%
RemoteAuthNetworkInterceptor.ktdata/src/main/java/org/oppia/android/data/backends/gae/RemoteAuthNetworkInterceptor.kt
100.00% 11 / 11 70%
AndroidLintRunner.ktscripts/src/java/org/oppia/android/scripts/lint/AndroidLintRunner.kt
76.71% 112 / 146 70%
LintModelCreator.ktscripts/src/java/org/oppia/android/scripts/lint/LintModelCreator.kt
81.82% 180 / 220 70%
CustomHtmlContentHandler.ktutility/src/main/java/org/oppia/android/util/parser/html/CustomHtmlContentHandler.kt
85.71% 114 / 133 70%
PerformanceMetricsAssessorImpl.ktutility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorImpl.kt
100.00% 50 / 50 70%

Exempted coverage

Files exempted from coverage
File Exemption Reason
PlatformParameterItemViewModel.ktapp/src/main/java/org/oppia/android/app/devoptions/platformparameters/PlatformParameterItemViewModel.kt
This file is exempted from having a test file; skipping coverage check.
PlatformParametersFragment.ktapp/src/main/java/org/oppia/android/app/devoptions/platformparameters/PlatformParametersFragment.kt
This file is incompatible with code coverage tooling; skipping coverage check.
PlatformParametersFragmentPresenter.ktapp/src/main/java/org/oppia/android/app/devoptions/platformparameters/PlatformParametersFragmentPresenter.kt
This file is exempted from having a test file; skipping coverage check.
FeatureFlagsFragmentPresenter.ktapp/src/main/java/org/oppia/android/app/devoptions/featureflags/FeatureFlagsFragmentPresenter.kt
This file is exempted from having a test file; skipping coverage check.
FeatureFlagsFragment.ktapp/src/main/java/org/oppia/android/app/devoptions/featureflags/FeatureFlagsFragment.kt
This file is incompatible with code coverage tooling; skipping coverage check.
StatePlayerRecyclerViewAssembler.ktapp/src/main/java/org/oppia/android/app/player/state/StatePlayerRecyclerViewAssembler.kt
This file is exempted from having a test file; skipping coverage check.
StateFragment.ktapp/src/main/java/org/oppia/android/app/player/state/StateFragment.kt
This file is incompatible with code coverage tooling; skipping coverage check.
AppVersionViewModel.ktapp/src/main/java/org/oppia/android/app/administratorcontrols/appversion/AppVersionViewModel.kt
This file is exempted from having a test file; skipping coverage check.
SpotlightFragment.ktapp/src/main/java/org/oppia/android/app/spotlight/SpotlightFragment.kt
This file is incompatible with code coverage tooling; skipping coverage check.
ContextExtensions.ktutility/src/main/java/org/oppia/android/util/extensions/ContextExtensions.kt
This file is exempted from having a test file; skipping coverage check.
MathBitmapModelLoader.ktutility/src/main/java/org/oppia/android/util/parser/math/MathBitmapModelLoader.kt
This file is exempted from having a test file; skipping coverage check.
StatusBarColor.ktutility/src/main/java/org/oppia/android/util/statusbar/StatusBarColor.kt
This file is exempted from having a test file; skipping coverage check.
StateDeck.ktdomain/src/main/java/org/oppia/android/domain/state/StateDeck.kt
This file is exempted from having a test file; skipping coverage check.
ExplorationProgressController.ktdomain/src/main/java/org/oppia/android/domain/exploration/ExplorationProgressController.kt
This file is incompatible with code coverage tooling; skipping coverage check.
PlatformParameterControllerDebugImpl.ktdomain/src/main/java/org/oppia/android/domain/platformparameter/PlatformParameterControllerDebugImpl.kt
This file is incompatible with code coverage tooling; skipping coverage check.
LearnerAnalyticsLogger.ktdomain/src/main/java/org/oppia/android/domain/oppialogger/analytics/LearnerAnalyticsLogger.kt
This file is incompatible with code coverage tooling; skipping coverage check.

Refer test_file_exemptions.textproto for the comprehensive list of file exemptions and their required coverage percentages.

To learn more, visit the Oppia Android Code Coverage wiki page

Copy link

Coverage Report

Results

Number of files assessed: 12
Overall Coverage: 85.09%
Coverage Analysis: PASS

Passing coverage

Files with passing code coverage
File Coverage Lines Hit Status Min Required
DataProviderTestMonitor.kttesting/src/main/java/org/oppia/android/testing/data/DataProviderTestMonitor.kt
95.08% 58 / 61 70%
NetworkConfigTestModule.ktdata/src/main/java/org/oppia/android/data/backends/gae/testing/NetworkConfigTestModule.kt
100.00% 23 / 23 70%
RemoteAuthNetworkInterceptor.ktdata/src/main/java/org/oppia/android/data/backends/gae/RemoteAuthNetworkInterceptor.kt
100.00% 11 / 11 70%
AndroidLintRunner.ktscripts/src/java/org/oppia/android/scripts/lint/AndroidLintRunner.kt
76.71% 112 / 146 70%
LintModelCreator.ktscripts/src/java/org/oppia/android/scripts/lint/LintModelCreator.kt
81.82% 180 / 220 70%
CustomHtmlContentHandler.ktutility/src/main/java/org/oppia/android/util/parser/html/CustomHtmlContentHandler.kt
85.71% 114 / 133 70%
PerformanceMetricsAssessorImpl.ktutility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorImpl.kt
100.00% 50 / 50 70%

Exempted coverage

Files exempted from coverage
File Exemption Reason
AppVersionViewModel.ktapp/src/main/java/org/oppia/android/app/administratorcontrols/appversion/AppVersionViewModel.kt
This file is exempted from having a test file; skipping coverage check.
SpotlightFragment.ktapp/src/main/java/org/oppia/android/app/spotlight/SpotlightFragment.kt
This file is incompatible with code coverage tooling; skipping coverage check.
ContextExtensions.ktutility/src/main/java/org/oppia/android/util/extensions/ContextExtensions.kt
This file is exempted from having a test file; skipping coverage check.
MathBitmapModelLoader.ktutility/src/main/java/org/oppia/android/util/parser/math/MathBitmapModelLoader.kt
This file is exempted from having a test file; skipping coverage check.
StatusBarColor.ktutility/src/main/java/org/oppia/android/util/statusbar/StatusBarColor.kt
This file is exempted from having a test file; skipping coverage check.

Refer test_file_exemptions.textproto for the comprehensive list of file exemptions and their required coverage percentages.

To learn more, visit the Oppia Android Code Coverage wiki page

Copy link
Collaborator

@manas-yu manas-yu left a comment

Choose a reason for hiding this comment

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

Hi @adhiamboperes, the changes look good to me. I just wanted to confirm whether the following points are relevant for migration testing:

  • Predictive back animations are now always enabled (ref). Overrides or customized back handling could conflict with the predictive back behavior.

  • Toolbar overlapping the status bar issue ([ref]).

I also reviewed the Android 15 behavior changes, and the relevant points seem covered.

@adhiamboperes adhiamboperes changed the title Fix #5898, #5923, #5924, #5926, #5927, #5928, #5884, part of #5940: Target Sdk 35 and fix resulting issues Fix #5898, #5923, #5924, #5926, #5927, #5928, #5884, part of #5940, #5941: Target Sdk 35 and fix resulting issues Aug 28, 2025
@adhiamboperes
Copy link
Collaborator Author

Hi @adhiamboperes, the changes look good to me. I just wanted to confirm whether the following points are relevant for migration testing:

  • Predictive back animations are now always enabled (ref). Overrides or customized back handling could conflict with the predictive back behavior.
  • Toolbar overlapping the status bar issue ([ref]).

I also reviewed the Android 15 behavior changes, and the relevant points seem covered.

Thanks for pointing these out @manas-yu! I have added a workaround and filed #5943 for proper resolution.

Copy link

Coverage Report

Results

Number of files assessed: 14
Overall Coverage: 84.96%
Coverage Analysis: PASS

Passing coverage

Files with passing code coverage
File Coverage Lines Hit Status Min Required
AndroidBuildSdkProperties.ktscripts/src/java/org/oppia/android/scripts/common/AndroidBuildSdkProperties.kt
100.00% 10 / 10 70%
LintModelCreator.ktscripts/src/java/org/oppia/android/scripts/lint/LintModelCreator.kt
81.82% 180 / 220 70%
AndroidLintRunner.ktscripts/src/java/org/oppia/android/scripts/lint/AndroidLintRunner.kt
76.71% 112 / 146 70%
NetworkConfigTestModule.ktdata/src/main/java/org/oppia/android/data/backends/gae/testing/NetworkConfigTestModule.kt
100.00% 23 / 23 70%
CustomHtmlContentHandler.ktutility/src/main/java/org/oppia/android/util/parser/html/CustomHtmlContentHandler.kt
85.71% 114 / 133 70%
PerformanceMetricsAssessorImpl.ktutility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorImpl.kt
98.08% 51 / 52 70%
DataProviderTestMonitor.kttesting/src/main/java/org/oppia/android/testing/data/DataProviderTestMonitor.kt
95.08% 58 / 61 70%

Exempted coverage

Files exempted from coverage
File Exemption Reason
HintsAndSolutionDialogFragmentPresenter.ktapp/src/main/java/org/oppia/android/app/hintsandsolution/HintsAndSolutionDialogFragmentPresenter.kt
This file is exempted from having a test file; skipping coverage check.
SpotlightFragment.ktapp/src/main/java/org/oppia/android/app/spotlight/SpotlightFragment.kt
This file is incompatible with code coverage tooling; skipping coverage check.
TestActivity.ktapp/src/main/java/org/oppia/android/app/testing/activity/TestActivity.kt
This file is incompatible with code coverage tooling; skipping coverage check.
BindableAdapterTestFragmentPresenter.ktapp/src/main/java/org/oppia/android/app/testing/BindableAdapterTestFragmentPresenter.kt
This file is exempted from having a test file; skipping coverage check.
ContextExtensions.ktutility/src/main/java/org/oppia/android/util/extensions/ContextExtensions.kt
This file is exempted from having a test file; skipping coverage check.
StatusBarColor.ktutility/src/main/java/org/oppia/android/util/statusbar/StatusBarColor.kt
This file is exempted from having a test file; skipping coverage check.
MathBitmapModelLoader.ktutility/src/main/java/org/oppia/android/util/parser/math/MathBitmapModelLoader.kt
This file is exempted from having a test file; skipping coverage check.

Refer test_file_exemptions.textproto for the comprehensive list of file exemptions and their required coverage percentages.

To learn more, visit the Oppia Android Code Coverage wiki page

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Thanks @adhiamboperes! I can't fully verify the new SDK 35 theme currently, so I trust that you've checked each of the affected screens on both handset and tablet layouts (portrait + landscape) to ensure that each of the affected themes is behaving correctly?

@adhiamboperes
Copy link
Collaborator Author

Thanks @adhiamboperes! I can't fully verify the new SDK 35 theme currently, so I trust that you've checked each of the affected screens on both handset and tablet layouts (portrait + landscape) to ensure that each of the affected themes is behaving correctly?

All user facing changes were verified.

Copy link

github-actions bot commented Sep 4, 2025

Coverage Report

Results

Number of files assessed: 12
Overall Coverage: 85.05%
Coverage Analysis: PASS

Passing coverage

Files with passing code coverage
File Coverage Lines Hit Status Min Required
AndroidBuildSdkProperties.ktscripts/src/java/org/oppia/android/scripts/common/AndroidBuildSdkProperties.kt
100.00% 10 / 10 70%
LintModelCreator.ktscripts/src/java/org/oppia/android/scripts/lint/LintModelCreator.kt
81.82% 180 / 220 70%
AndroidLintRunner.ktscripts/src/java/org/oppia/android/scripts/lint/AndroidLintRunner.kt
77.33% 116 / 150 70%
NetworkConfigTestModule.ktdata/src/main/java/org/oppia/android/data/backends/gae/testing/NetworkConfigTestModule.kt
100.00% 23 / 23 70%
CustomHtmlContentHandler.ktutility/src/main/java/org/oppia/android/util/parser/html/CustomHtmlContentHandler.kt
85.71% 114 / 133 70%
PerformanceMetricsAssessorImpl.ktutility/src/main/java/org/oppia/android/util/logging/performancemetrics/PerformanceMetricsAssessorImpl.kt
98.08% 51 / 52 70%
DataProviderTestMonitor.kttesting/src/main/java/org/oppia/android/testing/data/DataProviderTestMonitor.kt
95.08% 58 / 61 70%

Exempted coverage

Files exempted from coverage
File Exemption Reason
SpotlightFragment.ktapp/src/main/java/org/oppia/android/app/spotlight/SpotlightFragment.kt
This file is incompatible with code coverage tooling; skipping coverage check.
TestActivity.ktapp/src/main/java/org/oppia/android/app/testing/activity/TestActivity.kt
This file is incompatible with code coverage tooling; skipping coverage check.
ContextExtensions.ktutility/src/main/java/org/oppia/android/util/extensions/ContextExtensions.kt
This file is exempted from having a test file; skipping coverage check.
StatusBarColor.ktutility/src/main/java/org/oppia/android/util/statusbar/StatusBarColor.kt
This file is exempted from having a test file; skipping coverage check.
MathBitmapModelLoader.ktutility/src/main/java/org/oppia/android/util/parser/math/MathBitmapModelLoader.kt
This file is exempted from having a test file; skipping coverage check.

Refer test_file_exemptions.textproto for the comprehensive list of file exemptions and their required coverage percentages.

To learn more, visit the Oppia Android Code Coverage wiki page

Copy link
Member

@BenHenning BenHenning left a comment

Choose a reason for hiding this comment

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

Thanks @adhiamboperes! LGTM.

Copy link

oppiabot bot commented Sep 5, 2025

Unassigning @BenHenning since they have already approved the PR.

@oppiabot oppiabot bot added the PR: LGTM label Sep 5, 2025
Copy link

oppiabot bot commented Sep 5, 2025

Hi @adhiamboperes, 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!

@adhiamboperes adhiamboperes enabled auto-merge (squash) September 5, 2025 06:32
@adhiamboperes adhiamboperes merged commit 81d6f1d into develop Sep 5, 2025
66 of 74 checks passed
@adhiamboperes adhiamboperes deleted the upgrade-to-sdk-35 branch September 5, 2025 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment