Loading services/core/java/com/android/server/wm/DisplayRotation.java +5 −7 Original line number Diff line number Diff line Loading @@ -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. Loading Loading @@ -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; } UiThread.getHandler().postDelayed( () -> { // Tell the device to update its orientation. 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, Loading services/tests/wmtests/src/com/android/server/wm/DisplayRotationTests.java +2 −2 Original line number Diff line number Diff line Loading @@ -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)); Loading @@ -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)); Loading Loading
services/core/java/com/android/server/wm/DisplayRotation.java +5 −7 Original line number Diff line number Diff line Loading @@ -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. Loading Loading @@ -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; } UiThread.getHandler().postDelayed( () -> { // Tell the device to update its orientation. 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, Loading
services/tests/wmtests/src/com/android/server/wm/DisplayRotationTests.java +2 −2 Original line number Diff line number Diff line Loading @@ -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)); Loading @@ -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)); Loading