Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9248ee4f authored by Tim Schumacher's avatar Tim Schumacher Committed by Michael Bestas
Browse files

Add back ACCELEROMETER_ROTATION_ANGLES and update references

This needed to move back into fw/b, because it needs to be
accessed from inside the RotationPolicy. Previously
(when this constant and Setting were located in lineage-sdk),
the settings for the display rotation had no effect, because we
couldn't query the correct set of settings.

Change-Id: Icce249925a578c328db3884e5d332b20d6e7db6c
Fixes: BUGBASH-2042
parent a9fa6b86
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -3719,6 +3719,23 @@ public final class Settings {
        @Deprecated
        public static final String ANIMATOR_DURATION_SCALE = Global.ANIMATOR_DURATION_SCALE;
        /**
         * Control the type of rotation which can be performed using the accelerometer
         * if ACCELEROMETER_ROTATION is enabled.
         * Value is a bitwise combination of
         * 1 = 0 degrees (portrait)
         * 2 = 90 degrees (left)
         * 4 = 180 degrees (inverted portrait)
         * 8 = 270 degrees (right)
         * Setting to 0 is effectively orientation lock
         * @hide
         */
        public static final String ACCELEROMETER_ROTATION_ANGLES = "accelerometer_rotation_angles";
        /** @hide */
        public static final Validator ACCELEROMETER_ROTATION_ANGLES_VALIDATOR =
                NON_NEGATIVE_INTEGER_VALIDATOR;
        /**
         * Control whether the accelerometer will be used to change screen
         * orientation.  If 0, it will not be used unless explicitly requested
@@ -4379,6 +4396,8 @@ public final class Settings {
            VALIDATORS.put(WIFI_STATIC_DNS2, WIFI_STATIC_DNS2_VALIDATOR);
            VALIDATORS.put(SHOW_BATTERY_PERCENT, SHOW_BATTERY_PERCENT_VALIDATOR);
            VALIDATORS.put(NOTIFICATION_LIGHT_PULSE, BOOLEAN_VALIDATOR);
            VALIDATORS.put(ACCELEROMETER_ROTATION_ANGLES,
                    ACCELEROMETER_ROTATION_ANGLES_VALIDATOR);
        }
        /**
+5 −5
Original line number Diff line number Diff line
@@ -1130,13 +1130,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            resolver.registerContentObserver(Settings.Secure.getUriFor(
                    Settings.Secure.SYSTEM_NAVIGATION_KEYS_ENABLED), false, this,
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.ACCELEROMETER_ROTATION_ANGLES), false, this,
                    UserHandle.USER_ALL);

            resolver.registerContentObserver(LineageSettings.System.getUriFor(
                    LineageSettings.System.FORCE_SHOW_NAVBAR), false, this,
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(LineageSettings.System.getUriFor(
                    LineageSettings.System.ACCELEROMETER_ROTATION_ANGLES), false, this,
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(LineageSettings.System.getUriFor(
                    LineageSettings.System.TORCH_LONG_PRESS_POWER_GESTURE), false, this,
                    UserHandle.USER_ALL);
@@ -2914,8 +2914,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                updateOrientationListenerLp();
            }

            mUserRotationAngles = LineageSettings.System.getInt(resolver,
                    LineageSettings.System.ACCELEROMETER_ROTATION_ANGLES, -1);
            mUserRotationAngles = Settings.System.getInt(resolver,
                    Settings.System.ACCELEROMETER_ROTATION_ANGLES, -1);

            if (mSystemReady) {
                int pointerLocation = Settings.System.getIntForUser(resolver,