From 954ce27d13b651e916689ff996700a8987540064 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Thu, 15 Jul 2021 10:35:46 -0700 Subject: Add mechanism for a task's windows to be trusted overlays - Exposes a method to set that a certain part of the SF hierarchy is trusted, and sets this state for tasks in PIP. Bug: 191529039 Test: Manual, try using permission dialog while PIP is active Change-Id: I170cb5a7d22ef569eb36de21cc0bcbef60dd385e --- core/java/android/view/SurfaceControl.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'core/java/android/view/SurfaceControl.java') diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index 4e2f37fde1f7..8143cf953f19 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -148,6 +148,8 @@ public final class SurfaceControl implements Parcelable { float width, float height, float vecX, float vecY, float maxStretchAmountX, float maxStretchAmountY, float childRelativeLeft, float childRelativeTop, float childRelativeRight, float childRelativeBottom); + private static native void nativeSetTrustedOverlay(long transactionObj, long nativeObject, + boolean isTrustedOverlay); private static native boolean nativeClearContentFrameStats(long nativeObject); private static native boolean nativeGetContentFrameStats(long nativeObject, WindowContentFrameStats outStats); @@ -3413,6 +3415,17 @@ public final class SurfaceControl implements Parcelable { return this; } + /** + * Sets the trusted overlay state on this SurfaceControl and it is inherited to all the + * children. The caller must hold the ACCESS_SURFACE_FLINGER permission. + * @hide + */ + public Transaction setTrustedOverlay(SurfaceControl sc, boolean isTrustedOverlay) { + checkPreconditions(sc); + nativeSetTrustedOverlay(mNativeObject, sc.mNativeObject, isTrustedOverlay); + return this; + } + /** * Merge the other transaction into this transaction, clearing the * other transaction as if it had been applied. -- cgit v1.2.3