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

Commit 9188308e authored by Tim Schumacher's avatar Tim Schumacher
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 04203eb2
Loading
Loading
Loading
Loading
+19 −0
Original line number Original line Diff line number Diff line
@@ -3568,6 +3568,23 @@ public final class Settings {
        @Deprecated
        @Deprecated
        public static final String ANIMATOR_DURATION_SCALE = Global.ANIMATOR_DURATION_SCALE;
        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 =
                sNonNegativeIntegerValidator;

        /**
        /**
         * Control whether the accelerometer will be used to change screen
         * Control whether the accelerometer will be used to change screen
         * orientation.  If 0, it will not be used unless explicitly requested
         * orientation.  If 0, it will not be used unless explicitly requested
@@ -4203,6 +4220,8 @@ public final class Settings {
            VALIDATORS.put(WIFI_STATIC_DNS1, WIFI_STATIC_DNS1_VALIDATOR);
            VALIDATORS.put(WIFI_STATIC_DNS1, WIFI_STATIC_DNS1_VALIDATOR);
            VALIDATORS.put(WIFI_STATIC_DNS2, WIFI_STATIC_DNS2_VALIDATOR);
            VALIDATORS.put(WIFI_STATIC_DNS2, WIFI_STATIC_DNS2_VALIDATOR);
            VALIDATORS.put(SHOW_BATTERY_PERCENT, SHOW_BATTERY_PERCENT_VALIDATOR);
            VALIDATORS.put(SHOW_BATTERY_PERCENT, SHOW_BATTERY_PERCENT_VALIDATOR);
            VALIDATORS.put(ACCELEROMETER_ROTATION_ANGLES,
                    ACCELEROMETER_ROTATION_ANGLES_VALIDATOR);
        }
        }


        /**
        /**
+1 −1
Original line number Original line Diff line number Diff line
@@ -155,7 +155,7 @@ public final class RotationPolicy {


    private static boolean isCurrentRotationAllowed(Context context) {
    private static boolean isCurrentRotationAllowed(Context context) {
        int userRotationAngles = Settings.System.getInt(context.getContentResolver(),
        int userRotationAngles = Settings.System.getInt(context.getContentResolver(),
                "accelerometer_rotation_angles", -1);
                Settings.System.ACCELEROMETER_ROTATION_ANGLES, -1);
        boolean allowAllRotations = context.getResources().getBoolean(
        boolean allowAllRotations = context.getResources().getBoolean(
                com.android.internal.R.bool.config_allowAllRotations);
                com.android.internal.R.bool.config_allowAllRotations);
        final IWindowManager wm = WindowManagerGlobal.getWindowManagerService();
        final IWindowManager wm = WindowManagerGlobal.getWindowManagerService();
+4 −4
Original line number Original line Diff line number Diff line
@@ -1085,8 +1085,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            resolver.registerContentObserver(Settings.Global.getUriFor(
            resolver.registerContentObserver(Settings.Global.getUriFor(
                    Settings.Global.POLICY_CONTROL), false, this,
                    Settings.Global.POLICY_CONTROL), false, this,
                    UserHandle.USER_ALL);
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(LineageSettings.System.getUriFor(
            resolver.registerContentObserver(Settings.System.getUriFor(
                    LineageSettings.System.ACCELEROMETER_ROTATION_ANGLES), false, this,
                    Settings.System.ACCELEROMETER_ROTATION_ANGLES), false, this,
                    UserHandle.USER_ALL);
                    UserHandle.USER_ALL);
            resolver.registerContentObserver(LineageSettings.Global.getUriFor(
            resolver.registerContentObserver(LineageSettings.Global.getUriFor(
                    LineageSettings.Global.DEV_FORCE_SHOW_NAVBAR), false, this,
                    LineageSettings.Global.DEV_FORCE_SHOW_NAVBAR), false, this,
@@ -2757,8 +2757,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                updateOrientationListenerLp();
                updateOrientationListenerLp();
            }
            }


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


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