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

Commit 5091c662 authored by Kelly's avatar Kelly Committed by Gerrit Code Review
Browse files

Add lockscreen rotation as an optional rotation setting (1/2)

This will allow the user to select wether or not to use the
rotation settings for the lockscreen.  This is dependent
upon the rotation setting being checked.

Change-Id: Ibd7c69b0af1e0a7d91b985f2b21ea0b5bc619a70
parent 1da2f48a
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1921,6 +1921,15 @@ public final class Settings {
         */
        public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";

        /**
         * Control whether the accelerometer will be used to change lockscreen
         * orientation.  If 0, it will not be used unless explicitly requested
         * by the application; if 1, it will be used by default unless explicitly
         * disabled by the application.
         * @hide
         */
        public static final String LOCKSCREEN_ROTATION = "lockscreen_rotation";

        /**
         * Control the type of rotation which can be performed using the accelerometer
         * if ACCELEROMETER_ROTATION is enabled.
@@ -2818,6 +2827,7 @@ public final class Settings {
            TIME_12_24,
            DATE_FORMAT,
            ACCELEROMETER_ROTATION,
            LOCKSCREEN_ROTATION,
            USER_ROTATION,
            DTMF_TONE_WHEN_DIALING,
            DTMF_TONE_TYPE_WHEN_DIALING,
+6 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.graphics.PixelFormat;
import android.graphics.Canvas;
import android.os.IBinder;
import android.os.SystemProperties;
import android.provider.Settings;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
@@ -106,9 +107,13 @@ public class KeyguardViewManager implements KeyguardWindowController {
        if (DEBUG) Log.d(TAG, "show(); mKeyguardView==" + mKeyguardView);

        Resources res = mContext.getResources();
        boolean enableLockScreenRotation = Settings.System.getInt(mContext.getContentResolver(),
                Settings.System.LOCKSCREEN_ROTATION, 0) != 0;
        boolean enableAccelerometerRotation = Settings.System.getInt(mContext.getContentResolver(),
                Settings.System.ACCELEROMETER_ROTATION, 1) != 0;
        boolean enableScreenRotation =
                SystemProperties.getBoolean("lockscreen.rot_override",false)
                || res.getBoolean(R.bool.config_enableLockScreenRotation);
                || (enableLockScreenRotation && enableAccelerometerRotation);
        if (mKeyguardHost == null) {
            if (DEBUG) Log.d(TAG, "keyguard host is null, creating it...");