Skip to content

Support Android 16 (Baklava) - #1

Merged
JingMatrix merged 1 commit into
mainfrom
android16
Sep 1, 2025
Merged

Support Android 16 (Baklava)#1
JingMatrix merged 1 commit into
mainfrom
android16

Conversation

@JingMatrix

Copy link
Copy Markdown
Owner

Refactors the screen capture hooking logic to support major API changes introduced in Android 16. The previous implementation failed on newer platforms due to class, method, and field refactoring in the AOSP framework.

This commit introduces version-aware logic to handle three distinct generations of the screen capture API:

  • Android 13 and below: Continues to use the original hook for android.view.SurfaceControl and its boolean mCaptureSecureLayers field.

  • Android 14 (Upside Down Cake): Targets the new android.window.ScreenCapture class and its CaptureArgs, which still uses the mCaptureSecureLayers field.

  • Android Baklava (API 36+): Adapts to the latest API, which includes:

    • Targeting the new android.window.ScreenCaptureInternal class.
    • Hooking the renamed methods captureDisplay and captureLayers (dropping the "native" prefix).
    • Modifying the new integer-based policy fields mSecureContentPolicy and mProtectedContentPolicy by setting them to 1 to enable capture.

Refactors the screen capture hooking logic to support major API changes introduced in Android 16. The previous implementation failed on newer platforms due to class, method, and field refactoring in the AOSP framework.

This commit introduces version-aware logic to handle three distinct generations of the screen capture API:

- **Android 13 and below:** Continues to use the original hook for `android.view.SurfaceControl` and its boolean `mCaptureSecureLayers` field.

- **Android 14 (Upside Down Cake):** Targets the new `android.window.ScreenCapture` class and its `CaptureArgs`, which still uses the `mCaptureSecureLayers` field.

- **Android Baklava (API 36+):** Adapts to the latest API, which includes:
    - Targeting the new `android.window.ScreenCaptureInternal` class.
    - Hooking the renamed methods `captureDisplay` and `captureLayers` (dropping the "native" prefix).
    - Modifying the new integer-based policy fields `mSecureContentPolicy` and `mProtectedContentPolicy` by setting them to `1` to enable capture.
@JingMatrix
JingMatrix merged commit 9271172 into main Sep 1, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant