summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorAdrian Roos <roosa@google.com>2015-04-16 17:11:20 -0700
committerAdrian Roos <roosa@google.com>2015-04-28 11:49:00 -0700
commit8150d2a2a12b38598fd55d8ae3c3b5662ec3520f (patch)
treedf0c100c35959c7317b8255865cdadf791364ec6 /packages
parentc8240411c38b78ac8095f6e8067f7bcc7046f502 (diff)
downloadframeworks_base-8150d2a2a12b38598fd55d8ae3c3b5662ec3520f.zip
frameworks_base-8150d2a2a12b38598fd55d8ae3c3b5662ec3520f.tar.gz
frameworks_base-8150d2a2a12b38598fd55d8ae3c3b5662ec3520f.tar.bz2
Require explicit userId in LockPatternUtils
Bug: 18931518 Change-Id: Ib03f37df9135f0324a998c62d165d8eea46328c8
Diffstat (limited to 'packages')
-rw-r--r--packages/Keyguard/src/com/android/keyguard/EmergencyButton.java2
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java8
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java11
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java5
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardSecurityModel.java3
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java3
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java2
-rw-r--r--packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java19
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java2
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java2
12 files changed, 40 insertions, 26 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java b/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java
index 1699809..5bc7da9 100644
--- a/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java
+++ b/packages/Keyguard/src/com/android/keyguard/EmergencyButton.java
@@ -138,7 +138,7 @@ public class EmergencyButton extends Button {
visible = mEnableEmergencyCallWhileSimLocked;
} else {
// Only show if there is a secure screen (pin/pattern/SIM pin/SIM puk);
- visible = mLockPatternUtils.isSecure();
+ visible = mLockPatternUtils.isSecure(mLockPatternUtils.getCurrentUser());
}
}
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
index 322be91..db4db13 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
@@ -63,7 +63,8 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
// start fresh
resetPasswordText(false /* animate */);
// if the user is currently locked out, enforce it.
- long deadline = mLockPatternUtils.getLockoutAttemptDeadline();
+ long deadline = mLockPatternUtils.getLockoutAttemptDeadline(
+ mLockPatternUtils.getCurrentUser());
if (shouldLockout(deadline)) {
handleAttemptLockout(deadline);
} else {
@@ -106,7 +107,7 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
protected void verifyPasswordAndUnlock() {
String entry = getPasswordText();
- if (mLockPatternUtils.checkPassword(entry)) {
+ if (mLockPatternUtils.checkPassword(entry, mLockPatternUtils.getCurrentUser())) {
mCallback.reportUnlockAttempt(true);
mCallback.dismiss(true);
} else {
@@ -116,7 +117,8 @@ public abstract class KeyguardAbsKeyInputView extends LinearLayout
mCallback.reportUnlockAttempt(false);
int attempts = KeyguardUpdateMonitor.getInstance(mContext).getFailedUnlockAttempts();
if (0 == (attempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT)) {
- long deadline = mLockPatternUtils.setLockoutAttemptDeadline();
+ long deadline = mLockPatternUtils.setLockoutAttemptDeadline(
+ mLockPatternUtils.getCurrentUser());
handleAttemptLockout(deadline);
}
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
index 9aa5729..00a5140 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
@@ -130,7 +130,8 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
mLockPatternView.setOnPatternListener(new UnlockPatternListener());
// stealth mode will be the same for the life of this screen
- mLockPatternView.setInStealthMode(!mLockPatternUtils.isVisiblePatternEnabled());
+ mLockPatternView.setInStealthMode(!mLockPatternUtils.isVisiblePatternEnabled(
+ mLockPatternUtils.getCurrentUser()));
// vibrate mode will be the same for the life of this screen
mLockPatternView.setTactileFeedbackEnabled(mLockPatternUtils.isTactileFeedbackEnabled());
@@ -176,7 +177,8 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
mLockPatternView.clearPattern();
// if the user is currently locked out, enforce it.
- long deadline = mLockPatternUtils.getLockoutAttemptDeadline();
+ long deadline = mLockPatternUtils.getLockoutAttemptDeadline(
+ mLockPatternUtils.getCurrentUser());
if (deadline != 0) {
handleAttemptLockout(deadline);
} else {
@@ -213,7 +215,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
}
public void onPatternDetected(List<LockPatternView.Cell> pattern) {
- if (mLockPatternUtils.checkPattern(pattern)) {
+ if (mLockPatternUtils.checkPattern(pattern, mLockPatternUtils.getCurrentUser())) {
mCallback.reportUnlockAttempt(true);
mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Correct);
mCallback.dismiss(true);
@@ -230,7 +232,8 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
int attempts = mKeyguardUpdateMonitor.getFailedUnlockAttempts();
if (registeredAttempt &&
0 == (attempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT)) {
- long deadline = mLockPatternUtils.setLockoutAttemptDeadline();
+ long deadline = mLockPatternUtils.setLockoutAttemptDeadline(
+ mLockPatternUtils.getCurrentUser());
handleAttemptLockout(deadline);
} else {
mSecurityMessageDisplay.setMessage(R.string.kg_wrong_pattern, true);
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
index 5af7783..1cced15 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
@@ -296,7 +296,7 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
(failedAttempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) == 0;
}
monitor.reportFailedUnlockAttempt();
- mLockPatternUtils.reportFailedPasswordAttempt();
+ mLockPatternUtils.reportFailedPasswordAttempt(mLockPatternUtils.getCurrentUser());
if (showTimeout) {
showTimeoutDialog();
}
@@ -430,7 +430,8 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
if (success) {
monitor.clearFailedUnlockAttempts();
- mLockPatternUtils.reportSuccessfulPasswordAttempt();
+ mLockPatternUtils.reportSuccessfulPasswordAttempt(
+ mLockPatternUtils.getCurrentUser());
} else {
KeyguardSecurityContainer.this.reportFailedUnlockAttempt();
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityModel.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityModel.java
index 3eb31ad..e582811 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityModel.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityModel.java
@@ -67,7 +67,8 @@ public class KeyguardSecurityModel {
return SecurityMode.SimPuk;
}
- final int security = mLockPatternUtils.getActivePasswordQuality();
+ final int security = mLockPatternUtils.getActivePasswordQuality(
+ mLockPatternUtils.getCurrentUser());
switch (security) {
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java
index af6360a..7cd9c7c 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java
@@ -200,7 +200,8 @@ public class KeyguardStatusView extends GridLayout {
private String getOwnerInfo() {
ContentResolver res = getContext().getContentResolver();
String info = null;
- final boolean ownerInfoEnabled = mLockPatternUtils.isOwnerInfoEnabled();
+ final boolean ownerInfoEnabled = mLockPatternUtils.isOwnerInfoEnabled(
+ mLockPatternUtils.getCurrentUser());
if (ownerInfoEnabled) {
info = mLockPatternUtils.getOwnerInfo(mLockPatternUtils.getCurrentUser());
}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
index 870f043..7bf2223 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
@@ -2066,7 +2066,7 @@ class DatabaseHelper extends SQLiteOpenHelper {
LockPatternUtils lpu = new LockPatternUtils(mContext);
List<LockPatternView.Cell> cellPattern =
LockPatternUtils.stringToPattern(lockPattern);
- lpu.saveLockPattern(cellPattern, null);
+ lpu.saveLockPattern(cellPattern, null, UserHandle.USER_OWNER);
} catch (IllegalArgumentException e) {
// Don't want corrupted lock pattern to hang the reboot process
}
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
index 7f826ef..d99f741 100644
--- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
+++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java
@@ -754,7 +754,7 @@ public class SettingsBackupAgent extends BackupAgentHelper {
*/
private byte[] getLockSettings() {
final LockPatternUtils lockPatternUtils = new LockPatternUtils(this);
- final boolean ownerInfoEnabled = lockPatternUtils.isOwnerInfoEnabled();
+ final boolean ownerInfoEnabled = lockPatternUtils.isOwnerInfoEnabled(UserHandle.myUserId());
final String ownerInfo = lockPatternUtils.getOwnerInfo(UserHandle.myUserId());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -871,7 +871,8 @@ public class SettingsBackupAgent extends BackupAgentHelper {
}
switch (key) {
case KEY_LOCK_SETTINGS_OWNER_INFO_ENABLED:
- lockPatternUtils.setOwnerInfoEnabled("1".equals(value));
+ lockPatternUtils.setOwnerInfoEnabled("1".equals(value),
+ UserHandle.myUserId());
break;
case KEY_LOCK_SETTINGS_OWNER_INFO:
lockPatternUtils.setOwnerInfo(value, UserHandle.myUserId());
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 7b555fc..e24e88e 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -542,7 +542,8 @@ public class KeyguardViewMediator extends SystemUI {
mLockPatternUtils.setCurrentUser(ActivityManager.getCurrentUser());
// Assume keyguard is showing (unless it's disabled) until we know for sure...
- setShowingLocked(!shouldWaitForProvisioning() && !mLockPatternUtils.isLockScreenDisabled());
+ setShowingLocked(!shouldWaitForProvisioning() && !mLockPatternUtils.isLockScreenDisabled(
+ mLockPatternUtils.getCurrentUser()));
mTrustManager.reportKeyguardShowingChanged();
mStatusBarKeyguardViewManager = new StatusBarKeyguardViewManager(mContext,
@@ -623,8 +624,10 @@ public class KeyguardViewMediator extends SystemUI {
// 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.
+ int currentUser = mLockPatternUtils.getCurrentUser();
final boolean lockImmediately =
- mLockPatternUtils.getPowerButtonInstantlyLocks() || !mLockPatternUtils.isSecure();
+ mLockPatternUtils.getPowerButtonInstantlyLocks(currentUser)
+ || !mLockPatternUtils.isSecure(currentUser);
notifyScreenOffLocked();
@@ -719,7 +722,8 @@ public class KeyguardViewMediator extends SystemUI {
}
private void maybeSendUserPresentBroadcast() {
- if (mSystemReady && mLockPatternUtils.isLockScreenDisabled()) {
+ if (mSystemReady && mLockPatternUtils.isLockScreenDisabled(
+ mLockPatternUtils.getCurrentUser())) {
// Lock screen is disabled because the user has set the preference to "None".
// In this case, send out ACTION_USER_PRESENT here instead of in
// handleKeyguardDone()
@@ -733,7 +737,7 @@ public class KeyguardViewMediator extends SystemUI {
*/
public void onDreamingStarted() {
synchronized (this) {
- if (mScreenOn && mLockPatternUtils.isSecure()) {
+ if (mScreenOn && mLockPatternUtils.isSecure(mLockPatternUtils.getCurrentUser())) {
doKeyguardLaterLocked();
}
}
@@ -974,12 +978,13 @@ public class KeyguardViewMediator extends SystemUI {
return;
}
- if (mLockPatternUtils.isLockScreenDisabled() && !lockedOrMissing) {
+ if (mLockPatternUtils.isLockScreenDisabled(mLockPatternUtils.getCurrentUser())
+ && !lockedOrMissing) {
if (DEBUG) Log.d(TAG, "doKeyguard: not showing because lockscreen is off");
return;
}
- if (mLockPatternUtils.checkVoldPassword()) {
+ if (mLockPatternUtils.checkVoldPassword(mLockPatternUtils.getCurrentUser())) {
if (DEBUG) Log.d(TAG, "Not showing lock screen since just decrypted");
// Without this, settings is not enabled until the lock screen first appears
setShowingLocked(false);
@@ -1072,7 +1077,7 @@ public class KeyguardViewMediator extends SystemUI {
}
public boolean isSecure() {
- return mLockPatternUtils.isSecure()
+ return mLockPatternUtils.isSecure(mLockPatternUtils.getCurrentUser())
|| KeyguardUpdateMonitor.getInstance(mContext).isSimPinSecure();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 92bd0df..cf54fbc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -639,7 +639,7 @@ public abstract class BaseStatusBar extends SystemUI implements
Settings.Secure.SHOW_NOTE_ABOUT_NOTIFICATION_HIDING, 1)) {
Log.d(TAG, "user hasn't seen notification about hidden notifications");
final LockPatternUtils lockPatternUtils = new LockPatternUtils(mContext);
- if (!lockPatternUtils.isSecure()) {
+ if (!lockPatternUtils.isSecure(lockPatternUtils.getCurrentUser())) {
Log.d(TAG, "insecure lockscreen, skipping notification");
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.SHOW_NOTE_ABOUT_NOTIFICATION_HIDING, 0);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
index e5ef6ff..a213160 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java
@@ -234,8 +234,8 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
boolean currentUserHasTrust = updateMonitor.getUserHasTrust(
mLockPatternUtils.getCurrentUser());
- return mLockPatternUtils.isSecure() && !currentUserHasTrust
- ? SECURE_CAMERA_INTENT : INSECURE_CAMERA_INTENT;
+ boolean secure = mLockPatternUtils.isSecure(mLockPatternUtils.getCurrentUser());
+ return (secure && !currentUserHasTrust) ? SECURE_CAMERA_INTENT : INSECURE_CAMERA_INTENT;
}
private void updateCameraVisibility() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java
index 65cd268..75b2c741 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java
@@ -81,7 +81,7 @@ public class UnlockMethodCache {
private void update(boolean updateAlways) {
int user = mLockPatternUtils.getCurrentUser();
- boolean secure = mLockPatternUtils.isSecure();
+ boolean secure = mLockPatternUtils.isSecure(user);
boolean currentlyInsecure = !secure || mKeyguardUpdateMonitor.getUserHasTrust(user);
boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user);
boolean faceUnlockRunning = mKeyguardUpdateMonitor.isFaceUnlockRunning(user)