Loading core/java/android/view/SurfaceControl.java +29 −4 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import android.graphics.Rect; import android.graphics.Region; import android.gui.DropInputMode; import android.gui.StalledTransactionInfo; import android.gui.TrustedOverlay; import android.hardware.DataSpace; import android.hardware.HardwareBuffer; import android.hardware.OverlayProperties; Loading Loading @@ -165,7 +166,7 @@ public final class SurfaceControl implements Parcelable { float maxStretchAmountX, float maxStretchAmountY, float childRelativeLeft, float childRelativeTop, float childRelativeRight, float childRelativeBottom); private static native void nativeSetTrustedOverlay(long transactionObj, long nativeObject, boolean isTrustedOverlay); int isTrustedOverlay); private static native void nativeSetDropInputMode( long transactionObj, long nativeObject, int flags); private static native void nativeSetCanOccludePresentation(long transactionObj, Loading Loading @@ -4304,13 +4305,37 @@ public final class SurfaceControl implements Parcelable { } /** * 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. * @see Transaction#setTrustedOverlay(SurfaceControl, int) * @hide */ public Transaction setTrustedOverlay(SurfaceControl sc, boolean isTrustedOverlay) { return setTrustedOverlay(sc, isTrustedOverlay ? TrustedOverlay.ENABLED : TrustedOverlay.UNSET); } /** * Trusted overlay state prevents SurfaceControl from being considered as obscuring for * input occlusion detection purposes. The caller must hold the * ACCESS_SURFACE_FLINGER permission. See {@code TrustedOverlay}. * <p> * Arguments: * {@code TrustedOverlay.UNSET} - The default value, SurfaceControl will inherit the state * from its parents. If the parent state is also {@code TrustedOverlay.UNSET}, the layer * will be considered as untrusted. * <p> * {@code TrustedOverlay.DISABLED} - Treats this SurfaceControl and all its children as an * untrusted overlay. This will override any state set by its parent SurfaceControl. * <p> * {@code TrustedOverlay.ENABLED} - Treats this SurfaceControl and all its children as a * trusted overlay unless the child SurfaceControl explicitly disables its trusted state * via {@code TrustedOverlay.DISABLED}. * <p> * @hide */ public Transaction setTrustedOverlay(SurfaceControl sc, @TrustedOverlay int trustedOverlay) { checkPreconditions(sc); nativeSetTrustedOverlay(mNativeObject, sc.mNativeObject, isTrustedOverlay); nativeSetTrustedOverlay(mNativeObject, sc.mNativeObject, trustedOverlay); return this; } Loading core/jni/android_view_SurfaceControl.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -1008,11 +1008,11 @@ static void nativeSetShadowRadius(JNIEnv* env, jclass clazz, jlong transactionOb } static void nativeSetTrustedOverlay(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jboolean isTrustedOverlay) { jlong nativeObject, jint trustedOverlay) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); transaction->setTrustedOverlay(ctrl, isTrustedOverlay); transaction->setTrustedOverlay(ctrl, static_cast<gui::TrustedOverlay>(trustedOverlay)); } static void nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, Loading Loading @@ -2447,7 +2447,7 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetTransformHint }, {"nativeGetTransformHint", "(J)I", (void*)nativeGetTransformHint }, {"nativeSetTrustedOverlay", "(JJZ)V", {"nativeSetTrustedOverlay", "(JJI)V", (void*)nativeSetTrustedOverlay }, {"nativeGetLayerId", "(J)I", (void*)nativeGetLayerId }, Loading Loading
core/java/android/view/SurfaceControl.java +29 −4 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import android.graphics.Rect; import android.graphics.Region; import android.gui.DropInputMode; import android.gui.StalledTransactionInfo; import android.gui.TrustedOverlay; import android.hardware.DataSpace; import android.hardware.HardwareBuffer; import android.hardware.OverlayProperties; Loading Loading @@ -165,7 +166,7 @@ public final class SurfaceControl implements Parcelable { float maxStretchAmountX, float maxStretchAmountY, float childRelativeLeft, float childRelativeTop, float childRelativeRight, float childRelativeBottom); private static native void nativeSetTrustedOverlay(long transactionObj, long nativeObject, boolean isTrustedOverlay); int isTrustedOverlay); private static native void nativeSetDropInputMode( long transactionObj, long nativeObject, int flags); private static native void nativeSetCanOccludePresentation(long transactionObj, Loading Loading @@ -4304,13 +4305,37 @@ public final class SurfaceControl implements Parcelable { } /** * 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. * @see Transaction#setTrustedOverlay(SurfaceControl, int) * @hide */ public Transaction setTrustedOverlay(SurfaceControl sc, boolean isTrustedOverlay) { return setTrustedOverlay(sc, isTrustedOverlay ? TrustedOverlay.ENABLED : TrustedOverlay.UNSET); } /** * Trusted overlay state prevents SurfaceControl from being considered as obscuring for * input occlusion detection purposes. The caller must hold the * ACCESS_SURFACE_FLINGER permission. See {@code TrustedOverlay}. * <p> * Arguments: * {@code TrustedOverlay.UNSET} - The default value, SurfaceControl will inherit the state * from its parents. If the parent state is also {@code TrustedOverlay.UNSET}, the layer * will be considered as untrusted. * <p> * {@code TrustedOverlay.DISABLED} - Treats this SurfaceControl and all its children as an * untrusted overlay. This will override any state set by its parent SurfaceControl. * <p> * {@code TrustedOverlay.ENABLED} - Treats this SurfaceControl and all its children as a * trusted overlay unless the child SurfaceControl explicitly disables its trusted state * via {@code TrustedOverlay.DISABLED}. * <p> * @hide */ public Transaction setTrustedOverlay(SurfaceControl sc, @TrustedOverlay int trustedOverlay) { checkPreconditions(sc); nativeSetTrustedOverlay(mNativeObject, sc.mNativeObject, isTrustedOverlay); nativeSetTrustedOverlay(mNativeObject, sc.mNativeObject, trustedOverlay); return this; } Loading
core/jni/android_view_SurfaceControl.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -1008,11 +1008,11 @@ static void nativeSetShadowRadius(JNIEnv* env, jclass clazz, jlong transactionOb } static void nativeSetTrustedOverlay(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jboolean isTrustedOverlay) { jlong nativeObject, jint trustedOverlay) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); transaction->setTrustedOverlay(ctrl, isTrustedOverlay); transaction->setTrustedOverlay(ctrl, static_cast<gui::TrustedOverlay>(trustedOverlay)); } static void nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, Loading Loading @@ -2447,7 +2447,7 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetTransformHint }, {"nativeGetTransformHint", "(J)I", (void*)nativeGetTransformHint }, {"nativeSetTrustedOverlay", "(JJZ)V", {"nativeSetTrustedOverlay", "(JJI)V", (void*)nativeSetTrustedOverlay }, {"nativeGetLayerId", "(J)I", (void*)nativeGetLayerId }, Loading