Loading services/core/java/com/android/server/wm/FadeRotationAnimationController.java +11 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,9 @@ public class FadeRotationAnimationController extends FadeAnimationController { private final Runnable mFrozenTimeoutRunnable; private final WindowToken mNavBarToken; /** A runnable which gets called when the {@link #show()} is called. */ private Runnable mOnShowRunnable; public FadeRotationAnimationController(DisplayContent displayContent) { super(displayContent); mService = displayContent.mWmService; Loading Loading @@ -81,6 +84,10 @@ public class FadeRotationAnimationController extends FadeAnimationController { if (mFrozenTimeoutRunnable != null) { mService.mH.removeCallbacks(mFrozenTimeoutRunnable); } if (mOnShowRunnable != null) { mOnShowRunnable.run(); mOnShowRunnable = null; } } /** Loading Loading @@ -115,6 +122,10 @@ public class FadeRotationAnimationController extends FadeAnimationController { return token == mNavBarToken || mTargetWindowTokens.contains(token); } void setOnShowRunnable(Runnable onShowRunnable) { mOnShowRunnable = onShowRunnable; } @Override public Animation getFadeInAnimation() { if (mFrozenTimeoutRunnable != null) { Loading services/core/java/com/android/server/wm/RecentsAnimationController.java +21 −9 Original line number Diff line number Diff line Loading @@ -669,21 +669,33 @@ public class RecentsAnimationController implements DeathRecipient { } navWindow.setSurfaceTranslationY(0); if (navWindow.mToken == null) { final WindowToken navToken = navWindow.mToken; if (navToken == null) { return; } final SurfaceControl.Transaction t = mDisplayContent.getPendingTransaction(); final WindowContainer parent = navWindow.mToken.getParent(); // Reparent the SurfaceControl of nav bar token back. t.reparent(navWindow.mToken.getSurfaceControl(), parent.getSurfaceControl()); final WindowContainer parent = navToken.getParent(); if (animate) { // Run fade-in animation to show navigation bar back to bottom of the display. final NavBarFadeAnimationController controller = final NavBarFadeAnimationController navBarFadeAnimationController = mDisplayContent.getDisplayPolicy().getNavBarFadeAnimationController(); if (controller != null) { controller.fadeWindowToken(true); final Runnable fadeInAnim = () -> { // Reparent the SurfaceControl of nav bar token back. t.reparent(navToken.getSurfaceControl(), parent.getSurfaceControl()); // Run fade-in animation to show navigation bar back to bottom of the display. if (navBarFadeAnimationController != null) { navBarFadeAnimationController.fadeWindowToken(true); } }; final FadeRotationAnimationController fadeRotationAnimationController = mDisplayContent.getFadeRotationAnimationController(); if (fadeRotationAnimationController != null) { fadeRotationAnimationController.setOnShowRunnable(fadeInAnim); } else { fadeInAnim.run(); } } else { // Reparent the SurfaceControl of nav bar token back. t.reparent(navToken.getSurfaceControl(), parent.getSurfaceControl()); } } Loading services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java +31 −0 Original line number Diff line number Diff line Loading @@ -566,6 +566,37 @@ public class RecentsAnimationControllerTest extends WindowTestsBase { assertFalse(mController.isNavigationBarAttachedToApp()); } @Test public void testFadeRotationAfterAttachAndBeforeRestore_notRestoreNavImmediately() { setupForShouldAttachNavBarDuringTransition(); final ActivityRecord activity = createActivityRecord(mDefaultDisplay); final ActivityRecord homeActivity = createHomeActivity(); initializeRecentsAnimationController(mController, homeActivity); final WindowToken navToken = mDefaultDisplay.getDisplayPolicy().getNavigationBar().mToken; final SurfaceControl.Transaction transaction = navToken.getPendingTransaction(); verify(mController.mStatusBar).setNavigationBarLumaSamplingEnabled( mDefaultDisplay.mDisplayId, false); verify(transaction).reparent(navToken.getSurfaceControl(), activity.getSurfaceControl()); final WindowContainer parent = navToken.getParent(); final NavBarFadeAnimationController navBarFadeAnimationController = mDefaultDisplay.getDisplayPolicy().getNavBarFadeAnimationController(); FadeRotationAnimationController mockController = mock(FadeRotationAnimationController.class); doReturn(mockController).when(mDefaultDisplay).getFadeRotationAnimationController(); mController.cleanupAnimation(REORDER_MOVE_TO_TOP); verify(mController.mStatusBar).setNavigationBarLumaSamplingEnabled( mDefaultDisplay.mDisplayId, true); verify(mockController).setOnShowRunnable(any()); verify(transaction, times(0)).reparent(navToken.getSurfaceControl(), parent.getSurfaceControl()); verify(navBarFadeAnimationController, times(0)).fadeWindowToken(true); } @Test public void testAttachNavBarInSplitScreenMode() { setupForShouldAttachNavBarDuringTransition(); Loading Loading
services/core/java/com/android/server/wm/FadeRotationAnimationController.java +11 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,9 @@ public class FadeRotationAnimationController extends FadeAnimationController { private final Runnable mFrozenTimeoutRunnable; private final WindowToken mNavBarToken; /** A runnable which gets called when the {@link #show()} is called. */ private Runnable mOnShowRunnable; public FadeRotationAnimationController(DisplayContent displayContent) { super(displayContent); mService = displayContent.mWmService; Loading Loading @@ -81,6 +84,10 @@ public class FadeRotationAnimationController extends FadeAnimationController { if (mFrozenTimeoutRunnable != null) { mService.mH.removeCallbacks(mFrozenTimeoutRunnable); } if (mOnShowRunnable != null) { mOnShowRunnable.run(); mOnShowRunnable = null; } } /** Loading Loading @@ -115,6 +122,10 @@ public class FadeRotationAnimationController extends FadeAnimationController { return token == mNavBarToken || mTargetWindowTokens.contains(token); } void setOnShowRunnable(Runnable onShowRunnable) { mOnShowRunnable = onShowRunnable; } @Override public Animation getFadeInAnimation() { if (mFrozenTimeoutRunnable != null) { Loading
services/core/java/com/android/server/wm/RecentsAnimationController.java +21 −9 Original line number Diff line number Diff line Loading @@ -669,21 +669,33 @@ public class RecentsAnimationController implements DeathRecipient { } navWindow.setSurfaceTranslationY(0); if (navWindow.mToken == null) { final WindowToken navToken = navWindow.mToken; if (navToken == null) { return; } final SurfaceControl.Transaction t = mDisplayContent.getPendingTransaction(); final WindowContainer parent = navWindow.mToken.getParent(); // Reparent the SurfaceControl of nav bar token back. t.reparent(navWindow.mToken.getSurfaceControl(), parent.getSurfaceControl()); final WindowContainer parent = navToken.getParent(); if (animate) { // Run fade-in animation to show navigation bar back to bottom of the display. final NavBarFadeAnimationController controller = final NavBarFadeAnimationController navBarFadeAnimationController = mDisplayContent.getDisplayPolicy().getNavBarFadeAnimationController(); if (controller != null) { controller.fadeWindowToken(true); final Runnable fadeInAnim = () -> { // Reparent the SurfaceControl of nav bar token back. t.reparent(navToken.getSurfaceControl(), parent.getSurfaceControl()); // Run fade-in animation to show navigation bar back to bottom of the display. if (navBarFadeAnimationController != null) { navBarFadeAnimationController.fadeWindowToken(true); } }; final FadeRotationAnimationController fadeRotationAnimationController = mDisplayContent.getFadeRotationAnimationController(); if (fadeRotationAnimationController != null) { fadeRotationAnimationController.setOnShowRunnable(fadeInAnim); } else { fadeInAnim.run(); } } else { // Reparent the SurfaceControl of nav bar token back. t.reparent(navToken.getSurfaceControl(), parent.getSurfaceControl()); } } Loading
services/tests/wmtests/src/com/android/server/wm/RecentsAnimationControllerTest.java +31 −0 Original line number Diff line number Diff line Loading @@ -566,6 +566,37 @@ public class RecentsAnimationControllerTest extends WindowTestsBase { assertFalse(mController.isNavigationBarAttachedToApp()); } @Test public void testFadeRotationAfterAttachAndBeforeRestore_notRestoreNavImmediately() { setupForShouldAttachNavBarDuringTransition(); final ActivityRecord activity = createActivityRecord(mDefaultDisplay); final ActivityRecord homeActivity = createHomeActivity(); initializeRecentsAnimationController(mController, homeActivity); final WindowToken navToken = mDefaultDisplay.getDisplayPolicy().getNavigationBar().mToken; final SurfaceControl.Transaction transaction = navToken.getPendingTransaction(); verify(mController.mStatusBar).setNavigationBarLumaSamplingEnabled( mDefaultDisplay.mDisplayId, false); verify(transaction).reparent(navToken.getSurfaceControl(), activity.getSurfaceControl()); final WindowContainer parent = navToken.getParent(); final NavBarFadeAnimationController navBarFadeAnimationController = mDefaultDisplay.getDisplayPolicy().getNavBarFadeAnimationController(); FadeRotationAnimationController mockController = mock(FadeRotationAnimationController.class); doReturn(mockController).when(mDefaultDisplay).getFadeRotationAnimationController(); mController.cleanupAnimation(REORDER_MOVE_TO_TOP); verify(mController.mStatusBar).setNavigationBarLumaSamplingEnabled( mDefaultDisplay.mDisplayId, true); verify(mockController).setOnShowRunnable(any()); verify(transaction, times(0)).reparent(navToken.getSurfaceControl(), parent.getSurfaceControl()); verify(navBarFadeAnimationController, times(0)).fadeWindowToken(true); } @Test public void testAttachNavBarInSplitScreenMode() { setupForShouldAttachNavBarDuringTransition(); Loading