Loading services/core/java/com/android/server/wm/ActivityRecord.java +6 −14 Original line number Diff line number Diff line Loading @@ -7978,6 +7978,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (mLetterboxUiController.shouldIgnoreRequestedOrientation(requestedOrientation)) { return; } final int originalRelaunchingCount = mPendingRelaunchCount; // This is necessary in order to avoid going into size compat mode when the orientation // change request comes from the app if (getRequestedConfigurationOrientation(false, requestedOrientation) Loading @@ -7995,8 +7996,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // the request is handled at task level with letterbox. if (!getMergedOverrideConfiguration().equals( mLastReportedConfiguration.getMergedConfiguration())) { ensureActivityConfiguration( false /* ignoreVisibility */, true /* isRequestedOrientationChanged */); ensureActivityConfiguration(false /* ignoreVisibility */); if (mPendingRelaunchCount > originalRelaunchingCount) { mLetterboxUiController.setRelaunchingAfterRequestedOrientationChanged(true); } if (mTransitionController.inPlayingTransition(this)) { mTransitionController.mValidateActivityCompat.add(this); } Loading Loading @@ -9502,11 +9505,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return ensureActivityConfiguration(false /* ignoreVisibility */); } boolean ensureActivityConfiguration(boolean ignoreVisibility) { return ensureActivityConfiguration(ignoreVisibility, false /* isRequestedOrientationChanged */); } /** * Make sure the given activity matches the current configuration. Ensures the HistoryRecord * is updated with the correct configuration and all other bookkeeping is handled. Loading @@ -9515,13 +9513,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A * (stopped state). This is useful for the case where we know the * activity will be visible soon and we want to ensure its configuration * before we make it visible. * @param isRequestedOrientationChanged whether this is triggered in response to an app calling * {@link android.app.Activity#setRequestedOrientation}. * @return False if the activity was relaunched and true if it wasn't relaunched because we * can't or the app handles the specific configuration that is changing. */ boolean ensureActivityConfiguration(boolean ignoreVisibility, boolean isRequestedOrientationChanged) { boolean ensureActivityConfiguration(boolean ignoreVisibility) { final Task rootTask = getRootTask(); if (rootTask.mConfigWillChange) { ProtoLog.v(WM_DEBUG_CONFIGURATION, "Skipping config check " Loading Loading @@ -9658,9 +9653,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } else { mRelaunchReason = RELAUNCH_REASON_NONE; } if (isRequestedOrientationChanged) { mLetterboxUiController.setRelaunchingAfterRequestedOrientationChanged(true); } if (mState == PAUSING) { // A little annoying: we are waiting for this activity to finish pausing. Let's not // do anything now, but just flag that it needs to be restarted when done pausing. Loading services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +2 −2 Original line number Diff line number Diff line Loading @@ -2131,8 +2131,8 @@ public class DisplayContentTests extends WindowTestsBase { // Once transition starts, rotation is applied and transition shows DC rotating. testPlayer.startTransition(); waitUntilHandlersIdle(); verify(activity1).ensureActivityConfiguration(anyBoolean(), anyBoolean()); verify(activity2).ensureActivityConfiguration(anyBoolean(), anyBoolean()); verify(activity1).ensureActivityConfiguration(anyBoolean()); verify(activity2).ensureActivityConfiguration(anyBoolean()); assertNotEquals(origRot, dc.getConfiguration().windowConfiguration.getRotation()); assertNotNull(testPlayer.mLastReady); assertTrue(testPlayer.mController.isPlaying()); Loading services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +9 −0 Original line number Diff line number Diff line Loading @@ -1020,8 +1020,17 @@ public class SizeCompatTests extends WindowTestsBase { // Activity is sandboxed due to fixed aspect ratio. assertActivityMaxBoundsSandboxed(); // Prepare the states for verifying relaunching after changing orientation. mActivity.finishRelaunching(); mActivity.setState(RESUMED, "testFixedAspectRatioOrientationChangeOrientation"); mActivity.setLastReportedConfiguration(mAtm.getGlobalConfiguration(), mActivity.getConfiguration()); // Change the fixed orientation. mActivity.setRequestedOrientation(SCREEN_ORIENTATION_LANDSCAPE); assertTrue(mActivity.isRelaunching()); assertTrue(mActivity.mLetterboxUiController .getIsRelaunchingAfterRequestedOrientationChanged()); assertFitted(); assertEquals(originalBounds.width(), mActivity.getBounds().height()); Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +6 −14 Original line number Diff line number Diff line Loading @@ -7978,6 +7978,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (mLetterboxUiController.shouldIgnoreRequestedOrientation(requestedOrientation)) { return; } final int originalRelaunchingCount = mPendingRelaunchCount; // This is necessary in order to avoid going into size compat mode when the orientation // change request comes from the app if (getRequestedConfigurationOrientation(false, requestedOrientation) Loading @@ -7995,8 +7996,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // the request is handled at task level with letterbox. if (!getMergedOverrideConfiguration().equals( mLastReportedConfiguration.getMergedConfiguration())) { ensureActivityConfiguration( false /* ignoreVisibility */, true /* isRequestedOrientationChanged */); ensureActivityConfiguration(false /* ignoreVisibility */); if (mPendingRelaunchCount > originalRelaunchingCount) { mLetterboxUiController.setRelaunchingAfterRequestedOrientationChanged(true); } if (mTransitionController.inPlayingTransition(this)) { mTransitionController.mValidateActivityCompat.add(this); } Loading Loading @@ -9502,11 +9505,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return ensureActivityConfiguration(false /* ignoreVisibility */); } boolean ensureActivityConfiguration(boolean ignoreVisibility) { return ensureActivityConfiguration(ignoreVisibility, false /* isRequestedOrientationChanged */); } /** * Make sure the given activity matches the current configuration. Ensures the HistoryRecord * is updated with the correct configuration and all other bookkeeping is handled. Loading @@ -9515,13 +9513,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A * (stopped state). This is useful for the case where we know the * activity will be visible soon and we want to ensure its configuration * before we make it visible. * @param isRequestedOrientationChanged whether this is triggered in response to an app calling * {@link android.app.Activity#setRequestedOrientation}. * @return False if the activity was relaunched and true if it wasn't relaunched because we * can't or the app handles the specific configuration that is changing. */ boolean ensureActivityConfiguration(boolean ignoreVisibility, boolean isRequestedOrientationChanged) { boolean ensureActivityConfiguration(boolean ignoreVisibility) { final Task rootTask = getRootTask(); if (rootTask.mConfigWillChange) { ProtoLog.v(WM_DEBUG_CONFIGURATION, "Skipping config check " Loading Loading @@ -9658,9 +9653,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } else { mRelaunchReason = RELAUNCH_REASON_NONE; } if (isRequestedOrientationChanged) { mLetterboxUiController.setRelaunchingAfterRequestedOrientationChanged(true); } if (mState == PAUSING) { // A little annoying: we are waiting for this activity to finish pausing. Let's not // do anything now, but just flag that it needs to be restarted when done pausing. Loading
services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +2 −2 Original line number Diff line number Diff line Loading @@ -2131,8 +2131,8 @@ public class DisplayContentTests extends WindowTestsBase { // Once transition starts, rotation is applied and transition shows DC rotating. testPlayer.startTransition(); waitUntilHandlersIdle(); verify(activity1).ensureActivityConfiguration(anyBoolean(), anyBoolean()); verify(activity2).ensureActivityConfiguration(anyBoolean(), anyBoolean()); verify(activity1).ensureActivityConfiguration(anyBoolean()); verify(activity2).ensureActivityConfiguration(anyBoolean()); assertNotEquals(origRot, dc.getConfiguration().windowConfiguration.getRotation()); assertNotNull(testPlayer.mLastReady); assertTrue(testPlayer.mController.isPlaying()); Loading
services/tests/wmtests/src/com/android/server/wm/SizeCompatTests.java +9 −0 Original line number Diff line number Diff line Loading @@ -1020,8 +1020,17 @@ public class SizeCompatTests extends WindowTestsBase { // Activity is sandboxed due to fixed aspect ratio. assertActivityMaxBoundsSandboxed(); // Prepare the states for verifying relaunching after changing orientation. mActivity.finishRelaunching(); mActivity.setState(RESUMED, "testFixedAspectRatioOrientationChangeOrientation"); mActivity.setLastReportedConfiguration(mAtm.getGlobalConfiguration(), mActivity.getConfiguration()); // Change the fixed orientation. mActivity.setRequestedOrientation(SCREEN_ORIENTATION_LANDSCAPE); assertTrue(mActivity.isRelaunching()); assertTrue(mActivity.mLetterboxUiController .getIsRelaunchingAfterRequestedOrientationChanged()); assertFitted(); assertEquals(originalBounds.width(), mActivity.getBounds().height()); Loading