Loading core/java/com/android/internal/view/RotationPolicy.java +9 −1 Original line number Diff line number Diff line Loading @@ -108,11 +108,19 @@ public final class RotationPolicy { * Enables or disables rotation lock from the system UI toggle. */ public static void setRotationLock(Context context, final boolean enabled) { final int rotation = areAllRotationsAllowed(context) ? CURRENT_ROTATION : NATURAL_ROTATION; setRotationLockAtAngle(context, enabled, rotation); } /** * Enables or disables rotation lock at a specific rotation from system UI. */ public static void setRotationLockAtAngle(Context context, final boolean enabled, final int rotation) { Settings.System.putIntForUser(context.getContentResolver(), Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 0, UserHandle.USER_CURRENT); final int rotation = areAllRotationsAllowed(context) ? CURRENT_ROTATION : NATURAL_ROTATION; setRotationLock(enabled, rotation); } Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/RotationLockController.java +1 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ public interface RotationLockController extends Listenable, boolean isRotationLockAffordanceVisible(); boolean isRotationLocked(); void setRotationLocked(boolean locked); void setRotationLockedAtAngle(boolean locked, int rotation); public interface RotationLockControllerCallback { void onRotationLockStateChanged(boolean rotationLocked, boolean affordanceVisible); Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/RotationLockControllerImpl.java +4 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,10 @@ public final class RotationLockControllerImpl implements RotationLockController RotationPolicy.setRotationLock(mContext, locked); } public void setRotationLockedAtAngle(boolean locked, int rotation){ RotationPolicy.setRotationLockAtAngle(mContext, locked, rotation); } public boolean isRotationLockAffordanceVisible() { return RotationPolicy.isRotationLockToggleVisible(mContext); } Loading packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeRotationLockController.java +5 −0 Original line number Diff line number Diff line Loading @@ -49,4 +49,9 @@ public class FakeRotationLockController extends BaseLeakChecker<RotationLockCont public void setRotationLocked(boolean locked) { } @Override public void setRotationLockedAtAngle(boolean locked, int rotation) { } } Loading
core/java/com/android/internal/view/RotationPolicy.java +9 −1 Original line number Diff line number Diff line Loading @@ -108,11 +108,19 @@ public final class RotationPolicy { * Enables or disables rotation lock from the system UI toggle. */ public static void setRotationLock(Context context, final boolean enabled) { final int rotation = areAllRotationsAllowed(context) ? CURRENT_ROTATION : NATURAL_ROTATION; setRotationLockAtAngle(context, enabled, rotation); } /** * Enables or disables rotation lock at a specific rotation from system UI. */ public static void setRotationLockAtAngle(Context context, final boolean enabled, final int rotation) { Settings.System.putIntForUser(context.getContentResolver(), Settings.System.HIDE_ROTATION_LOCK_TOGGLE_FOR_ACCESSIBILITY, 0, UserHandle.USER_CURRENT); final int rotation = areAllRotationsAllowed(context) ? CURRENT_ROTATION : NATURAL_ROTATION; setRotationLock(enabled, rotation); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/RotationLockController.java +1 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ public interface RotationLockController extends Listenable, boolean isRotationLockAffordanceVisible(); boolean isRotationLocked(); void setRotationLocked(boolean locked); void setRotationLockedAtAngle(boolean locked, int rotation); public interface RotationLockControllerCallback { void onRotationLockStateChanged(boolean rotationLocked, boolean affordanceVisible); Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/RotationLockControllerImpl.java +4 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,10 @@ public final class RotationLockControllerImpl implements RotationLockController RotationPolicy.setRotationLock(mContext, locked); } public void setRotationLockedAtAngle(boolean locked, int rotation){ RotationPolicy.setRotationLockAtAngle(mContext, locked, rotation); } public boolean isRotationLockAffordanceVisible() { return RotationPolicy.isRotationLockToggleVisible(mContext); } Loading
packages/SystemUI/tests/src/com/android/systemui/utils/leaks/FakeRotationLockController.java +5 −0 Original line number Diff line number Diff line Loading @@ -49,4 +49,9 @@ public class FakeRotationLockController extends BaseLeakChecker<RotationLockCont public void setRotationLocked(boolean locked) { } @Override public void setRotationLockedAtAngle(boolean locked, int rotation) { } }