am 62fad768: Merge "Fix 4560303: Add setting to lock later when power button pressed" into ics-mr1

* commit '62fad7689567bed6ec372401c1b171659c28572d':
  Fix 4560303: Add setting to lock later when power button pressed
This commit is contained in:
Jim Miller
2012-01-10 10:31:56 -08:00
committed by Android Git Automerger
2 changed files with 30 additions and 12 deletions

View File

@@ -117,6 +117,8 @@ public class LockPatternUtils {
= "lockscreen.biometric_weak_fallback";
public final static String BIOMETRIC_WEAK_EVER_CHOSEN_KEY
= "lockscreen.biometricweakeverchosen";
public final static String LOCKSCREEN_POWER_BUTTON_INSTANTLY_LOCKS
= "lockscreen.power_button_instantly_locks";
private final static String PASSWORD_HISTORY_KEY = "lockscreen.passwordhistory";
@@ -335,7 +337,7 @@ public class LockPatternUtils {
* @return True if the user has ever chosen a pattern.
*/
public boolean isPatternEverChosen() {
return getBoolean(PATTERN_EVER_CHOSEN_KEY);
return getBoolean(PATTERN_EVER_CHOSEN_KEY, false);
}
/**
@@ -345,7 +347,7 @@ public class LockPatternUtils {
* @return True if the user has ever chosen biometric weak.
*/
public boolean isBiometricWeakEverChosen() {
return getBoolean(BIOMETRIC_WEAK_EVER_CHOSEN_KEY);
return getBoolean(BIOMETRIC_WEAK_EVER_CHOSEN_KEY, false);
}
/**
@@ -838,7 +840,7 @@ public class LockPatternUtils {
getLong(PASSWORD_TYPE_ALTERNATE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING)
== DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
return getBoolean(Settings.Secure.LOCK_PATTERN_ENABLED)
return getBoolean(Settings.Secure.LOCK_PATTERN_ENABLED, false)
&& (getLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING)
== DevicePolicyManager.PASSWORD_QUALITY_SOMETHING ||
(usingBiometricWeak() && backupEnabled));
@@ -884,7 +886,7 @@ public class LockPatternUtils {
* @return Whether the visible pattern is enabled.
*/
public boolean isVisiblePatternEnabled() {
return getBoolean(Settings.Secure.LOCK_PATTERN_VISIBLE);
return getBoolean(Settings.Secure.LOCK_PATTERN_VISIBLE, false);
}
/**
@@ -898,7 +900,7 @@ public class LockPatternUtils {
* @return Whether tactile feedback for the pattern is enabled.
*/
public boolean isTactileFeedbackEnabled() {
return getBoolean(Settings.Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
return getBoolean(Settings.Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED, false);
}
/**
@@ -939,7 +941,7 @@ public class LockPatternUtils {
* attempts.
*/
public boolean isPermanentlyLocked() {
return getBoolean(LOCKOUT_PERMANENT_KEY);
return getBoolean(LOCKOUT_PERMANENT_KEY, false);
}
/**
@@ -982,9 +984,10 @@ public class LockPatternUtils {
return nextAlarm;
}
private boolean getBoolean(String secureSettingKey) {
private boolean getBoolean(String secureSettingKey, boolean defaultValue) {
return 1 ==
android.provider.Settings.Secure.getInt(mContentResolver, secureSettingKey, 0);
android.provider.Settings.Secure.getInt(mContentResolver, secureSettingKey,
defaultValue ? 1 : 0);
}
private void setBoolean(String secureSettingKey, boolean enabled) {
@@ -1085,4 +1088,12 @@ public class LockPatternUtils {
mContext.startActivity(intent);
}
public void setPowerButtonInstantlyLocks(boolean enabled) {
setBoolean(LOCKSCREEN_POWER_BUTTON_INSTANTLY_LOCKS, enabled);
}
public boolean getPowerButtonInstantlyLocks() {
return getBoolean(LOCKSCREEN_POWER_BUTTON_INSTANTLY_LOCKS, true);
}
}