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

Commit 9a64b90c authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Gerrit Code Review
Browse files

Merge "framework: Add home button unlock option (1/2)" into jellybean

parents a5b595a6 2f90e9dd
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -2530,6 +2530,12 @@ public final class Settings {
         */
        public static final String MENU_UNLOCK_SCREEN = "menu_unlock_screen";

        /**
         * Whether to unlock the screen with the home key.  The value is boolean (1 or 0).
         * @hide
         */
        public static final String HOME_UNLOCK_SCREEN = "home_unlock_screen";

        /**
         * Whether to wake the screen with the volume keys, the value is boolean.
         * @hide
+3 −0
Original line number Diff line number Diff line
@@ -516,6 +516,9 @@
    <!-- Allow the menu hard key to be disabled in LockScreen on some devices -->
    <bool name="config_disableMenuKeyInLockScreen">false</bool>

    <!-- Disable the home key unlock setting -->
    <bool name="config_disableHomeUnlockSetting">true</bool>

    <!-- Don't show lock screen before unlock screen (PIN/pattern/password) -->
    <bool name="config_enableLockBeforeUnlockScreen">false</bool>

+1 −0
Original line number Diff line number Diff line
@@ -1216,6 +1216,7 @@
  <java-symbol type="bool" name="config_carDockEnablesAccelerometer" />
  <java-symbol type="bool" name="config_deskDockEnablesAccelerometer" />
  <java-symbol type="bool" name="config_disableMenuKeyInLockScreen" />
  <java-symbol type="bool" name="config_disableHomeUnlockSetting" />
  <java-symbol type="bool" name="config_enableLockBeforeUnlockScreen" />
  <java-symbol type="bool" name="config_enableLockScreenRotation" />
  <java-symbol type="bool" name="config_lidControlsSleep" />
+4 −1
Original line number Diff line number Diff line
@@ -587,6 +587,8 @@ class LockScreen extends LinearLayout implements KeyguardScreen {
        return !configDisabled || isTestHarness || fileOverride || menuOverride;
    }

    boolean mHomeUnlockScreen = (Settings.System.getInt(mContext.getContentResolver(), Settings.System.HOME_UNLOCK_SCREEN, 0) == 1);

    /**
     * @param context Used to setup the view.
     * @param configuration The current configuration. Used to use when selecting layout, etc.
@@ -733,7 +735,8 @@ class LockScreen extends LinearLayout implements KeyguardScreen {

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_MENU && mEnableMenuKeyInLockScreen) {
        if ((keyCode == KeyEvent.KEYCODE_MENU && mEnableMenuKeyInLockScreen) ||
            (keyCode == KeyEvent.KEYCODE_HOME && mHomeUnlockScreen)) {
            mCallback.goToUnlockScreen();
        }
        return false;
+7 −0
Original line number Diff line number Diff line
@@ -552,6 +552,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    // Behavior of ENDCALL Button.  (See Settings.System.END_BUTTON_BEHAVIOR.)
    int mEndcallBehavior;

    // Behavior of home unlock
    boolean mHomeUnlockScreen;

    // Behavior of POWER button while in-call and screen on.
    // (See Settings.Secure.INCALL_POWER_BUTTON_BEHAVIOR.)
    int mIncallPowerBehavior;
@@ -643,6 +646,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    Settings.System.VOLBTN_MUSIC_CONTROLS), false, this);
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.ACCELEROMETER_ROTATION), false, this);
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.HOME_UNLOCK_SCREEN), false, this);
            resolver.registerContentObserver(Settings.System.getUriFor(
                    Settings.System.USER_ROTATION), false, this);
            resolver.registerContentObserver(Settings.System.getUriFor(
@@ -1364,6 +1369,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    Settings.System.VOLUME_WAKE_SCREEN, 0) == 1);
            mVolBtnMusicControls = (Settings.System.getInt(resolver,
                    Settings.System.VOLBTN_MUSIC_CONTROLS, 1) == 1);
            mHomeUnlockScreen = (Settings.System.getInt(resolver,
                    Settings.System.HOME_UNLOCK_SCREEN, 0) == 1);

            boolean keyRebindingEnabled = Settings.System.getInt(resolver,
                    Settings.System.HARDWARE_KEY_REBINDING, 0) == 1;