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

Commit 7536aa50 authored by Robert Burns's avatar Robert Burns
Browse files

Forward port CM Screen Security settings (Part 2 of 2)

Patch Set 1:	Quick Unlock
Patch Set 2:	Lockscreen Vibrate
Patch Set 3:	Slide Lock Delay
Patch Set 4:	Menu Unlock
Patch Set 5:    Rebase
Patch Set 6:    Home Unlock

Change-Id: Ie1ccaec43ca75474e92f96c60e15d7b75796ac5f
parent ea84c3c3
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -2883,6 +2883,18 @@ public final class Settings {
         */
        public static final String POWER_MENU_SILENT_ENABLED = "power_menu_silent_enabled";

        /**
         * 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 the lockscreen vibrate should be enabled.
         * @hide
         */
        public static final String LOCKSCREEN_VIBRATE_ENABLED = "lockscreen.vibrate_enabled";

        /**
         * Settings to backup. This is here so that it's in the same place as the settings
         * keys and easy to update.
@@ -2967,6 +2979,7 @@ public final class Settings {
            POWER_MENU_AIRPLANE_ENABLED,
            POWER_MENU_SILENT_ENABLED,
            POWER_MENU_USER_ENABLED,
            LOCKSCREEN_VIBRATE_ENABLED,
        };

        // Settings moved to Settings.Secure
+4 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
@@ -308,7 +309,9 @@ public class GlowPadView extends View {

        a.recycle();

        setVibrateEnabled(mVibrationDuration > 0);
        final ContentResolver resolver = context.getContentResolver();
        boolean vibrateEnabled = Settings.System.getInt(resolver,Settings.System.LOCKSCREEN_VIBRATE_ENABLED, 1) == 1;
        setVibrateEnabled(vibrateEnabled ? mVibrationDuration > 0 : false);

        assignDefaultsIfNeeded();

+3 −0
Original line number Diff line number Diff line
@@ -1054,4 +1054,7 @@
    <!-- Boolean to enable stk functionality on Samsung phones -->
    <bool name="config_samsung_stk">false</bool>

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

</resources>
+3 −0
Original line number Diff line number Diff line
@@ -1872,4 +1872,7 @@
  <!-- Developer settings - Kill app back press -->
  <java-symbol type="string" name="app_killed_message" />

  <!-- Lockscreen -->
  <java-symbol type="bool" name="config_disableHomeUnlockSetting" />

</resources>
+13 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.CountDownTimer;
import android.os.SystemClock;
import android.provider.Settings;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
@@ -47,6 +48,7 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
    protected View mEcaView;
    private Drawable mBouncerFrame;
    protected boolean mEnableHaptics;
    private boolean mQuickUnlock;

    // To avoid accidental lockout due to events while the device in in the pocket, ignore
    // any passwords with length less than or equal to this length.
@@ -111,6 +113,9 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
            }
        });

        mQuickUnlock = (Settings.System.getInt(mContext.getContentResolver(),
            Settings.System.LOCKSCREEN_QUICK_UNLOCK_CONTROL, 0) == 1);

        mPasswordEntry.addTextChangedListener(new TextWatcher() {
            public void onTextChanged(CharSequence s, int start, int before, int count) {
            }
@@ -122,6 +127,14 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
                if (mCallback != null) {
                    mCallback.userActivity(0);
                }
                if (mQuickUnlock) {
                    String entry = mPasswordEntry.getText().toString();
                    if (entry.length() > MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT &&
                            mLockPatternUtils.checkPassword(entry)) {
                        mCallback.reportSuccessfulUnlockAttempt();
                        mCallback.dismiss(true);
                    }
                }
            }
        });
        mSecurityMessageDisplay = new KeyguardMessageArea.Helper(this);
Loading