summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Burns <burnsra@gmail.com>2012-12-06 23:12:12 -0500
committerRobert Burns <burnsra@gmail.com>2012-12-09 15:56:09 -0500
commit7536aa5014aa2ff2433896c22c0009ca2990fcde (patch)
tree339d9cfe4ba1be31c8b94263d68402a9042d1721
parentea84c3c3b3336f278a215bbcdf8ab6c4ad9539e4 (diff)
downloadframeworks_base-7536aa5014aa2ff2433896c22c0009ca2990fcde.zip
frameworks_base-7536aa5014aa2ff2433896c22c0009ca2990fcde.tar.gz
frameworks_base-7536aa5014aa2ff2433896c22c0009ca2990fcde.tar.bz2
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
-rw-r--r--core/java/android/provider/Settings.java13
-rw-r--r--core/java/com/android/internal/widget/multiwaveview/GlowPadView.java5
-rwxr-xr-xcore/res/res/values/config.xml3
-rw-r--r--core/res/res/values/symbols.xml3
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView.java13
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java18
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java2
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java34
8 files changed, 82 insertions, 9 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 6ecd103..db2598f 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -2884,6 +2884,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
diff --git a/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java b/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
index 7de978b..8763df7 100644
--- a/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
+++ b/core/java/com/android/internal/widget/multiwaveview/GlowPadView.java
@@ -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();
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 0c8a5b2..54b3416 100755
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -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>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 3c0bc3d..66e1b40 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -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>
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView.java
index cc520dc..46dfc34 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardAbsKeyInputView.java
@@ -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);
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
index c7136bc..ea57f916 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java
@@ -43,6 +43,7 @@ import android.os.Parcelable;
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.UserManager;
+import android.provider.Settings;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Slog;
@@ -1469,10 +1470,14 @@ public class KeyguardHostView extends KeyguardViewBase {
com.android.internal.R.bool.config_disableMenuKeyInLockScreen);
final boolean isTestHarness = ActivityManager.isRunningInTestHarness();
final boolean fileOverride = (new File(ENABLE_MENU_KEY_FILE)).exists();
- return !configDisabled || isTestHarness || fileOverride;
+ final boolean menuOverride = Settings.System.getInt(getContext().getContentResolver(), Settings.System.MENU_UNLOCK_SCREEN, 0) == 1;
+ return !configDisabled || isTestHarness || fileOverride || menuOverride;
}
-
+ private boolean shouldEnableHomeKey() {
+ final boolean homeOverride = Settings.System.getInt(getContext().getContentResolver(), Settings.System.HOME_UNLOCK_SCREEN, 0) == 1;
+ return homeOverride;
+ }
public void goToUserSwitcher() {
mAppWidgetContainer.setCurrentPage(getWidgetPosition(R.id.keyguard_multi_user_selector));
@@ -1492,6 +1497,15 @@ public class KeyguardHostView extends KeyguardViewBase {
return false;
}
+ public boolean handleHomeKey() {
+ // The following enables the HOME key to work for testing automation
+ if (shouldEnableHomeKey()) {
+ showNextSecurityScreenOrFinish(false);
+ return true;
+ }
+ return false;
+ }
+
public boolean handleBackKey() {
if (mCurrentSecuritySelection != SecurityMode.None) {
mCallback.dismiss(false);
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java
index 76ba811..504b4d6 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewManager.java
@@ -145,6 +145,8 @@ public class KeyguardViewManager {
return true;
} else if (keyCode == KeyEvent.KEYCODE_MENU && mKeyguardView.handleMenuKey()) {
return true;
+ } else if (keyCode == KeyEvent.KEYCODE_HOME && mKeyguardView.handleHomeKey()) {
+ return true;
}
}
return super.dispatchKeyEvent(event);
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
index 92df7c7..27da14e 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardViewMediator.java
@@ -247,6 +247,8 @@ public class KeyguardViewMediator {
private ProfileManager mProfileManager;
+ private int mSlideLockDelay;
+
/**
* The volume applied to the lock/unlock sounds.
*/
@@ -571,15 +573,26 @@ public class KeyguardViewMediator {
public void onScreenTurnedOff(int why) {
synchronized (this) {
mScreenOn = false;
+ mSlideLockDelay = why;
if (DEBUG) Log.d(TAG, "onScreenTurnedOff(" + why + ")");
mKeyguardDonePending = false;
- // Lock immediately based on setting if secure (user has a pin/pattern/password).
- // This also "locks" the device when not secure to provide easy access to the
- // camera while preventing unwanted input.
- final boolean lockImmediately =
- mLockPatternUtils.getPowerButtonInstantlyLocks() || !mLockPatternUtils.isSecure();
+ // Prepare for handling Lock/Slide lock delay and timeout
+ boolean lockImmediately = false;
+ final ContentResolver cr = mContext.getContentResolver();
+ boolean separateSlideLockTimeoutEnabled = Settings.System.getInt(cr,
+ Settings.System.SCREEN_LOCK_SLIDE_DELAY_TOGGLE, 0) == 1;
+ if (mLockPatternUtils.isSecure()) {
+ // Lock immediately based on setting if secure (user has a pin/pattern/password)
+ // This is retained as-is to ensue AOSP security integrity is maintained
+ lockImmediately = mLockPatternUtils.getPowerButtonInstantlyLocks();
+ } else {
+ // Unless a separate slide lock timeout is enabled, this "locks" the device when
+ // not secure to provide easy access to the camera while preventing unwanted input
+ lockImmediately = separateSlideLockTimeoutEnabled ? false
+ : mLockPatternUtils.getPowerButtonInstantlyLocks();
+ }
if (mExitSecureCallback != null) {
if (DEBUG) Log.d(TAG, "pending exit secure callback cancelled");
@@ -610,6 +623,9 @@ public class KeyguardViewMediator {
// having to unlock the screen)
final ContentResolver cr = mContext.getContentResolver();
+ boolean separateSlideLockTimeoutEnabled = Settings.System.getInt(cr,
+ Settings.System.SCREEN_LOCK_SLIDE_DELAY_TOGGLE, 0) == 1;
+
// From DisplaySettings
long displayTimeout = Settings.System.getInt(cr, SCREEN_OFF_TIMEOUT,
KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT);
@@ -619,6 +635,12 @@ public class KeyguardViewMediator {
Settings.Secure.LOCK_SCREEN_LOCK_AFTER_TIMEOUT,
KEYGUARD_LOCK_AFTER_DELAY_DEFAULT);
+ // From CyanogenMod specific Settings
+ int slideLockTimeoutDelay = (mSlideLockDelay == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT ? Settings.System
+ .getInt(cr, Settings.System.SCREEN_LOCK_SLIDE_TIMEOUT_DELAY,
+ KEYGUARD_LOCK_AFTER_DELAY_DEFAULT) : Settings.System.getInt(cr,
+ Settings.System.SCREEN_LOCK_SLIDE_SCREENOFF_DELAY, 0));
+
// From DevicePolicyAdmin
final long policyTimeout = mLockPatternUtils.getDevicePolicyManager()
.getMaximumTimeToLock(null, mLockPatternUtils.getCurrentUser());
@@ -629,7 +651,7 @@ public class KeyguardViewMediator {
displayTimeout = Math.max(displayTimeout, 0); // ignore negative values
timeout = Math.min(policyTimeout - displayTimeout, lockAfterTimeout);
} else {
- timeout = lockAfterTimeout;
+ timeout = separateSlideLockTimeoutEnabled ? slideLockTimeoutDelay : lockAfterTimeout;
}
if (timeout <= 0) {