diff options
| author | 2023-03-30 16:38:09 +0000 | |
|---|---|---|
| committer | 2023-03-30 16:38:09 +0000 | |
| commit | 3a00521addfa573b2d11d189365863b852e7520c (patch) | |
| tree | 5dddfb8c1d5c1123a89c3353e2448a4795db491d | |
| parent | 41e00245bfe28ed3481ee402b2d2fa5af57a90df (diff) | |
| parent | c4b1be4d6e45e14e7383388168ee49463c4194ad (diff) | |
Merge "Revert "Add a delay to rotation updates to help avoid fold state race"" into tm-qpr-dev am: c4b1be4d6e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/22289569
Change-Id: I2bc70589a695de21b04ccf68475ea0620d594a1e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | services/core/java/com/android/server/wm/DisplayRotation.java | 12 | ||||
| -rw-r--r-- | services/tests/wmtests/src/com/android/server/wm/DisplayRotationTests.java | 4 |
2 files changed, 7 insertions, 9 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayRotation.java b/services/core/java/com/android/server/wm/DisplayRotation.java index e9569d8cc064..27e33b08d936 100644 --- a/services/core/java/com/android/server/wm/DisplayRotation.java +++ b/services/core/java/com/android/server/wm/DisplayRotation.java @@ -87,8 +87,6 @@ import java.util.Set; */ public class DisplayRotation { private static final String TAG = TAG_WITH_CLASS_NAME ? "DisplayRotation" : TAG_WM; - // Delay to avoid race between fold update and orientation update. - private static final int ORIENTATION_UPDATE_DELAY_MS = 800; // Delay in milliseconds when updating config due to folding events. This prevents // config changes and unexpected jumps while folding the device to closed state. @@ -1745,15 +1743,15 @@ public class DisplayRotation { mDeviceState = newState; // Now mFoldState is set to HALF_FOLDED, the overrideFrozenRotation function will // return true, so rotation is unlocked. + mService.updateRotation(false /* alwaysSendConfiguration */, + false /* forceRelayout */); } else { mInHalfFoldTransition = true; mDeviceState = newState; + // Tell the device to update its orientation. + mService.updateRotation(false /* alwaysSendConfiguration */, + false /* forceRelayout */); } - UiThread.getHandler().postDelayed( - () -> { - mService.updateRotation(false /* alwaysSendConfiguration */, - false /* forceRelayout */); - }, ORIENTATION_UPDATE_DELAY_MS); // Alert the activity of possible new bounds. UiThread.getHandler().removeCallbacks(mActivityBoundsUpdateCallback); UiThread.getHandler().postDelayed(mActivityBoundsUpdateCallback, diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayRotationTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayRotationTests.java index 26d2a46f768a..192274317173 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayRotationTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayRotationTests.java @@ -750,7 +750,7 @@ public class DisplayRotationTests { // ... until half-fold mTarget.foldStateChanged(DeviceStateController.DeviceState.HALF_FOLDED); assertTrue(waitForUiHandler()); - verify(sMockWm).updateRotation(anyBoolean(), anyBoolean()); + verify(sMockWm).updateRotation(false, false); assertTrue(waitForUiHandler()); assertEquals(Surface.ROTATION_0, mTarget.rotationForOrientation( SCREEN_ORIENTATION_UNSPECIFIED, Surface.ROTATION_0)); @@ -758,7 +758,7 @@ public class DisplayRotationTests { // ... then transition back to flat mTarget.foldStateChanged(DeviceStateController.DeviceState.OPEN); assertTrue(waitForUiHandler()); - verify(sMockWm, atLeast(1)).updateRotation(anyBoolean(), anyBoolean()); + verify(sMockWm, atLeast(1)).updateRotation(false, false); assertTrue(waitForUiHandler()); assertEquals(Surface.ROTATION_270, mTarget.rotationForOrientation( SCREEN_ORIENTATION_UNSPECIFIED, Surface.ROTATION_0)); |