Loading core/java/android/view/IWindowManager.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -362,6 +362,12 @@ interface IWindowManager */ int getPreferredOptionsPanelGravity(int displayId); /** * Requests to update value of setting key {@link Settings.Secure#DEVICE_STATE_ROTATION_LOCK} to * {@link autoRotate} for {@link deviceState}. */ oneway void setDeviceStateAutoRotateSetting(int deviceState, boolean autoRotate); /** * Equivalent to calling {@link #freezeDisplayRotation(int, int)} with {@link * android.view.Display#DEFAULT_DISPLAY} and given rotation. Loading core/java/com/android/internal/view/RotationPolicy.java +14 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,20 @@ public final class RotationPolicy { UserHandle.USER_CURRENT) == 0; } /** * Requests to update value of setting key {@link Settings.Secure.DEVICE_STATE_ROTATION_LOCK} to * {@link autoRotate} for {@link deviceState}. */ public static void requestDeviceStateAutoRotateSettingChange(int deviceState, boolean autoRotate) { try { IWindowManager wm = WindowManagerGlobal.getWindowManagerService(); wm.setDeviceStateAutoRotateSetting(deviceState, autoRotate); } catch (RemoteException exc) { Log.w(TAG, "Unable to save device state auto-rotate setting: " + exc.getMessage()); } } /** * Returns true if rotation lock is enabled. */ Loading services/core/java/com/android/server/wm/DisplayRotation.java +4 −0 Original line number Diff line number Diff line Loading @@ -792,6 +792,10 @@ public class DisplayRotation { } } void requestDeviceStateAutoRotateSettingChange(int deviceState, boolean autoRotate) { // TODO(b/350946537) Redirect request to DeviceStateAutoRotateSettingController } void freezeRotation(int rotation, String caller) { if (mDeviceStateController.shouldReverseRotationDirectionAroundZAxis(mDisplayContent)) { rotation = RotationUtils.reverseRotationDirectionAroundZAxis(rotation); Loading services/core/java/com/android/server/wm/WindowManagerService.java +17 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,7 @@ import static com.android.server.wm.WindowManagerServiceDumpProto.INPUT_METHOD_W import static com.android.server.wm.WindowManagerServiceDumpProto.POLICY; import static com.android.server.wm.WindowManagerServiceDumpProto.ROOT_WINDOW_CONTAINER; import static com.android.server.wm.WindowManagerServiceDumpProto.WINDOW_FRAMES_VALID; import static com.android.window.flags.Flags.enableDeviceStateAutoRotateSettingRefactor; import static com.android.window.flags.Flags.enableDisplayFocusInShellTransitions; import static com.android.window.flags.Flags.enablePresentationForConnectedDisplays; import static com.android.window.flags.Flags.multiCrop; Loading Loading @@ -4487,6 +4488,22 @@ public class WindowManagerService extends IWindowManager.Stub || !mAppCompatConfiguration.isIgnoreOrientationRequestAllowed(); } @Override public void setDeviceStateAutoRotateSetting(int deviceState, boolean autoRotate) { if (!checkCallingPermission(android.Manifest.permission.SET_ORIENTATION, "setDeviceStateAutoRotateSetting()")) { throw new SecurityException("Requires SET_ORIENTATION permission"); } if (!enableDeviceStateAutoRotateSettingRefactor()) { return; } synchronized (mGlobalLock) { final DisplayContent display = mRoot.getDefaultDisplay(); display.getDisplayRotation().requestDeviceStateAutoRotateSettingChange(deviceState, autoRotate); } } @Override public void freezeRotation(int rotation, String caller) { freezeDisplayRotation(Display.DEFAULT_DISPLAY, rotation, caller); Loading Loading
core/java/android/view/IWindowManager.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -362,6 +362,12 @@ interface IWindowManager */ int getPreferredOptionsPanelGravity(int displayId); /** * Requests to update value of setting key {@link Settings.Secure#DEVICE_STATE_ROTATION_LOCK} to * {@link autoRotate} for {@link deviceState}. */ oneway void setDeviceStateAutoRotateSetting(int deviceState, boolean autoRotate); /** * Equivalent to calling {@link #freezeDisplayRotation(int, int)} with {@link * android.view.Display#DEFAULT_DISPLAY} and given rotation. Loading
core/java/com/android/internal/view/RotationPolicy.java +14 −0 Original line number Diff line number Diff line Loading @@ -94,6 +94,20 @@ public final class RotationPolicy { UserHandle.USER_CURRENT) == 0; } /** * Requests to update value of setting key {@link Settings.Secure.DEVICE_STATE_ROTATION_LOCK} to * {@link autoRotate} for {@link deviceState}. */ public static void requestDeviceStateAutoRotateSettingChange(int deviceState, boolean autoRotate) { try { IWindowManager wm = WindowManagerGlobal.getWindowManagerService(); wm.setDeviceStateAutoRotateSetting(deviceState, autoRotate); } catch (RemoteException exc) { Log.w(TAG, "Unable to save device state auto-rotate setting: " + exc.getMessage()); } } /** * Returns true if rotation lock is enabled. */ Loading
services/core/java/com/android/server/wm/DisplayRotation.java +4 −0 Original line number Diff line number Diff line Loading @@ -792,6 +792,10 @@ public class DisplayRotation { } } void requestDeviceStateAutoRotateSettingChange(int deviceState, boolean autoRotate) { // TODO(b/350946537) Redirect request to DeviceStateAutoRotateSettingController } void freezeRotation(int rotation, String caller) { if (mDeviceStateController.shouldReverseRotationDirectionAroundZAxis(mDisplayContent)) { rotation = RotationUtils.reverseRotationDirectionAroundZAxis(rotation); Loading
services/core/java/com/android/server/wm/WindowManagerService.java +17 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,7 @@ import static com.android.server.wm.WindowManagerServiceDumpProto.INPUT_METHOD_W import static com.android.server.wm.WindowManagerServiceDumpProto.POLICY; import static com.android.server.wm.WindowManagerServiceDumpProto.ROOT_WINDOW_CONTAINER; import static com.android.server.wm.WindowManagerServiceDumpProto.WINDOW_FRAMES_VALID; import static com.android.window.flags.Flags.enableDeviceStateAutoRotateSettingRefactor; import static com.android.window.flags.Flags.enableDisplayFocusInShellTransitions; import static com.android.window.flags.Flags.enablePresentationForConnectedDisplays; import static com.android.window.flags.Flags.multiCrop; Loading Loading @@ -4487,6 +4488,22 @@ public class WindowManagerService extends IWindowManager.Stub || !mAppCompatConfiguration.isIgnoreOrientationRequestAllowed(); } @Override public void setDeviceStateAutoRotateSetting(int deviceState, boolean autoRotate) { if (!checkCallingPermission(android.Manifest.permission.SET_ORIENTATION, "setDeviceStateAutoRotateSetting()")) { throw new SecurityException("Requires SET_ORIENTATION permission"); } if (!enableDeviceStateAutoRotateSettingRefactor()) { return; } synchronized (mGlobalLock) { final DisplayContent display = mRoot.getDefaultDisplay(); display.getDisplayRotation().requestDeviceStateAutoRotateSettingChange(deviceState, autoRotate); } } @Override public void freezeRotation(int rotation, String caller) { freezeDisplayRotation(Display.DEFAULT_DISPLAY, rotation, caller); Loading