Loading services/core/java/com/android/server/wm/ActivityRecord.java +3 −1 Original line number Diff line number Diff line Loading @@ -2322,7 +2322,9 @@ final class ActivityRecord extends ConfigurationContainer { return; } if (configChanges == 0 && mAppWindowToken.okToDisplay()) { // Window configuration changes only effect windows, so don't require a screen freeze. int freezableConfigChanges = configChanges & ~(CONFIG_WINDOW_CONFIGURATION); if (freezableConfigChanges == 0 && mAppWindowToken.okToDisplay()) { if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Skipping set freeze of " + appToken); return; } Loading services/core/java/com/android/server/wm/AppWindowToken.java +6 −2 Original line number Diff line number Diff line Loading @@ -509,6 +509,10 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree final DisplayContent displayContent = getDisplayContent(); displayContent.mOpeningApps.remove(this); displayContent.mClosingApps.remove(this); if (isInChangeTransition()) { clearChangeLeash(getPendingTransaction(), true /* cancel */); } displayContent.mChangingApps.remove(this); waitingToShow = false; hiddenRequested = !visible; mDeferHidingClient = deferHidingClient; Loading Loading @@ -1310,7 +1314,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree void onDisplayChanged(DisplayContent dc) { DisplayContent prevDc = mDisplayContent; super.onDisplayChanged(dc); if (prevDc == null) { if (prevDc == null || prevDc == mDisplayContent) { return; } if (prevDc.mChangingApps.contains(this)) { Loading @@ -1333,7 +1337,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree } } if (prevDc != mDisplayContent && mLetterbox != null) { if (mLetterbox != null) { mLetterbox.onMovedToDisplay(mDisplayContent.getDisplayId()); } } Loading services/core/java/com/android/server/wm/WindowManagerService.java +17 −0 Original line number Diff line number Diff line Loading @@ -6828,9 +6828,26 @@ public class WindowManagerService extends IWindowManager.Stub return; } int lastWindowingMode = displayContent.getWindowingMode(); mDisplayWindowSettings.setWindowingModeLocked(displayContent, mode); reconfigureDisplayLocked(displayContent); if (lastWindowingMode != displayContent.getWindowingMode()) { // reconfigure won't detect this change in isolation because the windowing mode is // already set on the display, so fire off a new config now. mH.removeMessages(H.SEND_NEW_CONFIGURATION); final long origId = Binder.clearCallingIdentity(); try { // direct call since lock is shared. sendNewConfiguration(displayId); } finally { Binder.restoreCallingIdentity(origId); } // Now that all configurations are updated, execute pending transitions displayContent.executeAppTransition(); } } } Loading services/tests/wmtests/src/com/android/server/wm/AppChangeTransitionTests.java +18 −0 Original line number Diff line number Diff line Loading @@ -158,4 +158,22 @@ public class AppChangeTransitionTests extends WindowTestsBase { waitUntilHandlersIdle(); mToken.removeImmediately(); } @Test public void testCancelPendingChangeOnHide() { // setup currently defaults to no snapshot. setUpOnDisplay(mDisplayContent); mTask.setWindowingMode(WINDOWING_MODE_FREEFORM); assertEquals(1, mDisplayContent.mChangingApps.size()); assertTrue(mToken.isInChangeTransition()); // Changing visibility should cancel the change transition and become closing mToken.setVisibility(false, false); assertEquals(0, mDisplayContent.mChangingApps.size()); assertFalse(mToken.isInChangeTransition()); waitUntilHandlersIdle(); mToken.removeImmediately(); } } Loading
services/core/java/com/android/server/wm/ActivityRecord.java +3 −1 Original line number Diff line number Diff line Loading @@ -2322,7 +2322,9 @@ final class ActivityRecord extends ConfigurationContainer { return; } if (configChanges == 0 && mAppWindowToken.okToDisplay()) { // Window configuration changes only effect windows, so don't require a screen freeze. int freezableConfigChanges = configChanges & ~(CONFIG_WINDOW_CONFIGURATION); if (freezableConfigChanges == 0 && mAppWindowToken.okToDisplay()) { if (DEBUG_ORIENTATION) Slog.v(TAG_WM, "Skipping set freeze of " + appToken); return; } Loading
services/core/java/com/android/server/wm/AppWindowToken.java +6 −2 Original line number Diff line number Diff line Loading @@ -509,6 +509,10 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree final DisplayContent displayContent = getDisplayContent(); displayContent.mOpeningApps.remove(this); displayContent.mClosingApps.remove(this); if (isInChangeTransition()) { clearChangeLeash(getPendingTransaction(), true /* cancel */); } displayContent.mChangingApps.remove(this); waitingToShow = false; hiddenRequested = !visible; mDeferHidingClient = deferHidingClient; Loading Loading @@ -1310,7 +1314,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree void onDisplayChanged(DisplayContent dc) { DisplayContent prevDc = mDisplayContent; super.onDisplayChanged(dc); if (prevDc == null) { if (prevDc == null || prevDc == mDisplayContent) { return; } if (prevDc.mChangingApps.contains(this)) { Loading @@ -1333,7 +1337,7 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree } } if (prevDc != mDisplayContent && mLetterbox != null) { if (mLetterbox != null) { mLetterbox.onMovedToDisplay(mDisplayContent.getDisplayId()); } } Loading
services/core/java/com/android/server/wm/WindowManagerService.java +17 −0 Original line number Diff line number Diff line Loading @@ -6828,9 +6828,26 @@ public class WindowManagerService extends IWindowManager.Stub return; } int lastWindowingMode = displayContent.getWindowingMode(); mDisplayWindowSettings.setWindowingModeLocked(displayContent, mode); reconfigureDisplayLocked(displayContent); if (lastWindowingMode != displayContent.getWindowingMode()) { // reconfigure won't detect this change in isolation because the windowing mode is // already set on the display, so fire off a new config now. mH.removeMessages(H.SEND_NEW_CONFIGURATION); final long origId = Binder.clearCallingIdentity(); try { // direct call since lock is shared. sendNewConfiguration(displayId); } finally { Binder.restoreCallingIdentity(origId); } // Now that all configurations are updated, execute pending transitions displayContent.executeAppTransition(); } } } Loading
services/tests/wmtests/src/com/android/server/wm/AppChangeTransitionTests.java +18 −0 Original line number Diff line number Diff line Loading @@ -158,4 +158,22 @@ public class AppChangeTransitionTests extends WindowTestsBase { waitUntilHandlersIdle(); mToken.removeImmediately(); } @Test public void testCancelPendingChangeOnHide() { // setup currently defaults to no snapshot. setUpOnDisplay(mDisplayContent); mTask.setWindowingMode(WINDOWING_MODE_FREEFORM); assertEquals(1, mDisplayContent.mChangingApps.size()); assertTrue(mToken.isInChangeTransition()); // Changing visibility should cancel the change transition and become closing mToken.setVisibility(false, false); assertEquals(0, mDisplayContent.mChangingApps.size()); assertFalse(mToken.isInChangeTransition()); waitUntilHandlersIdle(); mToken.removeImmediately(); } }