Update targetSdk to 37 and Robolectric to 4.17-beta-2#24
Open
anod wants to merge 1 commit into
Open
Conversation
Bump targetSdk 35->37 (app) and 36->37 (baselineProfile) to match the project-wide compileSdk 37, and migrate the deprecation warnings that have clean, behavior-preserving AndroidX-compat replacements. Deprecation migrations: - IntentCompat.getParcelableExtra(..., Class) for typed parcelable extras (ShortcutInfoFactory, ModeDetector, ShortcutEditViewModel) - ServiceCompat.stopForeground(STOP_FOREGROUND_REMOVE) in ModeService - Activity setShowWhenLocked/setTurnScreenOn + requestDismissKeyguard instead of window keyguard flags in AcceptCallActivity - Platform Bundle instead of the deprecated androidx bundleOf in EditWidgetViewModel Robolectric: - Update 4.16.1 -> 4.17-beta-2 for native API 37 support - Add --add-opens=java.base/jdk.internal.access=ALL-UNNAMED to the forked unit-test JVM; JDK 21's module system otherwise blocks Robolectric's FileDescriptor shadow when running at API 37 Advance the lib submodule to the merged PackageInfoCompat version-code change. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: deb19a46-a1a3-40c2-a9b3-a539e068631e
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the project’s Android SDK targeting and test tooling so the app targets API 37 and Robolectric unit tests can run against API 37 without pinning lower SDKs.
Changes:
- Bumped
targetSdkto 37 forappandbaselineProfile. - Migrated several deprecated APIs to their AndroidX/modern equivalents (typed parcelable extras, foreground-stop API, lockscreen/window behavior, and bundle creation).
- Updated Robolectric to
4.17-beta-2and added a Gradle-wide unit-test JVM--add-opensflag to support API 37+ shadows on JDK 17+.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| gradle/libs.versions.toml | Updates Robolectric version to 4.17-beta-2 via the version catalog. |
| content/src/androidMain/kotlin/info/anodsplace/carwidget/content/shortcuts/ShortcutInfoFactory.kt | Replaces deprecated getParcelableExtra calls with IntentCompat.getParcelableExtra for typed retrieval. |
| compose/src/androidMain/kotlin/info/anodsplace/carwidget/shortcut/ShortcutEditViewModel.kt | Migrates typed parcelable extra retrieval for a bitmap icon. |
| compose/src/androidMain/kotlin/info/anodsplace/carwidget/appwidget/EditWidgetViewModel.kt | Replaces bundleOf usage with platform Bundle construction for extras. |
| build.gradle.kts | Adds --add-opens for all Gradle Test tasks to support Robolectric on JDK 17+. |
| baselineProfile/build.gradle.kts | Bumps targetSdk to 37. |
| app/src/main/java/com/anod/car/home/incar/ModeService.kt | Migrates deprecated stopForeground(true) to ServiceCompat.stopForeground(..., STOP_FOREGROUND_REMOVE). |
| app/src/main/java/com/anod/car/home/incar/ModeDetector.kt | Migrates deprecated getParcelableExtra calls to IntentCompat.getParcelableExtra. |
| app/src/main/java/com/anod/car/home/incar/AcceptCallActivity.kt | Migrates deprecated window/keyguard flags to setShowWhenLocked/setTurnScreenOn + requestDismissKeyguard. |
| app/build.gradle.kts | Bumps targetSdk to 37. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Bumps
targetSdkto 37 (matching the project-widecompileSdk 37), migrates the deprecation warnings that have clean behavior-preserving replacements, and updates Robolectric so unit tests run natively at API 37.Changes
Target SDK
targetSdk35 → 37 (app) and 36 → 37 (baselineProfile)Deprecation migrations (behavior-preserving, AndroidX compat)
IntentCompat.getParcelableExtra(..., Class)for typed parcelable extras —ShortcutInfoFactory,ModeDetector,ShortcutEditViewModelServiceCompat.stopForeground(STOP_FOREGROUND_REMOVE)inModeServicesetShowWhenLocked()/setTurnScreenOn()+requestDismissKeyguard()instead of window keyguard flags inAcceptCallActivityBundleinstead of the deprecated androidxbundleOfinEditWidgetViewModelThis reduced deprecation warnings from 65 → 47; the remainder need larger refactors (TelephonyCallback, edge-to-edge, WorkManager, etc.) and are left as follow-ups.
Robolectric
4.16.1→4.17-beta-2for native API 37 support--add-opens=java.base/jdk.internal.access=ALL-UNNAMEDto the forked unit-test JVM (rootbuild.gradle.kts); JDK 21's module system otherwise blocks Robolectric'sFileDescriptorshadow at API 37Submodule
libto the mergedPackageInfoCompatversion-code change (Use PackageInfoCompat for reading package version codes android-framework-lib#4)Verification
./gradlew :app:assembleDebug— SUCCESS./gradlew :compose:testAndroid :content:testAndroid --rerun-tasks— BUILD SUCCESSFULCompositeChooserLoaderTestruns at API 37 (no@Configpin), 0 failurescontenttests pass (pinned@Config(sdk = [31]))