Loading core/java/android/view/SurfaceControl.java +13 −0 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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. Loading core/jni/android_view_SurfaceControl.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -823,6 +823,14 @@ static void nativeSetShadowRadius(JNIEnv* env, jclass clazz, jlong transactionOb transaction->setShadowRadius(ctrl, shadowRadius); } static void nativeSetTrustedOverlay(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jboolean isTrustedOverlay) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); transaction->setTrustedOverlay(ctrl, isTrustedOverlay); } static void nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jfloat frameRate, jint compatibility, jint changeFrameRateStrategy) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); Loading Loading @@ -1984,6 +1992,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetTransformHint }, {"nativeGetTransformHint", "(J)I", (void*)nativeGetTransformHint }, {"nativeSetTrustedOverlay", "(JJZ)V", (void*)nativeSetTrustedOverlay }, // clang-format on }; Loading services/core/java/com/android/server/wm/RootWindowContainer.java +6 −2 Original line number Diff line number Diff line Loading @@ -2206,16 +2206,17 @@ class RootWindowContainer extends WindowContainer<DisplayContent> ensureActivitiesVisible(null, 0, false /* preserveWindows */); resumeFocusedTasksTopActivities(); notifyActivityPipModeChanged(r); notifyActivityPipModeChanged(r.getTask(), r); } /** * Notifies when an activity enters or leaves PIP mode. * * @param task the task of {@param r} * @param r indicates the activity currently in PIP, can be null to indicate no activity is * currently in PIP mode. */ void notifyActivityPipModeChanged(@Nullable ActivityRecord r) { void notifyActivityPipModeChanged(@NonNull Task task, @Nullable ActivityRecord r) { final boolean inPip = r != null; if (inPip) { mService.getTaskChangeNotificationController().notifyActivityPinned(r); Loading @@ -2223,6 +2224,9 @@ class RootWindowContainer extends WindowContainer<DisplayContent> mService.getTaskChangeNotificationController().notifyActivityUnpinned(); } mWindowManager.mPolicy.setPipVisibilityLw(inPip); mWmService.mTransactionFactory.get() .setTrustedOverlay(task.getSurfaceControl(), inPip) .apply(); } void executeAppTransitionForAllDisplay() { Loading services/core/java/com/android/server/wm/Task.java +2 −2 Original line number Diff line number Diff line Loading @@ -1437,7 +1437,7 @@ class Task extends WindowContainer<WindowContainer> { && (newParent == null || !newParent.inPinnedWindowingMode())) { // Notify if a task from the root pinned task is being removed // (or moved depending on the mode). mRootWindowContainer.notifyActivityPipModeChanged(null); mRootWindowContainer.notifyActivityPipModeChanged(this, null); } } Loading Loading @@ -5394,7 +5394,7 @@ class Task extends WindowContainer<WindowContainer> { : WINDOWING_MODE_FULLSCREEN; } if (currentMode == WINDOWING_MODE_PINNED) { mRootWindowContainer.notifyActivityPipModeChanged(null); mRootWindowContainer.notifyActivityPipModeChanged(this, null); } if (likelyResolvedMode == WINDOWING_MODE_PINNED) { // In the case that we've disabled affecting the SysUI flags as a part of seamlessly Loading services/tests/wmtests/src/com/android/server/wm/StubTransaction.java +6 −0 Original line number Diff line number Diff line Loading @@ -265,4 +265,10 @@ public class StubTransaction extends SurfaceControl.Transaction { public SurfaceControl.Transaction setColorSpace(SurfaceControl sc, ColorSpace colorSpace) { return this; } @Override public SurfaceControl.Transaction setTrustedOverlay(SurfaceControl sc, boolean isTrustedOverlay) { return this; } } Loading
core/java/android/view/SurfaceControl.java +13 −0 Original line number Diff line number Diff line Loading @@ -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); Loading Loading @@ -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. Loading
core/jni/android_view_SurfaceControl.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -823,6 +823,14 @@ static void nativeSetShadowRadius(JNIEnv* env, jclass clazz, jlong transactionOb transaction->setShadowRadius(ctrl, shadowRadius); } static void nativeSetTrustedOverlay(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jboolean isTrustedOverlay) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject); transaction->setTrustedOverlay(ctrl, isTrustedOverlay); } static void nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jfloat frameRate, jint compatibility, jint changeFrameRateStrategy) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); Loading Loading @@ -1984,6 +1992,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetTransformHint }, {"nativeGetTransformHint", "(J)I", (void*)nativeGetTransformHint }, {"nativeSetTrustedOverlay", "(JJZ)V", (void*)nativeSetTrustedOverlay }, // clang-format on }; Loading
services/core/java/com/android/server/wm/RootWindowContainer.java +6 −2 Original line number Diff line number Diff line Loading @@ -2206,16 +2206,17 @@ class RootWindowContainer extends WindowContainer<DisplayContent> ensureActivitiesVisible(null, 0, false /* preserveWindows */); resumeFocusedTasksTopActivities(); notifyActivityPipModeChanged(r); notifyActivityPipModeChanged(r.getTask(), r); } /** * Notifies when an activity enters or leaves PIP mode. * * @param task the task of {@param r} * @param r indicates the activity currently in PIP, can be null to indicate no activity is * currently in PIP mode. */ void notifyActivityPipModeChanged(@Nullable ActivityRecord r) { void notifyActivityPipModeChanged(@NonNull Task task, @Nullable ActivityRecord r) { final boolean inPip = r != null; if (inPip) { mService.getTaskChangeNotificationController().notifyActivityPinned(r); Loading @@ -2223,6 +2224,9 @@ class RootWindowContainer extends WindowContainer<DisplayContent> mService.getTaskChangeNotificationController().notifyActivityUnpinned(); } mWindowManager.mPolicy.setPipVisibilityLw(inPip); mWmService.mTransactionFactory.get() .setTrustedOverlay(task.getSurfaceControl(), inPip) .apply(); } void executeAppTransitionForAllDisplay() { Loading
services/core/java/com/android/server/wm/Task.java +2 −2 Original line number Diff line number Diff line Loading @@ -1437,7 +1437,7 @@ class Task extends WindowContainer<WindowContainer> { && (newParent == null || !newParent.inPinnedWindowingMode())) { // Notify if a task from the root pinned task is being removed // (or moved depending on the mode). mRootWindowContainer.notifyActivityPipModeChanged(null); mRootWindowContainer.notifyActivityPipModeChanged(this, null); } } Loading Loading @@ -5394,7 +5394,7 @@ class Task extends WindowContainer<WindowContainer> { : WINDOWING_MODE_FULLSCREEN; } if (currentMode == WINDOWING_MODE_PINNED) { mRootWindowContainer.notifyActivityPipModeChanged(null); mRootWindowContainer.notifyActivityPipModeChanged(this, null); } if (likelyResolvedMode == WINDOWING_MODE_PINNED) { // In the case that we've disabled affecting the SysUI flags as a part of seamlessly Loading
services/tests/wmtests/src/com/android/server/wm/StubTransaction.java +6 −0 Original line number Diff line number Diff line Loading @@ -265,4 +265,10 @@ public class StubTransaction extends SurfaceControl.Transaction { public SurfaceControl.Transaction setColorSpace(SurfaceControl sc, ColorSpace colorSpace) { return this; } @Override public SurfaceControl.Transaction setTrustedOverlay(SurfaceControl sc, boolean isTrustedOverlay) { return this; } }