Skip to content

CATROID-1660 Migrate to targetSdkVersion 36 - #5236

Open
harissabil wants to merge 11 commits into
Catrobat:developfrom
harissabil:CATROID-1660
Open

CATROID-1660 Migrate to targetSdkVersion 36#5236
harissabil wants to merge 11 commits into
Catrobat:developfrom
harissabil:CATROID-1660

Conversation

@harissabil

@harissabil harissabil commented Aug 16, 2026

Copy link
Copy Markdown
Member

Summary

This PR increases the API target to API level 36 (Android 16) and modifies the code affected by that change to ensure compatibility with the new Android version while maintaining backward compatibility with the older versions.

Changes

Full migration guide notes can be accessed through this spreadsheet to see the decisions and assessments made regarding the changes.

  • Increase compileSdk and targetSdkVersion to 36
  • Migrate legacy back handling approach to use the platform API or the AndroidX API
  • Add tests corresponding to the migrated back handling
  • Add new monochrome-compatible icons to support automatic themed app icons
  • Make ConnectBluetoothDeviceActivity edge-to-edge compatible
  • Opt out Android 16 large screen resizability changes
  • Harden the project sync workers against the job runtime quota (cancellable API calls, retry on failure, atomic database writes, stop-reason logging)
  • Add tests for the project sync workers

Your checklist for this pull request

Please review the contributing guidelines and wiki pages of this repository.

  • Include the name of the Jira ticket in the PR’s title
  • Include a summary of the changes plus the relevant context
  • Choose the proper base branch (develop)
  • Confirm that the changes follow the project’s coding guidelines
  • Verify that the changes generate no compiler or linter warnings
  • Perform a self-review of the changes
  • Verify to commit no other files than the intentionally changed ones
  • Include reasonable and readable tests verifying the added or changed behavior
  • Confirm that new and existing unit tests pass locally
  • Check that the commits’ message style matches the project’s guideline
  • Stick to the project’s gitflow workflow
  • Verify that your changes do not have any conflicts with the base branch
  • After the PR, verify that all CI checks have passed
  • Post a message in the catroid-stage or catroid-ide Slack channel and ask for a code reviewer

@harissabil
harissabil marked this pull request as ready for review August 17, 2026 18:45
@reichli reichli added the Active Member Tickets that are assigned to members that are still currently active label Aug 19, 2026
…kers

Android 16 enforces the job runtime quota in more situations, so being stopped mid-run is now a normal outcome for FeaturedProjectSyncWorker and ProjectsCategoriesSyncWorker. WorkManager reschedules stopped work by itself, but the workers did not survive a stop cleanly:

- call.execute() is blocking and ignores coroutine cancellation, so the HTTP call and the worker thread stayed alive well past the stop. sync() is now a suspend function using Retrofit's awaitResponse(), which cancels the call as soon as the coroutine is cancelled.
- A non-2xx response was not treated as an error at all: the body was null, no update happened, and the worker still returned success. It now raises WebConnectionException, which the worker maps to Result.retry() so the configured exponential backoff is reachable at all, and to Result.failure() once the run attempts are exhausted.
- The featured projects update deleted and inserted in two separate transactions, so a stop in between left an empty list behind. Both writes now run in a single @transaction.
- Log the stop reason on API 31 and above, as recommended for the new quota behaviour.
- SettingsFragment calls the sync from Java, so the interface keeps a blocking syncBlocking() bridge for that caller.
Cover the result mapping of both workers with TestListenableWorkerBuilder: success on a completed sync, retry while attempts remain, and failure once they are exhausted.
# Conflicts:
#	catroid/src/main/java/org/catrobat/catroid/stage/StageActivity.java
@sonarqubecloud

Copy link
Copy Markdown

@moe-threeface moe-threeface left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I checked the CATROID-1660 target SDK 36 changes locally.

I mainly looked at the SDK bump, Android 16/back handling related changes, workflow updates, and the new/updated UI tests. I’m still getting more familiar with this part of the codebase, but from what I checked, the changes look clean to me and I did not find anything blocking.

Looks good from my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Active Member Tickets that are assigned to members that are still currently active

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants