Loading core/java/android/window/flags/windowing_frontend.aconfig +11 −0 Original line number Diff line number Diff line Loading @@ -414,6 +414,17 @@ flag { } } flag { name: "keep_app_window_hide_while_locked" namespace: "windowing_frontend" description: "Do not let app window visible while device is locked" is_fixed_read_only: true bug: "378088391" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "port_window_size_animation" namespace: "windowing_frontend" Loading services/core/java/com/android/server/wm/ActivityRecord.java +22 −0 Original line number Diff line number Diff line Loading @@ -232,6 +232,7 @@ import static com.android.server.wm.IdentifierProto.USER_ID; import static com.android.server.wm.StartingData.AFTER_TRANSACTION_COPY_TO_CLIENT; import static com.android.server.wm.StartingData.AFTER_TRANSACTION_IDLE; import static com.android.server.wm.StartingData.AFTER_TRANSACTION_REMOVE_DIRECTLY; import static com.android.server.wm.StartingData.AFTER_TRANSITION_FINISH; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_PREDICT_BACK; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_WINDOW_ANIMATION; Loading Loading @@ -2814,9 +2815,27 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A attachStartingSurfaceToAssociatedTask(); } /** * If the device is locked and the app does not request showWhenLocked, * defer removing the starting window until the transition is complete. * This prevents briefly appearing the app context and causing secure concern. */ void deferStartingWindowRemovalForKeyguardUnoccluding() { if (mStartingData.mRemoveAfterTransaction != AFTER_TRANSITION_FINISH && isKeyguardLocked() && !canShowWhenLockedInner(this) && !isVisibleRequested() && mTransitionController.inTransition(this)) { mStartingData.mRemoveAfterTransaction = AFTER_TRANSITION_FINISH; } } void removeStartingWindow() { boolean prevEligibleForLetterboxEducation = isEligibleForLetterboxEducation(); if (mStartingData != null && mStartingData.mRemoveAfterTransaction == AFTER_TRANSITION_FINISH) { return; } if (transferSplashScreenIfNeeded()) { return; } Loading Loading @@ -4655,6 +4674,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A tStartingWindow.mToken = this; tStartingWindow.mActivityRecord = this; if (mStartingData.mRemoveAfterTransaction == AFTER_TRANSITION_FINISH) { mStartingData.mRemoveAfterTransaction = AFTER_TRANSACTION_IDLE; } if (mStartingData.mRemoveAfterTransaction == AFTER_TRANSACTION_REMOVE_DIRECTLY) { // The removal of starting window should wait for window drawn of current // activity. Loading services/core/java/com/android/server/wm/StartingData.java +7 −0 Original line number Diff line number Diff line Loading @@ -31,11 +31,18 @@ public abstract class StartingData { static final int AFTER_TRANSACTION_REMOVE_DIRECTLY = 1; /** Do copy splash screen to client after transaction done. */ static final int AFTER_TRANSACTION_COPY_TO_CLIENT = 2; /** * Remove the starting window after transition finish. * Used when activity doesn't request show when locked, so the app window should never show to * the user if device is locked. **/ static final int AFTER_TRANSITION_FINISH = 3; @IntDef(prefix = { "AFTER_TRANSACTION" }, value = { AFTER_TRANSACTION_IDLE, AFTER_TRANSACTION_REMOVE_DIRECTLY, AFTER_TRANSACTION_COPY_TO_CLIENT, AFTER_TRANSITION_FINISH, }) @interface AfterTransaction {} Loading services/core/java/com/android/server/wm/Transition.java +9 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,8 @@ import static com.android.server.wm.ActivityRecord.State.RESUMED; import static com.android.server.wm.ActivityTaskManagerInternal.APP_TRANSITION_RECENTS_ANIM; import static com.android.server.wm.ActivityTaskManagerInternal.APP_TRANSITION_SPLASH_SCREEN; import static com.android.server.wm.ActivityTaskManagerInternal.APP_TRANSITION_WINDOWS_DRAWN; import static com.android.server.wm.StartingData.AFTER_TRANSACTION_IDLE; import static com.android.server.wm.StartingData.AFTER_TRANSITION_FINISH; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_PREDICT_BACK; import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS; import static com.android.server.wm.WindowState.BLAST_TIMEOUT_DURATION; Loading Loading @@ -1374,6 +1376,13 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { enterAutoPip = true; } } if (ar.mStartingData != null && ar.mStartingData.mRemoveAfterTransaction == AFTER_TRANSITION_FINISH && (!ar.isVisible() || !ar.mTransitionController.inTransition(ar))) { ar.mStartingData.mRemoveAfterTransaction = AFTER_TRANSACTION_IDLE; ar.removeStartingWindow(); } final ChangeInfo changeInfo = mChanges.get(ar); // Due to transient-hide, there may be some activities here which weren't in the // transition. Loading services/core/java/com/android/server/wm/WindowState.java +15 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,7 @@ import static com.android.server.wm.IdentifierProto.USER_ID; import static com.android.server.wm.MoveAnimationSpecProto.DURATION_MS; import static com.android.server.wm.MoveAnimationSpecProto.FROM; import static com.android.server.wm.MoveAnimationSpecProto.TO; import static com.android.server.wm.StartingData.AFTER_TRANSITION_FINISH; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_ALL; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_STARTING_REVEAL; Loading Loading @@ -1920,6 +1921,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } final ActivityRecord atoken = mActivityRecord; if (atoken != null) { if (atoken.mStartingData != null && mAttrs.type != TYPE_APPLICATION_STARTING && atoken.mStartingData.mRemoveAfterTransaction == AFTER_TRANSITION_FINISH) { // Preventing app window from visible during un-occluding animation playing due to // alpha blending. return false; } final boolean isVisible = isStartingWindowAssociatedToTask() ? mStartingData.mAssociatedTask.isVisible() : atoken.isVisible(); return ((!isParentWindowHidden() && isVisible) Loading Loading @@ -2925,7 +2933,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP final int mask = FLAG_SHOW_WHEN_LOCKED | FLAG_DISMISS_KEYGUARD | FLAG_ALLOW_LOCK_WHILE_SCREEN_ON; WindowManager.LayoutParams sa = mActivityRecord.mStartingWindow.mAttrs; final boolean wasShowWhenLocked = (sa.flags & FLAG_SHOW_WHEN_LOCKED) != 0; final boolean removeShowWhenLocked = (mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) == 0; sa.flags = (sa.flags & ~mask) | (mAttrs.flags & mask); if (Flags.keepAppWindowHideWhileLocked() && wasShowWhenLocked && removeShowWhenLocked) { // Trigger unoccluding animation if needed. mActivityRecord.checkKeyguardFlagsChanged(); mActivityRecord.deferStartingWindowRemovalForKeyguardUnoccluding(); } } } Loading Loading
core/java/android/window/flags/windowing_frontend.aconfig +11 −0 Original line number Diff line number Diff line Loading @@ -414,6 +414,17 @@ flag { } } flag { name: "keep_app_window_hide_while_locked" namespace: "windowing_frontend" description: "Do not let app window visible while device is locked" is_fixed_read_only: true bug: "378088391" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "port_window_size_animation" namespace: "windowing_frontend" Loading
services/core/java/com/android/server/wm/ActivityRecord.java +22 −0 Original line number Diff line number Diff line Loading @@ -232,6 +232,7 @@ import static com.android.server.wm.IdentifierProto.USER_ID; import static com.android.server.wm.StartingData.AFTER_TRANSACTION_COPY_TO_CLIENT; import static com.android.server.wm.StartingData.AFTER_TRANSACTION_IDLE; import static com.android.server.wm.StartingData.AFTER_TRANSACTION_REMOVE_DIRECTLY; import static com.android.server.wm.StartingData.AFTER_TRANSITION_FINISH; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_PREDICT_BACK; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_WINDOW_ANIMATION; Loading Loading @@ -2814,9 +2815,27 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A attachStartingSurfaceToAssociatedTask(); } /** * If the device is locked and the app does not request showWhenLocked, * defer removing the starting window until the transition is complete. * This prevents briefly appearing the app context and causing secure concern. */ void deferStartingWindowRemovalForKeyguardUnoccluding() { if (mStartingData.mRemoveAfterTransaction != AFTER_TRANSITION_FINISH && isKeyguardLocked() && !canShowWhenLockedInner(this) && !isVisibleRequested() && mTransitionController.inTransition(this)) { mStartingData.mRemoveAfterTransaction = AFTER_TRANSITION_FINISH; } } void removeStartingWindow() { boolean prevEligibleForLetterboxEducation = isEligibleForLetterboxEducation(); if (mStartingData != null && mStartingData.mRemoveAfterTransaction == AFTER_TRANSITION_FINISH) { return; } if (transferSplashScreenIfNeeded()) { return; } Loading Loading @@ -4655,6 +4674,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A tStartingWindow.mToken = this; tStartingWindow.mActivityRecord = this; if (mStartingData.mRemoveAfterTransaction == AFTER_TRANSITION_FINISH) { mStartingData.mRemoveAfterTransaction = AFTER_TRANSACTION_IDLE; } if (mStartingData.mRemoveAfterTransaction == AFTER_TRANSACTION_REMOVE_DIRECTLY) { // The removal of starting window should wait for window drawn of current // activity. Loading
services/core/java/com/android/server/wm/StartingData.java +7 −0 Original line number Diff line number Diff line Loading @@ -31,11 +31,18 @@ public abstract class StartingData { static final int AFTER_TRANSACTION_REMOVE_DIRECTLY = 1; /** Do copy splash screen to client after transaction done. */ static final int AFTER_TRANSACTION_COPY_TO_CLIENT = 2; /** * Remove the starting window after transition finish. * Used when activity doesn't request show when locked, so the app window should never show to * the user if device is locked. **/ static final int AFTER_TRANSITION_FINISH = 3; @IntDef(prefix = { "AFTER_TRANSACTION" }, value = { AFTER_TRANSACTION_IDLE, AFTER_TRANSACTION_REMOVE_DIRECTLY, AFTER_TRANSACTION_COPY_TO_CLIENT, AFTER_TRANSITION_FINISH, }) @interface AfterTransaction {} Loading
services/core/java/com/android/server/wm/Transition.java +9 −0 Original line number Diff line number Diff line Loading @@ -70,6 +70,8 @@ import static com.android.server.wm.ActivityRecord.State.RESUMED; import static com.android.server.wm.ActivityTaskManagerInternal.APP_TRANSITION_RECENTS_ANIM; import static com.android.server.wm.ActivityTaskManagerInternal.APP_TRANSITION_SPLASH_SCREEN; import static com.android.server.wm.ActivityTaskManagerInternal.APP_TRANSITION_WINDOWS_DRAWN; import static com.android.server.wm.StartingData.AFTER_TRANSACTION_IDLE; import static com.android.server.wm.StartingData.AFTER_TRANSITION_FINISH; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_PREDICT_BACK; import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS; import static com.android.server.wm.WindowState.BLAST_TIMEOUT_DURATION; Loading Loading @@ -1374,6 +1376,13 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener { enterAutoPip = true; } } if (ar.mStartingData != null && ar.mStartingData.mRemoveAfterTransaction == AFTER_TRANSITION_FINISH && (!ar.isVisible() || !ar.mTransitionController.inTransition(ar))) { ar.mStartingData.mRemoveAfterTransaction = AFTER_TRANSACTION_IDLE; ar.removeStartingWindow(); } final ChangeInfo changeInfo = mChanges.get(ar); // Due to transient-hide, there may be some activities here which weren't in the // transition. Loading
services/core/java/com/android/server/wm/WindowState.java +15 −0 Original line number Diff line number Diff line Loading @@ -126,6 +126,7 @@ import static com.android.server.wm.IdentifierProto.USER_ID; import static com.android.server.wm.MoveAnimationSpecProto.DURATION_MS; import static com.android.server.wm.MoveAnimationSpecProto.FROM; import static com.android.server.wm.MoveAnimationSpecProto.TO; import static com.android.server.wm.StartingData.AFTER_TRANSITION_FINISH; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_ALL; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION; import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_STARTING_REVEAL; Loading Loading @@ -1920,6 +1921,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP } final ActivityRecord atoken = mActivityRecord; if (atoken != null) { if (atoken.mStartingData != null && mAttrs.type != TYPE_APPLICATION_STARTING && atoken.mStartingData.mRemoveAfterTransaction == AFTER_TRANSITION_FINISH) { // Preventing app window from visible during un-occluding animation playing due to // alpha blending. return false; } final boolean isVisible = isStartingWindowAssociatedToTask() ? mStartingData.mAssociatedTask.isVisible() : atoken.isVisible(); return ((!isParentWindowHidden() && isVisible) Loading Loading @@ -2925,7 +2933,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP final int mask = FLAG_SHOW_WHEN_LOCKED | FLAG_DISMISS_KEYGUARD | FLAG_ALLOW_LOCK_WHILE_SCREEN_ON; WindowManager.LayoutParams sa = mActivityRecord.mStartingWindow.mAttrs; final boolean wasShowWhenLocked = (sa.flags & FLAG_SHOW_WHEN_LOCKED) != 0; final boolean removeShowWhenLocked = (mAttrs.flags & FLAG_SHOW_WHEN_LOCKED) == 0; sa.flags = (sa.flags & ~mask) | (mAttrs.flags & mask); if (Flags.keepAppWindowHideWhileLocked() && wasShowWhenLocked && removeShowWhenLocked) { // Trigger unoccluding animation if needed. mActivityRecord.checkKeyguardFlagsChanged(); mActivityRecord.deferStartingWindowRemovalForKeyguardUnoccluding(); } } } Loading