Loading services/core/java/com/android/server/wm/DisplayContent.java +15 −0 Original line number Diff line number Diff line Loading @@ -1185,6 +1185,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo } activity.onRemovedFromDisplay(); if (activity == mFixedRotationLaunchingApp) { setFixedRotationLaunchingAppUnchecked(null); } } @Override Loading Loading @@ -1468,6 +1471,12 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // It has been set and not yet finished. return true; } if (!r.occludesParent() || r.isVisible()) { // While entering or leaving a translucent or floating activity (e.g. dialog style), // there is a visible activity in the background. Then it still needs rotation animation // to cover the activity configuration change. return false; } if (checkOpening) { if (!mAppTransition.isTransitionSet() || !mOpeningApps.contains(r)) { // Apply normal rotation animation in case of the activity set different requested Loading Loading @@ -5636,6 +5645,12 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo */ void onStartRecentsAnimation(@NonNull ActivityRecord r) { mAnimatingRecents = r; if (r.isVisible() && mFocusedApp != null && !mFocusedApp.occludesParent()) { // The recents activity has shown with the orientation determined by the top // activity, keep its current orientation to avoid flicking by the configuration // change of visible activity. return; } rotateInDifferentOrientationIfNeeded(r); if (r.hasFixedRotationTransform()) { // Set the record so we can recognize it to continue to update display orientation Loading services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +1 −0 Original line number Diff line number Diff line Loading @@ -1506,6 +1506,7 @@ public class ActivityRecordTests extends ActivityTestsBase { .setRotation((mActivity.getWindowConfiguration().getRotation() + 1) % 4) .build(); setRotatedScreenOrientationSilently(mActivity); mActivity.setVisible(false); final IWindowSession session = WindowManagerGlobal.getWindowSession(); spyOn(session); Loading services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java +1 −0 Original line number Diff line number Diff line Loading @@ -456,6 +456,7 @@ public class AppWindowTokenTests extends WindowTestsBase { @Test public void testTransferStartingWindowSetFixedRotation() { final ActivityRecord topActivity = createTestActivityRecordForGivenTask(mTask); topActivity.setVisible(false); mTask.positionChildAt(topActivity, POSITION_TOP); mActivity.addStartingWindow(mPackageName, android.R.style.Theme, null, "Test", 0, 0, 0, 0, null, true, true, false, true, Loading services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +10 −0 Original line number Diff line number Diff line Loading @@ -1081,6 +1081,7 @@ public class DisplayContentTests extends WindowTestsBase { mDisplayContent.onRequestedOverrideConfigurationChanged(config); final ActivityRecord app = mAppWindow.mActivityRecord; app.setVisible(false); mDisplayContent.prepareAppTransition(WindowManager.TRANSIT_ACTIVITY_OPEN, false /* alwaysKeepCurrent */); mDisplayContent.mOpeningApps.add(app); Loading Loading @@ -1135,6 +1136,7 @@ public class DisplayContentTests extends WindowTestsBase { // Launch another activity before the transition is finished. final ActivityRecord app2 = new ActivityTestsBase.StackBuilder(mWm.mRoot) .setDisplay(mDisplayContent).build().getTopMostActivity(); app2.setVisible(false); mDisplayContent.mOpeningApps.add(app2); app2.setRequestedOrientation(newOrientation); Loading Loading @@ -1277,6 +1279,14 @@ public class DisplayContentTests extends WindowTestsBase { mDisplayContent.setFixedRotationLaunchingAppUnchecked(mAppWindow.mActivityRecord); displayRotation.setRotation((displayRotation.getRotation() + 1) % 4); assertTrue(displayRotation.updateRotationUnchecked(false)); // The recents activity should not apply fixed rotation if the top activity is not opaque. mDisplayContent.mFocusedApp = mAppWindow.mActivityRecord; doReturn(false).when(mDisplayContent.mFocusedApp).occludesParent(); doReturn(ROTATION_90).when(mDisplayContent).rotationForActivityInDifferentOrientation( eq(recentsActivity)); mDisplayContent.mFixedRotationTransitionListener.onStartRecentsAnimation(recentsActivity); assertFalse(recentsActivity.hasFixedRotationTransform()); } @Test Loading services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +1 −0 Original line number Diff line number Diff line Loading @@ -517,6 +517,7 @@ public class SizeCompatTests extends ActivityTestsBase { setUpApp(new TestDisplayContent.Builder(mService, dw, dh).setNotch(notchHeight).build()); addStatusBar(mActivity.mDisplayContent); mActivity.setVisible(false); mActivity.mDisplayContent.prepareAppTransition(WindowManager.TRANSIT_ACTIVITY_OPEN, false /* alwaysKeepCurrent */); mActivity.mDisplayContent.mOpeningApps.add(mActivity); Loading Loading
services/core/java/com/android/server/wm/DisplayContent.java +15 −0 Original line number Diff line number Diff line Loading @@ -1185,6 +1185,9 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo } activity.onRemovedFromDisplay(); if (activity == mFixedRotationLaunchingApp) { setFixedRotationLaunchingAppUnchecked(null); } } @Override Loading Loading @@ -1468,6 +1471,12 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo // It has been set and not yet finished. return true; } if (!r.occludesParent() || r.isVisible()) { // While entering or leaving a translucent or floating activity (e.g. dialog style), // there is a visible activity in the background. Then it still needs rotation animation // to cover the activity configuration change. return false; } if (checkOpening) { if (!mAppTransition.isTransitionSet() || !mOpeningApps.contains(r)) { // Apply normal rotation animation in case of the activity set different requested Loading Loading @@ -5636,6 +5645,12 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo */ void onStartRecentsAnimation(@NonNull ActivityRecord r) { mAnimatingRecents = r; if (r.isVisible() && mFocusedApp != null && !mFocusedApp.occludesParent()) { // The recents activity has shown with the orientation determined by the top // activity, keep its current orientation to avoid flicking by the configuration // change of visible activity. return; } rotateInDifferentOrientationIfNeeded(r); if (r.hasFixedRotationTransform()) { // Set the record so we can recognize it to continue to update display orientation Loading
services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +1 −0 Original line number Diff line number Diff line Loading @@ -1506,6 +1506,7 @@ public class ActivityRecordTests extends ActivityTestsBase { .setRotation((mActivity.getWindowConfiguration().getRotation() + 1) % 4) .build(); setRotatedScreenOrientationSilently(mActivity); mActivity.setVisible(false); final IWindowSession session = WindowManagerGlobal.getWindowSession(); spyOn(session); Loading
services/tests/wmtests/src/com/android/server/wm/AppWindowTokenTests.java +1 −0 Original line number Diff line number Diff line Loading @@ -456,6 +456,7 @@ public class AppWindowTokenTests extends WindowTestsBase { @Test public void testTransferStartingWindowSetFixedRotation() { final ActivityRecord topActivity = createTestActivityRecordForGivenTask(mTask); topActivity.setVisible(false); mTask.positionChildAt(topActivity, POSITION_TOP); mActivity.addStartingWindow(mPackageName, android.R.style.Theme, null, "Test", 0, 0, 0, 0, null, true, true, false, true, Loading
services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +10 −0 Original line number Diff line number Diff line Loading @@ -1081,6 +1081,7 @@ public class DisplayContentTests extends WindowTestsBase { mDisplayContent.onRequestedOverrideConfigurationChanged(config); final ActivityRecord app = mAppWindow.mActivityRecord; app.setVisible(false); mDisplayContent.prepareAppTransition(WindowManager.TRANSIT_ACTIVITY_OPEN, false /* alwaysKeepCurrent */); mDisplayContent.mOpeningApps.add(app); Loading Loading @@ -1135,6 +1136,7 @@ public class DisplayContentTests extends WindowTestsBase { // Launch another activity before the transition is finished. final ActivityRecord app2 = new ActivityTestsBase.StackBuilder(mWm.mRoot) .setDisplay(mDisplayContent).build().getTopMostActivity(); app2.setVisible(false); mDisplayContent.mOpeningApps.add(app2); app2.setRequestedOrientation(newOrientation); Loading Loading @@ -1277,6 +1279,14 @@ public class DisplayContentTests extends WindowTestsBase { mDisplayContent.setFixedRotationLaunchingAppUnchecked(mAppWindow.mActivityRecord); displayRotation.setRotation((displayRotation.getRotation() + 1) % 4); assertTrue(displayRotation.updateRotationUnchecked(false)); // The recents activity should not apply fixed rotation if the top activity is not opaque. mDisplayContent.mFocusedApp = mAppWindow.mActivityRecord; doReturn(false).when(mDisplayContent.mFocusedApp).occludesParent(); doReturn(ROTATION_90).when(mDisplayContent).rotationForActivityInDifferentOrientation( eq(recentsActivity)); mDisplayContent.mFixedRotationTransitionListener.onStartRecentsAnimation(recentsActivity); assertFalse(recentsActivity.hasFixedRotationTransform()); } @Test Loading
services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +1 −0 Original line number Diff line number Diff line Loading @@ -517,6 +517,7 @@ public class SizeCompatTests extends ActivityTestsBase { setUpApp(new TestDisplayContent.Builder(mService, dw, dh).setNotch(notchHeight).build()); addStatusBar(mActivity.mDisplayContent); mActivity.setVisible(false); mActivity.mDisplayContent.prepareAppTransition(WindowManager.TRANSIT_ACTIVITY_OPEN, false /* alwaysKeepCurrent */); mActivity.mDisplayContent.mOpeningApps.add(mActivity); Loading