Loading services/core/java/com/android/server/wm/DisplayContent.java +0 −20 Original line number Diff line number Diff line Loading @@ -193,7 +193,6 @@ import android.os.Message; import android.os.PowerManager; import android.os.RemoteCallbackList; import android.os.RemoteException; import android.os.SystemClock; import android.os.Trace; import android.os.UserHandle; import android.os.UserManager; Loading Loading @@ -2187,12 +2186,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } } /** Returns {@code true} if the screen rotation animation needs to wait for the window. */ boolean shouldSyncRotationChange(WindowState w) { final AsyncRotationController controller = mAsyncRotationController; return controller == null || !controller.isAsync(w); } void notifyInsetsChanged(Consumer<WindowState> dispatchInsetsChanged) { if (mFixedRotationLaunchingApp != null) { // The insets state of fixed rotation app is a rotated copy. Make sure the visibilities Loading Loading @@ -2279,10 +2272,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp if (!shellTransitions) { forAllWindows(w -> { w.seamlesslyRotateIfAllowed(transaction, oldRotation, rotation, rotateSeamlessly); if (!rotateSeamlessly && w.mHasSurface) { ProtoLog.v(WM_DEBUG_ORIENTATION, "Set mOrientationChanging of %s", w); w.setOrientationChanging(true); } }, true /* traverseTopToBottom */); mPinnedTaskController.startSeamlessRotationIfNeeded(transaction, oldRotation, rotation); if (!mDisplayRotation.hasSeamlessRotatingWindow()) { Loading Loading @@ -5083,15 +5072,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp Slog.w(TAG_WM, "Window freeze timeout expired."); mWmService.mWindowsFreezingScreen = WINDOWS_FREEZING_SCREENS_TIMEOUT; forAllWindows(w -> { if (!w.getOrientationChanging()) { return; } w.orientationChangeTimedOut(); w.mLastFreezeDuration = (int)(SystemClock.elapsedRealtime() - mWmService.mDisplayFreezeTime); Slog.w(TAG_WM, "Force clearing orientation change: " + w); }, true /* traverseTopToBottom */); mWmService.mWindowPlacerLocked.performSurfacePlacement(); } Loading services/core/java/com/android/server/wm/WindowManagerService.java +0 −5 Original line number Diff line number Diff line Loading @@ -6407,11 +6407,6 @@ public class WindowManagerService extends IWindowManager.Stub if (mFrozenDisplayId != INVALID_DISPLAY && mFrozenDisplayId == w.getDisplayId() && mWindowsFreezingScreen != WINDOWS_FREEZING_SCREENS_TIMEOUT) { ProtoLog.v(WM_DEBUG_ORIENTATION, "Changing surface while display frozen: %s", w); // WindowsState#reportResized won't tell invisible requested window to redraw, // so do not set it as changing orientation to avoid affecting draw state. if (w.isVisibleRequested()) { w.setOrientationChanging(true); } if (mWindowsFreezingScreen == WINDOWS_FREEZING_SCREENS_NONE) { mWindowsFreezingScreen = WINDOWS_FREEZING_SCREENS_ACTIVE; // XXX should probably keep timeout from Loading services/core/java/com/android/server/wm/WindowState.java +3 −78 Original line number Diff line number Diff line Loading @@ -148,7 +148,6 @@ import static com.android.server.wm.WindowManagerService.MY_PID; import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL; import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_REMOVING_FOCUS; import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES; import static com.android.server.wm.WindowManagerService.WINDOWS_FREEZING_SCREENS_TIMEOUT; import static com.android.server.wm.WindowStateAnimator.COMMIT_DRAW_PENDING; import static com.android.server.wm.WindowStateAnimator.DRAW_PENDING; import static com.android.server.wm.WindowStateAnimator.HAS_DRAWN; Loading Loading @@ -592,26 +591,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP /** Completely remove from window manager after exit animation? */ boolean mRemoveOnExit; /** * Set when the orientation is changing and this window has not yet * been updated for the new orientation. */ private boolean mOrientationChanging; /** The time when the window was last requested to redraw for orientation change. */ private long mOrientationChangeRedrawRequestTime; /** * Sometimes in addition to the mOrientationChanging * flag we report that the orientation is changing * due to a mismatch in current and reported configuration. * * In the case of timeout we still need to make sure we * leave the orientation changing state though, so we * use this as a special time out escape hatch. */ private boolean mOrientationChangeTimedOut; /** * The orientation during the last visible call to relayout. If our * current orientation is different, the window can't be ready Loading Loading @@ -1497,8 +1479,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // Reset the drawn state if the window need to redraw for the change, so the transition // can wait until it has finished drawing to start. if ((configChanged || getOrientationChanging() || dragResizingChanged) && isVisibleRequested()) { if ((configChanged || dragResizingChanged) && isVisibleRequested()) { winAnimator.mDrawState = DRAW_PENDING; if (mActivityRecord != null) { mActivityRecord.clearAllDrawn(); Loading @@ -1512,15 +1493,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP ProtoLog.v(WM_DEBUG_RESIZE, "Resizing window %s", this); mWmService.mResizingWindows.add(this); } } else if (getOrientationChanging()) { if (isDrawn()) { ProtoLog.v(WM_DEBUG_ORIENTATION, "Orientation not waiting for draw in %s, surfaceController %s", this, winAnimator.mSurfaceControl); setOrientationChanging(false); mLastFreezeDuration = (int)(SystemClock.elapsedRealtime() - mWmService.mDisplayFreezeTime); } } } Loading @@ -1528,46 +1500,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return !mWindowFrames.mFrame.equals(mWindowFrames.mLastFrame); } boolean getOrientationChanging() { if (mTransitionController.isShellTransitionsEnabled()) { // Shell transition doesn't use the methods for display frozen state. return false; } // In addition to the local state flag, we must also consider the difference in the last // reported configuration vs. the current state. If the client code has not been informed of // the change, logic dependent on having finished processing the orientation, such as // unfreezing, could be improperly triggered. // TODO(b/62846907): Checking against {@link mLastReportedConfiguration} could be flaky as // this is not necessarily what the client has processed yet. Find a // better indicator consistent with the client. return (mOrientationChanging || (isVisible() && getConfiguration().orientation != getLastReportedConfiguration().orientation)) && !mSeamlesslyRotated && !mOrientationChangeTimedOut; } void setOrientationChanging(boolean changing) { mOrientationChangeTimedOut = false; if (mOrientationChanging == changing) { return; } mOrientationChanging = changing; if (changing) { mLastFreezeDuration = 0; if (mWmService.mRoot.mOrientationChangeComplete && mDisplayContent.shouldSyncRotationChange(this)) { mWmService.mRoot.mOrientationChangeComplete = false; } } else { // The orientation change is completed. If it was hidden by the animation, reshow it. mDisplayContent.finishAsyncRotation(mToken); } } void orientationChangeTimedOut() { mOrientationChangeTimedOut = true; } @Override void onDisplayChanged(DisplayContent dc) { if (dc != null && mDisplayContent != null && dc != mDisplayContent Loading Loading @@ -3355,12 +3287,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mAppFreezing = false; if (mHasSurface && !getOrientationChanging() && mWmService.mWindowsFreezingScreen != WINDOWS_FREEZING_SCREENS_TIMEOUT) { ProtoLog.v(WM_DEBUG_ORIENTATION, "set mOrientationChanging of %s", this); setOrientationChanging(true); } mLastFreezeDuration = 0; setDisplayLayoutNeeded(); return true; Loading Loading @@ -4266,9 +4192,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP + " mDestroying=" + mDestroying + " mRemoved=" + mRemoved); } if (getOrientationChanging() || mAppFreezing) { pw.println(prefix + "mOrientationChanging=" + mOrientationChanging + " configOrientationChanging=" if (mAppFreezing) { pw.println(prefix + " configOrientationChanging=" + (getLastReportedConfiguration().orientation != getConfiguration().orientation) + " mAppFreezing=" + mAppFreezing); } Loading services/core/java/com/android/server/wm/WindowStateAnimator.java +0 −32 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import static android.view.WindowManager.TRANSIT_OLD_NONE; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_ANIM; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_DRAW; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_ORIENTATION; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_STARTING_WINDOW; import static com.android.internal.protolog.WmProtoLogGroups.WM_SHOW_SURFACE_ALLOC; import static com.android.internal.protolog.WmProtoLogGroups.WM_SHOW_TRANSACTIONS; Loading Loading @@ -440,13 +439,6 @@ class WindowStateAnimator { void prepareSurfaceLocked(SurfaceControl.Transaction t) { final WindowState w = mWin; if (!hasSurface()) { // There is no need to wait for an animation change if our window is gone for layout // already as we'll never be visible. if (w.getOrientationChanging() && w.isGoneForLayout()) { ProtoLog.v(WM_DEBUG_ORIENTATION, "Orientation change skips hidden %s", w); w.setOrientationChanging(false); } return; } Loading @@ -457,16 +449,6 @@ class WindowStateAnimator { if (!w.mIsWallpaper || !mService.mFlags.mEnsureWallpaperInTransitions) { mWallpaperControllerLocked.hideWallpapers(w); } // If we are waiting for this window to handle an orientation change. If this window is // really hidden (gone for layout), there is no point in still waiting for it. // Note that this does introduce a potential glitch if the window becomes unhidden // before it has drawn for the new orientation. if (w.getOrientationChanging() && w.isGoneForLayout()) { w.setOrientationChanging(false); ProtoLog.v(WM_DEBUG_ORIENTATION, "Orientation change skips hidden %s", w); } } else if (mLastAlpha != mShownAlpha || mLastHidden) { mLastAlpha = mShownAlpha; Loading @@ -483,20 +465,6 @@ class WindowStateAnimator { } } } if (w.getOrientationChanging()) { if (!w.isDrawn()) { if (w.mDisplayContent.shouldSyncRotationChange(w)) { w.mWmService.mRoot.mOrientationChangeComplete = false; mAnimator.mLastWindowFreezeSource = w; } ProtoLog.v(WM_DEBUG_ORIENTATION, "Orientation continue waiting for draw in %s", w); } else { w.setOrientationChanging(false); ProtoLog.v(WM_DEBUG_ORIENTATION, "Orientation change complete in %s", w); } } } private void showRobustly(SurfaceControl.Transaction t) { Loading services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +0 −36 Original line number Diff line number Diff line Loading @@ -1583,42 +1583,6 @@ public class DisplayContentTests extends WindowTestsBase { is(Configuration.ORIENTATION_PORTRAIT)); } @Test public void testHybridRotationAnimation() { final DisplayContent displayContent = mDefaultDisplay; final WindowState statusBar = newWindowBuilder("statusBar", TYPE_STATUS_BAR).build(); final WindowState navBar = newWindowBuilder("navBar", TYPE_NAVIGATION_BAR).build(); final WindowState app = newWindowBuilder("app", TYPE_BASE_APPLICATION).build(); final WindowState[] windows = { statusBar, navBar, app }; makeWindowVisible(windows); final DisplayPolicy displayPolicy = displayContent.getDisplayPolicy(); displayPolicy.addWindowLw(statusBar, statusBar.mAttrs); displayPolicy.addWindowLw(navBar, navBar.mAttrs); final ScreenRotationAnimation rotationAnim = new ScreenRotationAnimation(displayContent, displayContent.getRotation()); spyOn(rotationAnim); // Assume that the display rotation is changed so it is frozen in preparation for animation. doReturn(true).when(rotationAnim).hasScreenshot(); displayContent.getDisplayRotation().setRotation((displayContent.getRotation() + 1) % 4); displayContent.setRotationAnimation(rotationAnim); // The fade rotation animation also starts to hide some non-app windows. assertNotNull(displayContent.getAsyncRotationController()); assertTrue(statusBar.isAnimating(PARENTS, ANIMATION_TYPE_TOKEN_TRANSFORM)); for (WindowState w : windows) { w.setOrientationChanging(true); } // The display only waits for the app window to unfreeze. assertFalse(displayContent.shouldSyncRotationChange(statusBar)); assertFalse(displayContent.shouldSyncRotationChange(navBar)); assertTrue(displayContent.shouldSyncRotationChange(app)); // If all windows animated by fade rotation animation have done the orientation change, // the animation controller should be cleared. statusBar.setOrientationChanging(false); navBar.setOrientationChanging(false); assertNull(displayContent.getAsyncRotationController()); } @SetupWindows(addWindows = { W_ACTIVITY, W_WALLPAPER, W_STATUS_BAR, W_NAVIGATION_BAR, W_INPUT_METHOD, W_NOTIFICATION_SHADE }) @Test Loading Loading
services/core/java/com/android/server/wm/DisplayContent.java +0 −20 Original line number Diff line number Diff line Loading @@ -193,7 +193,6 @@ import android.os.Message; import android.os.PowerManager; import android.os.RemoteCallbackList; import android.os.RemoteException; import android.os.SystemClock; import android.os.Trace; import android.os.UserHandle; import android.os.UserManager; Loading Loading @@ -2187,12 +2186,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp } } /** Returns {@code true} if the screen rotation animation needs to wait for the window. */ boolean shouldSyncRotationChange(WindowState w) { final AsyncRotationController controller = mAsyncRotationController; return controller == null || !controller.isAsync(w); } void notifyInsetsChanged(Consumer<WindowState> dispatchInsetsChanged) { if (mFixedRotationLaunchingApp != null) { // The insets state of fixed rotation app is a rotated copy. Make sure the visibilities Loading Loading @@ -2279,10 +2272,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp if (!shellTransitions) { forAllWindows(w -> { w.seamlesslyRotateIfAllowed(transaction, oldRotation, rotation, rotateSeamlessly); if (!rotateSeamlessly && w.mHasSurface) { ProtoLog.v(WM_DEBUG_ORIENTATION, "Set mOrientationChanging of %s", w); w.setOrientationChanging(true); } }, true /* traverseTopToBottom */); mPinnedTaskController.startSeamlessRotationIfNeeded(transaction, oldRotation, rotation); if (!mDisplayRotation.hasSeamlessRotatingWindow()) { Loading Loading @@ -5083,15 +5072,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp Slog.w(TAG_WM, "Window freeze timeout expired."); mWmService.mWindowsFreezingScreen = WINDOWS_FREEZING_SCREENS_TIMEOUT; forAllWindows(w -> { if (!w.getOrientationChanging()) { return; } w.orientationChangeTimedOut(); w.mLastFreezeDuration = (int)(SystemClock.elapsedRealtime() - mWmService.mDisplayFreezeTime); Slog.w(TAG_WM, "Force clearing orientation change: " + w); }, true /* traverseTopToBottom */); mWmService.mWindowPlacerLocked.performSurfacePlacement(); } Loading
services/core/java/com/android/server/wm/WindowManagerService.java +0 −5 Original line number Diff line number Diff line Loading @@ -6407,11 +6407,6 @@ public class WindowManagerService extends IWindowManager.Stub if (mFrozenDisplayId != INVALID_DISPLAY && mFrozenDisplayId == w.getDisplayId() && mWindowsFreezingScreen != WINDOWS_FREEZING_SCREENS_TIMEOUT) { ProtoLog.v(WM_DEBUG_ORIENTATION, "Changing surface while display frozen: %s", w); // WindowsState#reportResized won't tell invisible requested window to redraw, // so do not set it as changing orientation to avoid affecting draw state. if (w.isVisibleRequested()) { w.setOrientationChanging(true); } if (mWindowsFreezingScreen == WINDOWS_FREEZING_SCREENS_NONE) { mWindowsFreezingScreen = WINDOWS_FREEZING_SCREENS_ACTIVE; // XXX should probably keep timeout from Loading
services/core/java/com/android/server/wm/WindowState.java +3 −78 Original line number Diff line number Diff line Loading @@ -148,7 +148,6 @@ import static com.android.server.wm.WindowManagerService.MY_PID; import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_NORMAL; import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_REMOVING_FOCUS; import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_WILL_PLACE_SURFACES; import static com.android.server.wm.WindowManagerService.WINDOWS_FREEZING_SCREENS_TIMEOUT; import static com.android.server.wm.WindowStateAnimator.COMMIT_DRAW_PENDING; import static com.android.server.wm.WindowStateAnimator.DRAW_PENDING; import static com.android.server.wm.WindowStateAnimator.HAS_DRAWN; Loading Loading @@ -592,26 +591,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP /** Completely remove from window manager after exit animation? */ boolean mRemoveOnExit; /** * Set when the orientation is changing and this window has not yet * been updated for the new orientation. */ private boolean mOrientationChanging; /** The time when the window was last requested to redraw for orientation change. */ private long mOrientationChangeRedrawRequestTime; /** * Sometimes in addition to the mOrientationChanging * flag we report that the orientation is changing * due to a mismatch in current and reported configuration. * * In the case of timeout we still need to make sure we * leave the orientation changing state though, so we * use this as a special time out escape hatch. */ private boolean mOrientationChangeTimedOut; /** * The orientation during the last visible call to relayout. If our * current orientation is different, the window can't be ready Loading Loading @@ -1497,8 +1479,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // Reset the drawn state if the window need to redraw for the change, so the transition // can wait until it has finished drawing to start. if ((configChanged || getOrientationChanging() || dragResizingChanged) && isVisibleRequested()) { if ((configChanged || dragResizingChanged) && isVisibleRequested()) { winAnimator.mDrawState = DRAW_PENDING; if (mActivityRecord != null) { mActivityRecord.clearAllDrawn(); Loading @@ -1512,15 +1493,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP ProtoLog.v(WM_DEBUG_RESIZE, "Resizing window %s", this); mWmService.mResizingWindows.add(this); } } else if (getOrientationChanging()) { if (isDrawn()) { ProtoLog.v(WM_DEBUG_ORIENTATION, "Orientation not waiting for draw in %s, surfaceController %s", this, winAnimator.mSurfaceControl); setOrientationChanging(false); mLastFreezeDuration = (int)(SystemClock.elapsedRealtime() - mWmService.mDisplayFreezeTime); } } } Loading @@ -1528,46 +1500,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP return !mWindowFrames.mFrame.equals(mWindowFrames.mLastFrame); } boolean getOrientationChanging() { if (mTransitionController.isShellTransitionsEnabled()) { // Shell transition doesn't use the methods for display frozen state. return false; } // In addition to the local state flag, we must also consider the difference in the last // reported configuration vs. the current state. If the client code has not been informed of // the change, logic dependent on having finished processing the orientation, such as // unfreezing, could be improperly triggered. // TODO(b/62846907): Checking against {@link mLastReportedConfiguration} could be flaky as // this is not necessarily what the client has processed yet. Find a // better indicator consistent with the client. return (mOrientationChanging || (isVisible() && getConfiguration().orientation != getLastReportedConfiguration().orientation)) && !mSeamlesslyRotated && !mOrientationChangeTimedOut; } void setOrientationChanging(boolean changing) { mOrientationChangeTimedOut = false; if (mOrientationChanging == changing) { return; } mOrientationChanging = changing; if (changing) { mLastFreezeDuration = 0; if (mWmService.mRoot.mOrientationChangeComplete && mDisplayContent.shouldSyncRotationChange(this)) { mWmService.mRoot.mOrientationChangeComplete = false; } } else { // The orientation change is completed. If it was hidden by the animation, reshow it. mDisplayContent.finishAsyncRotation(mToken); } } void orientationChangeTimedOut() { mOrientationChangeTimedOut = true; } @Override void onDisplayChanged(DisplayContent dc) { if (dc != null && mDisplayContent != null && dc != mDisplayContent Loading Loading @@ -3355,12 +3287,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP mAppFreezing = false; if (mHasSurface && !getOrientationChanging() && mWmService.mWindowsFreezingScreen != WINDOWS_FREEZING_SCREENS_TIMEOUT) { ProtoLog.v(WM_DEBUG_ORIENTATION, "set mOrientationChanging of %s", this); setOrientationChanging(true); } mLastFreezeDuration = 0; setDisplayLayoutNeeded(); return true; Loading Loading @@ -4266,9 +4192,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP + " mDestroying=" + mDestroying + " mRemoved=" + mRemoved); } if (getOrientationChanging() || mAppFreezing) { pw.println(prefix + "mOrientationChanging=" + mOrientationChanging + " configOrientationChanging=" if (mAppFreezing) { pw.println(prefix + " configOrientationChanging=" + (getLastReportedConfiguration().orientation != getConfiguration().orientation) + " mAppFreezing=" + mAppFreezing); } Loading
services/core/java/com/android/server/wm/WindowStateAnimator.java +0 −32 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import static android.view.WindowManager.TRANSIT_OLD_NONE; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_ANIM; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_DRAW; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_ORIENTATION; import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_STARTING_WINDOW; import static com.android.internal.protolog.WmProtoLogGroups.WM_SHOW_SURFACE_ALLOC; import static com.android.internal.protolog.WmProtoLogGroups.WM_SHOW_TRANSACTIONS; Loading Loading @@ -440,13 +439,6 @@ class WindowStateAnimator { void prepareSurfaceLocked(SurfaceControl.Transaction t) { final WindowState w = mWin; if (!hasSurface()) { // There is no need to wait for an animation change if our window is gone for layout // already as we'll never be visible. if (w.getOrientationChanging() && w.isGoneForLayout()) { ProtoLog.v(WM_DEBUG_ORIENTATION, "Orientation change skips hidden %s", w); w.setOrientationChanging(false); } return; } Loading @@ -457,16 +449,6 @@ class WindowStateAnimator { if (!w.mIsWallpaper || !mService.mFlags.mEnsureWallpaperInTransitions) { mWallpaperControllerLocked.hideWallpapers(w); } // If we are waiting for this window to handle an orientation change. If this window is // really hidden (gone for layout), there is no point in still waiting for it. // Note that this does introduce a potential glitch if the window becomes unhidden // before it has drawn for the new orientation. if (w.getOrientationChanging() && w.isGoneForLayout()) { w.setOrientationChanging(false); ProtoLog.v(WM_DEBUG_ORIENTATION, "Orientation change skips hidden %s", w); } } else if (mLastAlpha != mShownAlpha || mLastHidden) { mLastAlpha = mShownAlpha; Loading @@ -483,20 +465,6 @@ class WindowStateAnimator { } } } if (w.getOrientationChanging()) { if (!w.isDrawn()) { if (w.mDisplayContent.shouldSyncRotationChange(w)) { w.mWmService.mRoot.mOrientationChangeComplete = false; mAnimator.mLastWindowFreezeSource = w; } ProtoLog.v(WM_DEBUG_ORIENTATION, "Orientation continue waiting for draw in %s", w); } else { w.setOrientationChanging(false); ProtoLog.v(WM_DEBUG_ORIENTATION, "Orientation change complete in %s", w); } } } private void showRobustly(SurfaceControl.Transaction t) { Loading
services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +0 −36 Original line number Diff line number Diff line Loading @@ -1583,42 +1583,6 @@ public class DisplayContentTests extends WindowTestsBase { is(Configuration.ORIENTATION_PORTRAIT)); } @Test public void testHybridRotationAnimation() { final DisplayContent displayContent = mDefaultDisplay; final WindowState statusBar = newWindowBuilder("statusBar", TYPE_STATUS_BAR).build(); final WindowState navBar = newWindowBuilder("navBar", TYPE_NAVIGATION_BAR).build(); final WindowState app = newWindowBuilder("app", TYPE_BASE_APPLICATION).build(); final WindowState[] windows = { statusBar, navBar, app }; makeWindowVisible(windows); final DisplayPolicy displayPolicy = displayContent.getDisplayPolicy(); displayPolicy.addWindowLw(statusBar, statusBar.mAttrs); displayPolicy.addWindowLw(navBar, navBar.mAttrs); final ScreenRotationAnimation rotationAnim = new ScreenRotationAnimation(displayContent, displayContent.getRotation()); spyOn(rotationAnim); // Assume that the display rotation is changed so it is frozen in preparation for animation. doReturn(true).when(rotationAnim).hasScreenshot(); displayContent.getDisplayRotation().setRotation((displayContent.getRotation() + 1) % 4); displayContent.setRotationAnimation(rotationAnim); // The fade rotation animation also starts to hide some non-app windows. assertNotNull(displayContent.getAsyncRotationController()); assertTrue(statusBar.isAnimating(PARENTS, ANIMATION_TYPE_TOKEN_TRANSFORM)); for (WindowState w : windows) { w.setOrientationChanging(true); } // The display only waits for the app window to unfreeze. assertFalse(displayContent.shouldSyncRotationChange(statusBar)); assertFalse(displayContent.shouldSyncRotationChange(navBar)); assertTrue(displayContent.shouldSyncRotationChange(app)); // If all windows animated by fade rotation animation have done the orientation change, // the animation controller should be cleared. statusBar.setOrientationChanging(false); navBar.setOrientationChanging(false); assertNull(displayContent.getAsyncRotationController()); } @SetupWindows(addWindows = { W_ACTIVITY, W_WALLPAPER, W_STATUS_BAR, W_NAVIGATION_BAR, W_INPUT_METHOD, W_NOTIFICATION_SHADE }) @Test Loading