Repository navigation
Target Android 16 (API 36) - #135
Merged
Merged
Conversation
Google Play requires app updates to target API 36. Raise compileSdk/targetSdk to 36 and install the matching platform in CI. AGP 8.10.1 already supports it. Apps targeting API 36 get predictive back by default on Android 16+: the system no longer calls Activity.onBackPressed() and delivers back through OnBackInvokedCallback instead. Adapt back handling: - Move MainActivity's back logic (returning to the home screen from a post opened via a notification or share) out of onBackPressed() into a new FragmentStackActivity.onInterceptBackPressed() hook, which runs from the OnBackPressedDispatcher callback. Without this, back on such a post closed the app. - Register OnBackInvokedCallbacks for the photo viewer and toolbar dropdown windows on API 33+. Their KEYCODE_BACK handlers still work today through an undocumented platform fallback for windows without a callback; the key handlers stay for older Android versions. Add BackNavigationTest covering all three. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…kage android-actions/setup-android installs "tools platform-tools" by default. The sdkmanager on current GitHub runners (cmdline-tools 16.0) can't find the long obsolete "tools" package and exits with an error, so every PR build has failed since the runner image was updated. The next step already installs the packages the build needs. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Google Play requires app updates to target API 36 (Android 16). From Nov 1, 2026, updates that don't can't be published.
What changed
compileSdk/targetSdk35 → 36 inmastodonandappkit. AGP 8.10.1 already supports API 36, no plugin or Gradle upgrade needed.platforms;android-36(it was pinned to 35).android-actions/setup-androidno longer installs its defaulttoolspackage. The sdkmanager on current runners (cmdline-tools 16.0) can't find that obsolete package, so every PR build has failed at that step since the runner image changed (last green run: June 29).Activity.onBackPressed():MainActivity: itsonBackPressed()override returned to Home from a post opened via a notification or share. That logic moved to a newFragmentStackActivity.onInterceptBackPressed()hook, which runs from the existingOnBackPressedDispatchercallback. Without this, back on such a post closed the app.PhotoViewer,ToolbarDropdownMenuController: these add their own windows and closed onKEYCODE_BACK. They now also register anOnBackInvokedCallbackon API 33+. Their key handlers still work on Android 16/17 through an undocumented platform fallback for windows without a callback, so this is hardening rather than a fix (upstream Mastodon did the same). The key handlers stay for older Android versions.The other API 36 changes don't apply: no edge-to-edge opt-out (already enforced at target 35),
elegantTextHeight, orientation/resizability restrictions,scheduleAtFixedRate, health permissions orMediaStore.getVersion(). Safer intents and local network protection are opt-in.Risk
Limited to back navigation. Android 13–15 keep the legacy back behavior (the app doesn't set
enableOnBackInvokedCallback), and the old key handlers are still in place there. No visual changes.Verification
./gradlew :mastodon:assembleDebug :mastodon:testDebugUnitTest -x lint(the CI gate),:mastodon:minifyPlayReleaseWithR8and:mastodon:lintDebug(nothing on changed lines). The APK declarestargetSdkVersion 36.BackNavigationTest(instrumentation): 3/3 on an Android 17 (API 37) emulator. Against the old code at target 36, theMainActivitytest fails because the activity closes.CI doesn't run instrumentation tests. To run this one:
./gradlew :mastodon:connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=de.icod.techidon.test.BackNavigationTest🤖 Generated with Claude Code