Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f52bbc0a authored by Patrick Williams's avatar Patrick Williams
Browse files

Implement screen recording detection API internals

Adds the server side WindowManager components for the screen recording detection API without exposing any new public APIs.

Bug: 304574518
Flag: ACONFIG window_surfaces.screen_recording_callbacks DISABLED
Test: manual, will add CTS tests when exposing the public API
Change-Id: I9ba55493eca4ce774be9e1c135337e76a1cc6c00
parent 411bb9a2
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -69,12 +69,13 @@ import android.view.SurfaceControl;
import android.view.displayhash.DisplayHash;
import android.view.displayhash.VerifiedDisplayHash;
import android.window.AddToSurfaceSyncGroupResult;
import android.window.IScreenRecordingCallback;
import android.window.ISurfaceSyncGroupCompletedListener;
import android.window.ITaskFpsCallback;
import android.window.ScreenCapture;
import android.window.WindowContextInfo;
import android.window.ITrustedPresentationListener;
import android.window.ScreenCapture;
import android.window.TrustedPresentationThresholds;
import android.window.WindowContextInfo;

/**
 * System private interface to the window manager.
@@ -1083,4 +1084,8 @@ interface IWindowManager


    void unregisterTrustedPresentationListener(in ITrustedPresentationListener listener, int id);

    boolean registerScreenRecordingCallback(IScreenRecordingCallback callback);

    void unregisterScreenRecordingCallback(IScreenRecordingCallback callback);
}
+24 −0
Original line number Diff line number Diff line
/*
 * Copyright 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.window;

/**
 * @hide
 */
oneway interface IScreenRecordingCallback {
    void onScreenRecordingStateChanged(boolean visibleInScreenRecording);
}
+8 −0
Original line number Diff line number Diff line
@@ -80,3 +80,11 @@ flag {
    is_fixed_read_only: true
    bug: "278757236"
}

flag {
    namespace: "window_surfaces"
    name: "screen_recording_callbacks"
    description: "Enable screen recording callbacks public API"
    is_fixed_read_only: true
    bug: "304574518"
}
+6 −6
Original line number Diff line number Diff line
@@ -535,6 +535,12 @@
      "group": "WM_DEBUG_TASKS",
      "at": "com\/android\/server\/wm\/ActivityStarter.java"
    },
    "-1583619037": {
      "message": "Failed to register MediaProjectionWatcherCallback",
      "level": "ERROR",
      "group": "WM_ERROR",
      "at": "com\/android\/server\/wm\/ScreenRecordingCallbackController.java"
    },
    "-1582845629": {
      "message": "Starting animation on %s",
      "level": "VERBOSE",
@@ -2983,12 +2989,6 @@
      "group": "WM_DEBUG_SCREEN_ON",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    "466506262": {
      "message": "Clear freezing of %s: visible=%b freezing=%b",
      "level": "VERBOSE",
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "485170982": {
      "message": "Not finishing noHistory %s on stop because we're just sleeping",
      "level": "DEBUG",
+1 −1
Original line number Diff line number Diff line
@@ -121,7 +121,7 @@ interface IMediaProjectionManager {
    @EnforcePermission("MANAGE_MEDIA_PROJECTION")
    @JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest"
                + ".permission.MANAGE_MEDIA_PROJECTION)")
    void addCallback(IMediaProjectionWatcherCallback callback);
    MediaProjectionInfo addCallback(IMediaProjectionWatcherCallback callback);

    @JavaPassthrough(annotation = "@android.annotation.RequiresPermission(android.Manifest"
            + ".permission.MANAGE_MEDIA_PROJECTION)")
Loading