Require explicit userId in LockPatternUtils
Bug: 18931518 Change-Id: Ie2faa18918aaadf17a84287898438549a693b0cc
This commit is contained in:
@@ -29,6 +29,7 @@ import android.content.DialogInterface;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
import android.security.KeyStore;
|
import android.security.KeyStore;
|
||||||
@@ -168,7 +169,7 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
Preference preference) {
|
Preference preference) {
|
||||||
final String key = preference.getKey();
|
final String key = preference.getKey();
|
||||||
|
|
||||||
if (!isUnlockMethodSecure(key) && mLockPatternUtils.isSecure()) {
|
if (!isUnlockMethodSecure(key) && mLockPatternUtils.isSecure(UserHandle.myUserId())) {
|
||||||
// Show the disabling FRP warning only when the user is switching from a secure
|
// Show the disabling FRP warning only when the user is switching from a secure
|
||||||
// unlock method to an insecure one
|
// unlock method to an insecure one
|
||||||
showFactoryResetProtectionWarningDialog(key);
|
showFactoryResetProtectionWarningDialog(key);
|
||||||
@@ -268,10 +269,10 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getKeyForCurrent() {
|
private String getKeyForCurrent() {
|
||||||
if (mLockPatternUtils.isLockScreenDisabled()) {
|
if (mLockPatternUtils.isLockScreenDisabled(UserHandle.myUserId())) {
|
||||||
return KEY_UNLOCK_SET_OFF;
|
return KEY_UNLOCK_SET_OFF;
|
||||||
}
|
}
|
||||||
switch (mLockPatternUtils.getKeyguardStoredPasswordQuality()) {
|
switch (mLockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId())) {
|
||||||
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
|
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
|
||||||
return KEY_UNLOCK_SET_PATTERN;
|
return KEY_UNLOCK_SET_PATTERN;
|
||||||
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
|
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
|
||||||
@@ -474,8 +475,9 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
}
|
}
|
||||||
startActivityForResult(intent, CHOOSE_LOCK_REQUEST);
|
startActivityForResult(intent, CHOOSE_LOCK_REQUEST);
|
||||||
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
|
} else if (quality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
|
||||||
mChooseLockSettingsHelper.utils().clearLock();
|
mChooseLockSettingsHelper.utils().clearLock(UserHandle.myUserId());
|
||||||
mChooseLockSettingsHelper.utils().setLockScreenDisabled(disabled);
|
mChooseLockSettingsHelper.utils().setLockScreenDisabled(disabled,
|
||||||
|
UserHandle.myUserId());
|
||||||
removeAllFingerprintTemplates();
|
removeAllFingerprintTemplates();
|
||||||
getActivity().setResult(Activity.RESULT_OK);
|
getActivity().setResult(Activity.RESULT_OK);
|
||||||
finish();
|
finish();
|
||||||
@@ -502,7 +504,7 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getResIdForFactoryResetProtectionWarningTitle() {
|
private int getResIdForFactoryResetProtectionWarningTitle() {
|
||||||
switch (mLockPatternUtils.getKeyguardStoredPasswordQuality()) {
|
switch (mLockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId())) {
|
||||||
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
|
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
|
||||||
return R.string.unlock_disable_lock_pattern_summary;
|
return R.string.unlock_disable_lock_pattern_summary;
|
||||||
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
|
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
|
||||||
|
@@ -31,6 +31,7 @@ import android.inputmethodservice.KeyboardView;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.text.Selection;
|
import android.text.Selection;
|
||||||
@@ -200,24 +201,31 @@ public class ChooseLockPassword extends SettingsActivity {
|
|||||||
throw new SecurityException("Fragment contained in wrong activity");
|
throw new SecurityException("Fragment contained in wrong activity");
|
||||||
}
|
}
|
||||||
mRequestedQuality = Math.max(intent.getIntExtra(LockPatternUtils.PASSWORD_TYPE_KEY,
|
mRequestedQuality = Math.max(intent.getIntExtra(LockPatternUtils.PASSWORD_TYPE_KEY,
|
||||||
mRequestedQuality), mLockPatternUtils.getRequestedPasswordQuality());
|
mRequestedQuality), mLockPatternUtils.getRequestedPasswordQuality(
|
||||||
|
UserHandle.myUserId()));
|
||||||
mPasswordMinLength = Math.max(Math.max(
|
mPasswordMinLength = Math.max(Math.max(
|
||||||
LockPatternUtils.MIN_LOCK_PASSWORD_SIZE,
|
LockPatternUtils.MIN_LOCK_PASSWORD_SIZE,
|
||||||
intent.getIntExtra(PASSWORD_MIN_KEY, mPasswordMinLength)),
|
intent.getIntExtra(PASSWORD_MIN_KEY, mPasswordMinLength)),
|
||||||
mLockPatternUtils.getRequestedMinimumPasswordLength());
|
mLockPatternUtils.getRequestedMinimumPasswordLength(UserHandle.myUserId()));
|
||||||
mPasswordMaxLength = intent.getIntExtra(PASSWORD_MAX_KEY, mPasswordMaxLength);
|
mPasswordMaxLength = intent.getIntExtra(PASSWORD_MAX_KEY, mPasswordMaxLength);
|
||||||
mPasswordMinLetters = Math.max(intent.getIntExtra(PASSWORD_MIN_LETTERS_KEY,
|
mPasswordMinLetters = Math.max(intent.getIntExtra(PASSWORD_MIN_LETTERS_KEY,
|
||||||
mPasswordMinLetters), mLockPatternUtils.getRequestedPasswordMinimumLetters());
|
mPasswordMinLetters), mLockPatternUtils.getRequestedPasswordMinimumLetters(
|
||||||
|
UserHandle.myUserId()));
|
||||||
mPasswordMinUpperCase = Math.max(intent.getIntExtra(PASSWORD_MIN_UPPERCASE_KEY,
|
mPasswordMinUpperCase = Math.max(intent.getIntExtra(PASSWORD_MIN_UPPERCASE_KEY,
|
||||||
mPasswordMinUpperCase), mLockPatternUtils.getRequestedPasswordMinimumUpperCase());
|
mPasswordMinUpperCase), mLockPatternUtils.getRequestedPasswordMinimumUpperCase(
|
||||||
|
UserHandle.myUserId()));
|
||||||
mPasswordMinLowerCase = Math.max(intent.getIntExtra(PASSWORD_MIN_LOWERCASE_KEY,
|
mPasswordMinLowerCase = Math.max(intent.getIntExtra(PASSWORD_MIN_LOWERCASE_KEY,
|
||||||
mPasswordMinLowerCase), mLockPatternUtils.getRequestedPasswordMinimumLowerCase());
|
mPasswordMinLowerCase), mLockPatternUtils.getRequestedPasswordMinimumLowerCase(
|
||||||
|
UserHandle.myUserId()));
|
||||||
mPasswordMinNumeric = Math.max(intent.getIntExtra(PASSWORD_MIN_NUMERIC_KEY,
|
mPasswordMinNumeric = Math.max(intent.getIntExtra(PASSWORD_MIN_NUMERIC_KEY,
|
||||||
mPasswordMinNumeric), mLockPatternUtils.getRequestedPasswordMinimumNumeric());
|
mPasswordMinNumeric), mLockPatternUtils.getRequestedPasswordMinimumNumeric(
|
||||||
|
UserHandle.myUserId()));
|
||||||
mPasswordMinSymbols = Math.max(intent.getIntExtra(PASSWORD_MIN_SYMBOLS_KEY,
|
mPasswordMinSymbols = Math.max(intent.getIntExtra(PASSWORD_MIN_SYMBOLS_KEY,
|
||||||
mPasswordMinSymbols), mLockPatternUtils.getRequestedPasswordMinimumSymbols());
|
mPasswordMinSymbols), mLockPatternUtils.getRequestedPasswordMinimumSymbols(
|
||||||
|
UserHandle.myUserId()));
|
||||||
mPasswordMinNonLetter = Math.max(intent.getIntExtra(PASSWORD_MIN_NONLETTER_KEY,
|
mPasswordMinNonLetter = Math.max(intent.getIntExtra(PASSWORD_MIN_NONLETTER_KEY,
|
||||||
mPasswordMinNonLetter), mLockPatternUtils.getRequestedPasswordMinimumNonLetter());
|
mPasswordMinNonLetter), mLockPatternUtils.getRequestedPasswordMinimumNonLetter(
|
||||||
|
UserHandle.myUserId()));
|
||||||
|
|
||||||
mChooseLockSettingsHelper = new ChooseLockSettingsHelper(getActivity());
|
mChooseLockSettingsHelper = new ChooseLockSettingsHelper(getActivity());
|
||||||
}
|
}
|
||||||
@@ -448,7 +456,7 @@ public class ChooseLockPassword extends SettingsActivity {
|
|||||||
return getString(R.string.lockpassword_password_requires_digit);
|
return getString(R.string.lockpassword_password_requires_digit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mLockPatternUtils.checkPasswordHistory(password)) {
|
if(mLockPatternUtils.checkPasswordHistory(password, UserHandle.myUserId())) {
|
||||||
return getString(mIsAlphaMode ? R.string.lockpassword_password_recently_used
|
return getString(mIsAlphaMode ? R.string.lockpassword_password_recently_used
|
||||||
: R.string.lockpassword_pin_recently_used);
|
: R.string.lockpassword_pin_recently_used);
|
||||||
}
|
}
|
||||||
@@ -473,15 +481,17 @@ public class ChooseLockPassword extends SettingsActivity {
|
|||||||
}
|
}
|
||||||
} else if (mUiStage == Stage.NeedToConfirm) {
|
} else if (mUiStage == Stage.NeedToConfirm) {
|
||||||
if (mFirstPin.equals(pin)) {
|
if (mFirstPin.equals(pin)) {
|
||||||
boolean wasSecureBefore = mLockPatternUtils.isSecure();
|
boolean wasSecureBefore = mLockPatternUtils.isSecure(UserHandle.myUserId());
|
||||||
final boolean required = getActivity().getIntent().getBooleanExtra(
|
final boolean required = getActivity().getIntent().getBooleanExtra(
|
||||||
EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
|
EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
|
||||||
mLockPatternUtils.setCredentialRequiredToDecrypt(required);
|
mLockPatternUtils.setCredentialRequiredToDecrypt(required);
|
||||||
mLockPatternUtils.saveLockPassword(pin, mCurrentPassword, mRequestedQuality);
|
mLockPatternUtils.saveLockPassword(pin, mCurrentPassword, mRequestedQuality,
|
||||||
|
UserHandle.myUserId());
|
||||||
|
|
||||||
if (mHasChallenge) {
|
if (mHasChallenge) {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
byte[] token = mLockPatternUtils.verifyPassword(pin, mChallenge);
|
byte[] token = mLockPatternUtils.verifyPassword(pin, mChallenge,
|
||||||
|
UserHandle.myUserId());
|
||||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token);
|
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token);
|
||||||
getActivity().setResult(RESULT_FINISHED, intent);
|
getActivity().setResult(RESULT_FINISHED, intent);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -31,6 +31,7 @@ import android.app.Fragment;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -603,18 +604,18 @@ public class ChooseLockPattern extends SettingsActivity {
|
|||||||
private void saveChosenPatternAndFinish() {
|
private void saveChosenPatternAndFinish() {
|
||||||
if (mDone) return;
|
if (mDone) return;
|
||||||
LockPatternUtils utils = mChooseLockSettingsHelper.utils();
|
LockPatternUtils utils = mChooseLockSettingsHelper.utils();
|
||||||
final boolean lockVirgin = !utils.isPatternEverChosen();
|
final boolean lockVirgin = !utils.isPatternEverChosen(UserHandle.myUserId());
|
||||||
|
|
||||||
boolean wasSecureBefore = utils.isSecure();
|
boolean wasSecureBefore = utils.isSecure(UserHandle.myUserId());
|
||||||
|
|
||||||
final boolean required = getActivity().getIntent().getBooleanExtra(
|
final boolean required = getActivity().getIntent().getBooleanExtra(
|
||||||
EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
|
EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
|
||||||
|
|
||||||
utils.setCredentialRequiredToDecrypt(required);
|
utils.setCredentialRequiredToDecrypt(required);
|
||||||
utils.saveLockPattern(mChosenPattern, mCurrentPattern);
|
utils.saveLockPattern(mChosenPattern, mCurrentPattern, UserHandle.myUserId());
|
||||||
|
|
||||||
if (lockVirgin) {
|
if (lockVirgin) {
|
||||||
utils.setVisiblePatternEnabled(true);
|
utils.setVisiblePatternEnabled(true, UserHandle.myUserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wasSecureBefore) {
|
if (!wasSecureBefore) {
|
||||||
@@ -623,7 +624,8 @@ public class ChooseLockPattern extends SettingsActivity {
|
|||||||
|
|
||||||
if (mHasChallenge) {
|
if (mHasChallenge) {
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
byte[] token = utils.verifyPattern(mChosenPattern, mChallenge);
|
byte[] token = utils.verifyPattern(mChosenPattern, mChallenge,
|
||||||
|
UserHandle.myUserId());
|
||||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token);
|
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token);
|
||||||
getActivity().setResult(RESULT_FINISHED, intent);
|
getActivity().setResult(RESULT_FINISHED, intent);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -21,6 +21,7 @@ import android.app.Activity;
|
|||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.os.UserHandle;
|
||||||
|
|
||||||
import com.android.internal.widget.LockPatternUtils;
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
|
|
||||||
@@ -116,7 +117,7 @@ public final class ChooseLockSettingsHelper {
|
|||||||
boolean returnCredentials, boolean external, boolean hasChallenge,
|
boolean returnCredentials, boolean external, boolean hasChallenge,
|
||||||
long challenge) {
|
long challenge) {
|
||||||
boolean launched = false;
|
boolean launched = false;
|
||||||
switch (mLockPatternUtils.getKeyguardStoredPasswordQuality()) {
|
switch (mLockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId())) {
|
||||||
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
|
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
|
||||||
launched = launchConfirmationActivity(request, title, header, description,
|
launched = launchConfirmationActivity(request, title, header, description,
|
||||||
returnCredentials || hasChallenge
|
returnCredentials || hasChallenge
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
package com.android.settings;
|
package com.android.settings;
|
||||||
|
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import com.android.internal.logging.MetricsLogger;
|
import com.android.internal.logging.MetricsLogger;
|
||||||
import com.android.internal.widget.LockPatternUtils;
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
@@ -90,7 +91,8 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
final int storedQuality = mLockPatternUtils.getKeyguardStoredPasswordQuality();
|
final int storedQuality = mLockPatternUtils.getKeyguardStoredPasswordQuality(
|
||||||
|
UserHandle.myUserId());
|
||||||
View view = inflater.inflate(R.layout.confirm_lock_password, null);
|
View view = inflater.inflate(R.layout.confirm_lock_password, null);
|
||||||
|
|
||||||
mPasswordEntry = (TextView) view.findViewById(R.id.password_entry);
|
mPasswordEntry = (TextView) view.findViewById(R.id.password_entry);
|
||||||
@@ -156,7 +158,7 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
long deadline = mLockPatternUtils.getLockoutAttemptDeadline();
|
long deadline = mLockPatternUtils.getLockoutAttemptDeadline(UserHandle.myUserId());
|
||||||
if (deadline != 0) {
|
if (deadline != 0) {
|
||||||
handleAttemptLockout(deadline);
|
handleAttemptLockout(deadline);
|
||||||
}
|
}
|
||||||
@@ -185,13 +187,14 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
if (getActivity() instanceof ConfirmLockPassword.InternalActivity) {
|
if (getActivity() instanceof ConfirmLockPassword.InternalActivity) {
|
||||||
long challenge = getActivity().getIntent().getLongExtra(
|
long challenge = getActivity().getIntent().getLongExtra(
|
||||||
ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0);
|
ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0);
|
||||||
byte[] token = mLockPatternUtils.verifyPassword(pin, challenge);
|
byte[] token = mLockPatternUtils.verifyPassword(pin, challenge,
|
||||||
|
UserHandle.myUserId());
|
||||||
if (token != null) {
|
if (token != null) {
|
||||||
matched = true;
|
matched = true;
|
||||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token);
|
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mLockPatternUtils.checkPassword(pin)) {
|
} else if (mLockPatternUtils.checkPassword(pin, UserHandle.myUserId())) {
|
||||||
matched = true;
|
matched = true;
|
||||||
if (getActivity() instanceof ConfirmLockPassword.InternalActivity) {
|
if (getActivity() instanceof ConfirmLockPassword.InternalActivity) {
|
||||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_TYPE,
|
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_TYPE,
|
||||||
@@ -206,7 +209,8 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
} else {
|
} else {
|
||||||
if (++mNumWrongConfirmAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) {
|
if (++mNumWrongConfirmAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) {
|
||||||
long deadline = mLockPatternUtils.setLockoutAttemptDeadline();
|
long deadline = mLockPatternUtils.setLockoutAttemptDeadline(
|
||||||
|
UserHandle.myUserId());
|
||||||
handleAttemptLockout(deadline);
|
handleAttemptLockout(deadline);
|
||||||
} else {
|
} else {
|
||||||
showError(getErrorMessage());
|
showError(getErrorMessage());
|
||||||
|
@@ -28,6 +28,7 @@ import android.content.Intent;
|
|||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.os.storage.StorageManager;
|
import android.os.storage.StorageManager;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@@ -135,7 +136,7 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
// on first launch, if no lock pattern is set, then finish with
|
// on first launch, if no lock pattern is set, then finish with
|
||||||
// success (don't want user to get stuck confirming something that
|
// success (don't want user to get stuck confirming something that
|
||||||
// doesn't exist).
|
// doesn't exist).
|
||||||
if (!mLockPatternUtils.isLockPatternEnabled()) {
|
if (!mLockPatternUtils.isLockPatternEnabled(UserHandle.myUserId())) {
|
||||||
getActivity().setResult(Activity.RESULT_OK);
|
getActivity().setResult(Activity.RESULT_OK);
|
||||||
getActivity().finish();
|
getActivity().finish();
|
||||||
}
|
}
|
||||||
@@ -168,7 +169,7 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
// if the user is currently locked out, enforce it.
|
// if the user is currently locked out, enforce it.
|
||||||
long deadline = mLockPatternUtils.getLockoutAttemptDeadline();
|
long deadline = mLockPatternUtils.getLockoutAttemptDeadline(UserHandle.myUserId());
|
||||||
if (deadline != 0) {
|
if (deadline != 0) {
|
||||||
handleAttemptLockout(deadline);
|
handleAttemptLockout(deadline);
|
||||||
} else if (!mLockPatternView.isEnabled()) {
|
} else if (!mLockPatternView.isEnabled()) {
|
||||||
@@ -276,13 +277,14 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
if (getActivity() instanceof ConfirmLockPattern.InternalActivity) {
|
if (getActivity() instanceof ConfirmLockPattern.InternalActivity) {
|
||||||
long challenge = getActivity().getIntent().getLongExtra(
|
long challenge = getActivity().getIntent().getLongExtra(
|
||||||
ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0);
|
ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE, 0);
|
||||||
byte[] token = mLockPatternUtils.verifyPattern(pattern, challenge);
|
byte[] token = mLockPatternUtils.verifyPattern(pattern, challenge,
|
||||||
|
UserHandle.myUserId());
|
||||||
if (token != null) {
|
if (token != null) {
|
||||||
matched = true;
|
matched = true;
|
||||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token);
|
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mLockPatternUtils.checkPattern(pattern)) {
|
} else if (mLockPatternUtils.checkPattern(pattern, UserHandle.myUserId())) {
|
||||||
matched = true;
|
matched = true;
|
||||||
if (getActivity() instanceof ConfirmLockPattern.InternalActivity) {
|
if (getActivity() instanceof ConfirmLockPattern.InternalActivity) {
|
||||||
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_TYPE,
|
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_TYPE,
|
||||||
@@ -300,7 +302,8 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
|||||||
if (pattern.size() >= LockPatternUtils.MIN_PATTERN_REGISTER_FAIL &&
|
if (pattern.size() >= LockPatternUtils.MIN_PATTERN_REGISTER_FAIL &&
|
||||||
++mNumWrongConfirmAttempts
|
++mNumWrongConfirmAttempts
|
||||||
>= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) {
|
>= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) {
|
||||||
long deadline = mLockPatternUtils.setLockoutAttemptDeadline();
|
long deadline = mLockPatternUtils.setLockoutAttemptDeadline(
|
||||||
|
UserHandle.myUserId());
|
||||||
handleAttemptLockout(deadline);
|
handleAttemptLockout(deadline);
|
||||||
} else {
|
} else {
|
||||||
updateStage(Stage.NeedToUnlockWrong);
|
updateStage(Stage.NeedToUnlockWrong);
|
||||||
|
@@ -200,7 +200,8 @@ public final class CredentialStorage extends Activity {
|
|||||||
* Returns true if the currently set key guard matches our minimum quality requirements.
|
* Returns true if the currently set key guard matches our minimum quality requirements.
|
||||||
*/
|
*/
|
||||||
private boolean checkKeyGuardQuality() {
|
private boolean checkKeyGuardQuality() {
|
||||||
int quality = new LockPatternUtils(this).getActivePasswordQuality();
|
int quality = new LockPatternUtils(this).getActivePasswordQuality(
|
||||||
|
UserHandle.myUserId());
|
||||||
return (quality >= MIN_PASSWORD_QUALITY);
|
return (quality >= MIN_PASSWORD_QUALITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -120,8 +120,10 @@ public class CryptKeeperConfirm extends InstrumentedFragment {
|
|||||||
|
|
||||||
// 1. The owner info.
|
// 1. The owner info.
|
||||||
LockPatternUtils utils = new LockPatternUtils(getActivity());
|
LockPatternUtils utils = new LockPatternUtils(getActivity());
|
||||||
utils.setVisiblePatternEnabled(utils.isVisiblePatternEnabled());
|
utils.setVisiblePatternEnabled(
|
||||||
if (utils.isOwnerInfoEnabled()) {
|
utils.isVisiblePatternEnabled(UserHandle.USER_OWNER),
|
||||||
|
UserHandle.USER_OWNER);
|
||||||
|
if (utils.isOwnerInfoEnabled(UserHandle.USER_OWNER)) {
|
||||||
utils.setOwnerInfo(utils.getOwnerInfo(UserHandle.USER_OWNER),
|
utils.setOwnerInfo(utils.getOwnerInfo(UserHandle.USER_OWNER),
|
||||||
UserHandle.USER_OWNER);
|
UserHandle.USER_OWNER);
|
||||||
}
|
}
|
||||||
|
@@ -27,6 +27,7 @@ import android.content.IntentFilter;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.BatteryManager;
|
import android.os.BatteryManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.os.storage.StorageManager;
|
import android.os.storage.StorageManager;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@@ -160,7 +161,7 @@ public class CryptKeeperSettings extends InstrumentedFragment {
|
|||||||
Resources res = getActivity().getResources();
|
Resources res = getActivity().getResources();
|
||||||
ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(getActivity(), this);
|
ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(getActivity(), this);
|
||||||
|
|
||||||
if (helper.utils().getKeyguardStoredPasswordQuality()
|
if (helper.utils().getKeyguardStoredPasswordQuality(UserHandle.myUserId())
|
||||||
== DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
|
== DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
|
||||||
showFinalConfirmation(StorageManager.CRYPT_TYPE_DEFAULT, "");
|
showFinalConfirmation(StorageManager.CRYPT_TYPE_DEFAULT, "");
|
||||||
return true;
|
return true;
|
||||||
|
@@ -33,6 +33,7 @@ import android.content.DialogInterface;
|
|||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -149,7 +150,7 @@ public class EncryptionInterstitial extends SettingsActivity {
|
|||||||
switch(dialogId) {
|
switch(dialogId) {
|
||||||
case ACCESSIBILITY_WARNING_DIALOG: {
|
case ACCESSIBILITY_WARNING_DIALOG: {
|
||||||
final int quality = new LockPatternUtils(getActivity())
|
final int quality = new LockPatternUtils(getActivity())
|
||||||
.getKeyguardStoredPasswordQuality();
|
.getKeyguardStoredPasswordQuality(UserHandle.myUserId());
|
||||||
final int titleId;
|
final int titleId;
|
||||||
final int messageId;
|
final int messageId;
|
||||||
switch (quality) {
|
switch (quality) {
|
||||||
|
@@ -101,7 +101,7 @@ public class OwnerInfoSettings extends DialogFragment implements OnClickListener
|
|||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
if (which == AlertDialog.BUTTON_POSITIVE) {
|
if (which == AlertDialog.BUTTON_POSITIVE) {
|
||||||
String info = mOwnerInfo.getText().toString();
|
String info = mOwnerInfo.getText().toString();
|
||||||
mLockPatternUtils.setOwnerInfoEnabled(!TextUtils.isEmpty(info));
|
mLockPatternUtils.setOwnerInfoEnabled(!TextUtils.isEmpty(info), mUserId);
|
||||||
mLockPatternUtils.setOwnerInfo(info, mUserId);
|
mLockPatternUtils.setOwnerInfo(info, mUserId);
|
||||||
|
|
||||||
if (getTargetFragment() instanceof SecuritySettings) {
|
if (getTargetFragment() instanceof SecuritySettings) {
|
||||||
|
@@ -20,6 +20,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.Preference.OnPreferenceChangeListener;
|
import android.preference.Preference.OnPreferenceChangeListener;
|
||||||
import android.preference.PreferenceScreen;
|
import android.preference.PreferenceScreen;
|
||||||
@@ -103,8 +104,9 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
|
|||||||
private boolean setScreenLockUsed(boolean isEnabled) {
|
private boolean setScreenLockUsed(boolean isEnabled) {
|
||||||
if (isEnabled) {
|
if (isEnabled) {
|
||||||
LockPatternUtils lockPatternUtils = new LockPatternUtils(getActivity());
|
LockPatternUtils lockPatternUtils = new LockPatternUtils(getActivity());
|
||||||
if (lockPatternUtils.getKeyguardStoredPasswordQuality()
|
int passwordQuality = lockPatternUtils
|
||||||
== DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
|
.getKeyguardStoredPasswordQuality(UserHandle.myUserId());
|
||||||
|
if (passwordQuality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
|
||||||
Intent chooseLockIntent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD);
|
Intent chooseLockIntent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD);
|
||||||
chooseLockIntent.putExtra(
|
chooseLockIntent.putExtra(
|
||||||
ChooseLockGeneric.ChooseLockGenericFragment.MINIMUM_QUALITY_KEY,
|
ChooseLockGeneric.ChooseLockGenericFragment.MINIMUM_QUALITY_KEY,
|
||||||
@@ -123,7 +125,8 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
|
|||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
if (requestCode == CHANGE_LOCK_METHOD_REQUEST) {
|
if (requestCode == CHANGE_LOCK_METHOD_REQUEST) {
|
||||||
LockPatternUtils lockPatternUtils = new LockPatternUtils(getActivity());
|
LockPatternUtils lockPatternUtils = new LockPatternUtils(getActivity());
|
||||||
boolean validPassQuality = lockPatternUtils.getKeyguardStoredPasswordQuality()
|
boolean validPassQuality = lockPatternUtils.getKeyguardStoredPasswordQuality(
|
||||||
|
UserHandle.myUserId())
|
||||||
!= DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
|
!= DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
|
||||||
setScreenLockUsed(validPassQuality);
|
setScreenLockUsed(validPassQuality);
|
||||||
// Make sure the screen updates.
|
// Make sure the screen updates.
|
||||||
@@ -132,7 +135,8 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getCurrentSecurityTitle() {
|
private int getCurrentSecurityTitle() {
|
||||||
int quality = mLockPatternUtils.getKeyguardStoredPasswordQuality();
|
int quality = mLockPatternUtils.getKeyguardStoredPasswordQuality(
|
||||||
|
UserHandle.myUserId());
|
||||||
switch (quality) {
|
switch (quality) {
|
||||||
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
|
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
|
||||||
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
|
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
|
||||||
@@ -142,7 +146,7 @@ public class ScreenPinningSettings extends SettingsPreferenceFragment
|
|||||||
case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX:
|
case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX:
|
||||||
return R.string.screen_pinning_unlock_password;
|
return R.string.screen_pinning_unlock_password;
|
||||||
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
|
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
|
||||||
if (mLockPatternUtils.isLockPatternEnabled()) {
|
if (mLockPatternUtils.isLockPatternEnabled(UserHandle.myUserId())) {
|
||||||
return R.string.screen_pinning_unlock_pattern;
|
return R.string.screen_pinning_unlock_pattern;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -111,6 +111,8 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
// Only allow one trust agent on the platform.
|
// Only allow one trust agent on the platform.
|
||||||
private static final boolean ONLY_ONE_TRUST_AGENT = true;
|
private static final boolean ONLY_ONE_TRUST_AGENT = true;
|
||||||
|
|
||||||
|
private static final int MY_USER_ID = UserHandle.myUserId();
|
||||||
|
|
||||||
private DevicePolicyManager mDPM;
|
private DevicePolicyManager mDPM;
|
||||||
private SubscriptionManager mSubscriptionManager;
|
private SubscriptionManager mSubscriptionManager;
|
||||||
|
|
||||||
@@ -160,14 +162,14 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
private static int getResIdForLockUnlockScreen(Context context,
|
private static int getResIdForLockUnlockScreen(Context context,
|
||||||
LockPatternUtils lockPatternUtils) {
|
LockPatternUtils lockPatternUtils) {
|
||||||
int resid = 0;
|
int resid = 0;
|
||||||
if (!lockPatternUtils.isSecure()) {
|
if (!lockPatternUtils.isSecure(MY_USER_ID)) {
|
||||||
if (lockPatternUtils.isLockScreenDisabled()) {
|
if (lockPatternUtils.isLockScreenDisabled(MY_USER_ID)) {
|
||||||
resid = R.xml.security_settings_lockscreen;
|
resid = R.xml.security_settings_lockscreen;
|
||||||
} else {
|
} else {
|
||||||
resid = R.xml.security_settings_chooser;
|
resid = R.xml.security_settings_chooser;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (lockPatternUtils.getKeyguardStoredPasswordQuality()) {
|
switch (lockPatternUtils.getKeyguardStoredPasswordQuality(MY_USER_ID)) {
|
||||||
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
|
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
|
||||||
resid = R.xml.security_settings_pattern;
|
resid = R.xml.security_settings_pattern;
|
||||||
break;
|
break;
|
||||||
@@ -204,7 +206,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
addPreferencesFromResource(resid);
|
addPreferencesFromResource(resid);
|
||||||
|
|
||||||
// Add options for device encryption
|
// Add options for device encryption
|
||||||
mIsPrimary = UserHandle.myUserId() == UserHandle.USER_OWNER;
|
mIsPrimary = MY_USER_ID == UserHandle.USER_OWNER;
|
||||||
|
|
||||||
mOwnerInfoPref = findPreference(KEY_OWNER_INFO_SETTINGS);
|
mOwnerInfoPref = findPreference(KEY_OWNER_INFO_SETTINGS);
|
||||||
if (mOwnerInfoPref != null) {
|
if (mOwnerInfoPref != null) {
|
||||||
@@ -304,7 +306,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
mToggleAppInstallation.setChecked(isNonMarketAppsAllowed());
|
mToggleAppInstallation.setChecked(isNonMarketAppsAllowed());
|
||||||
// Side loading of apps.
|
// Side loading of apps.
|
||||||
// Disable for restricted profiles. For others, check if policy disallows it.
|
// Disable for restricted profiles. For others, check if policy disallows it.
|
||||||
mToggleAppInstallation.setEnabled(!um.getUserInfo(UserHandle.myUserId()).isRestricted());
|
mToggleAppInstallation.setEnabled(!um.getUserInfo(MY_USER_ID).isRestricted());
|
||||||
if (um.hasUserRestriction(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES)
|
if (um.hasUserRestriction(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES)
|
||||||
|| um.hasUserRestriction(UserManager.DISALLOW_INSTALL_APPS)) {
|
|| um.hasUserRestriction(UserManager.DISALLOW_INSTALL_APPS)) {
|
||||||
mToggleAppInstallation.setEnabled(false);
|
mToggleAppInstallation.setEnabled(false);
|
||||||
@@ -315,7 +317,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
(PreferenceGroup)root.findPreference(KEY_ADVANCED_SECURITY);
|
(PreferenceGroup)root.findPreference(KEY_ADVANCED_SECURITY);
|
||||||
if (advancedCategory != null) {
|
if (advancedCategory != null) {
|
||||||
Preference manageAgents = advancedCategory.findPreference(KEY_MANAGE_TRUST_AGENTS);
|
Preference manageAgents = advancedCategory.findPreference(KEY_MANAGE_TRUST_AGENTS);
|
||||||
if (manageAgents != null && !mLockPatternUtils.isSecure()) {
|
if (manageAgents != null && !mLockPatternUtils.isSecure(MY_USER_ID)) {
|
||||||
manageAgents.setEnabled(false);
|
manageAgents.setEnabled(false);
|
||||||
manageAgents.setSummary(R.string.disabled_because_no_backup_security);
|
manageAgents.setSummary(R.string.disabled_because_no_backup_security);
|
||||||
}
|
}
|
||||||
@@ -348,7 +350,8 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
final List<Fingerprint> items = fpm.getEnrolledFingerprints();
|
final List<Fingerprint> items = fpm.getEnrolledFingerprints();
|
||||||
final int fingerprintCount = items != null ? items.size() : 0;
|
final int fingerprintCount = items != null ? items.size() : 0;
|
||||||
final String clazz;
|
final String clazz;
|
||||||
boolean hasPassword = mChooseLockSettingsHelper.utils().getActivePasswordQuality()
|
boolean hasPassword = mChooseLockSettingsHelper.utils().getActivePasswordQuality(
|
||||||
|
MY_USER_ID)
|
||||||
!= DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
|
!= DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
|
||||||
if (fingerprintCount > 0) {
|
if (fingerprintCount > 0) {
|
||||||
fingerprintPreference.setSummary(getResources().getQuantityString(
|
fingerprintPreference.setSummary(getResources().getQuantityString(
|
||||||
@@ -368,7 +371,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addTrustAgentSettings(PreferenceGroup securityCategory) {
|
private void addTrustAgentSettings(PreferenceGroup securityCategory) {
|
||||||
final boolean hasSecurity = mLockPatternUtils.isSecure();
|
final boolean hasSecurity = mLockPatternUtils.isSecure(MY_USER_ID);
|
||||||
ArrayList<TrustAgentComponentInfo> agents =
|
ArrayList<TrustAgentComponentInfo> agents =
|
||||||
getActiveTrustAgents(getPackageManager(), mLockPatternUtils, mDPM);
|
getActiveTrustAgents(getPackageManager(), mLockPatternUtils, mDPM);
|
||||||
for (int i = 0; i < agents.size(); i++) {
|
for (int i = 0; i < agents.size(); i++) {
|
||||||
@@ -438,7 +441,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
ArrayList<TrustAgentComponentInfo> result = new ArrayList<TrustAgentComponentInfo>();
|
ArrayList<TrustAgentComponentInfo> result = new ArrayList<TrustAgentComponentInfo>();
|
||||||
List<ResolveInfo> resolveInfos = pm.queryIntentServices(TRUST_AGENT_INTENT,
|
List<ResolveInfo> resolveInfos = pm.queryIntentServices(TRUST_AGENT_INTENT,
|
||||||
PackageManager.GET_META_DATA);
|
PackageManager.GET_META_DATA);
|
||||||
List<ComponentName> enabledTrustAgents = utils.getEnabledTrustAgents();
|
List<ComponentName> enabledTrustAgents = utils.getEnabledTrustAgents(MY_USER_ID);
|
||||||
|
|
||||||
boolean disableTrustAgents = (dpm.getKeyguardDisabledFeatures(null)
|
boolean disableTrustAgents = (dpm.getKeyguardDisabledFeatures(null)
|
||||||
& DevicePolicyManager.KEYGUARD_DISABLE_TRUST_AGENTS) != 0;
|
& DevicePolicyManager.KEYGUARD_DISABLE_TRUST_AGENTS) != 0;
|
||||||
@@ -597,10 +600,12 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils();
|
final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils();
|
||||||
if (mVisiblePattern != null) {
|
if (mVisiblePattern != null) {
|
||||||
mVisiblePattern.setChecked(lockPatternUtils.isVisiblePatternEnabled());
|
mVisiblePattern.setChecked(lockPatternUtils.isVisiblePatternEnabled(
|
||||||
|
MY_USER_ID));
|
||||||
}
|
}
|
||||||
if (mPowerButtonInstantlyLocks != null) {
|
if (mPowerButtonInstantlyLocks != null) {
|
||||||
mPowerButtonInstantlyLocks.setChecked(lockPatternUtils.getPowerButtonInstantlyLocks());
|
mPowerButtonInstantlyLocks.setChecked(lockPatternUtils.getPowerButtonInstantlyLocks(
|
||||||
|
MY_USER_ID));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mShowPassword != null) {
|
if (mShowPassword != null) {
|
||||||
@@ -617,8 +622,8 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
public void updateOwnerInfo() {
|
public void updateOwnerInfo() {
|
||||||
if (mOwnerInfoPref != null) {
|
if (mOwnerInfoPref != null) {
|
||||||
mOwnerInfoPref.setSummary(mLockPatternUtils.isOwnerInfoEnabled()
|
mOwnerInfoPref.setSummary(mLockPatternUtils.isOwnerInfoEnabled(MY_USER_ID)
|
||||||
? mLockPatternUtils.getOwnerInfo(UserHandle.myUserId())
|
? mLockPatternUtils.getOwnerInfo(MY_USER_ID)
|
||||||
: getString(R.string.owner_info_settings_summary));
|
: getString(R.string.owner_info_settings_summary));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -678,9 +683,9 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
updateLockAfterPreferenceSummary();
|
updateLockAfterPreferenceSummary();
|
||||||
} else if (KEY_VISIBLE_PATTERN.equals(key)) {
|
} else if (KEY_VISIBLE_PATTERN.equals(key)) {
|
||||||
lockPatternUtils.setVisiblePatternEnabled((Boolean) value);
|
lockPatternUtils.setVisiblePatternEnabled((Boolean) value, MY_USER_ID);
|
||||||
} else if (KEY_POWER_INSTANTLY_LOCKS.equals(key)) {
|
} else if (KEY_POWER_INSTANTLY_LOCKS.equals(key)) {
|
||||||
mLockPatternUtils.setPowerButtonInstantlyLocks((Boolean) value);
|
mLockPatternUtils.setPowerButtonInstantlyLocks((Boolean) value, MY_USER_ID);
|
||||||
} else if (KEY_SHOW_PASSWORD.equals(key)) {
|
} else if (KEY_SHOW_PASSWORD.equals(key)) {
|
||||||
Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD,
|
Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD,
|
||||||
((Boolean) value) ? 1 : 0);
|
((Boolean) value) ? 1 : 0);
|
||||||
@@ -715,7 +720,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
public SecuritySearchIndexProvider() {
|
public SecuritySearchIndexProvider() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
mIsPrimary = UserHandle.myUserId() == UserHandle.USER_OWNER;
|
mIsPrimary = MY_USER_ID == UserHandle.USER_OWNER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -800,7 +805,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
// Advanced
|
// Advanced
|
||||||
final LockPatternUtils lockPatternUtils = new LockPatternUtils(context);
|
final LockPatternUtils lockPatternUtils = new LockPatternUtils(context);
|
||||||
if (lockPatternUtils.isSecure()) {
|
if (lockPatternUtils.isSecure(MY_USER_ID)) {
|
||||||
ArrayList<TrustAgentComponentInfo> agents =
|
ArrayList<TrustAgentComponentInfo> agents =
|
||||||
getActiveTrustAgents(context.getPackageManager(), lockPatternUtils,
|
getActiveTrustAgents(context.getPackageManager(), lockPatternUtils,
|
||||||
context.getSystemService(DevicePolicyManager.class));
|
context.getSystemService(DevicePolicyManager.class));
|
||||||
@@ -835,7 +840,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TrustAgent settings disappear when the user has no primary security.
|
// TrustAgent settings disappear when the user has no primary security.
|
||||||
if (!lockPatternUtils.isSecure()) {
|
if (!lockPatternUtils.isSecure(MY_USER_ID)) {
|
||||||
keys.add(KEY_TRUST_AGENT);
|
keys.add(KEY_TRUST_AGENT);
|
||||||
keys.add(KEY_MANAGE_TRUST_AGENTS);
|
keys.add(KEY_MANAGE_TRUST_AGENTS);
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,7 @@ import android.content.pm.PackageManager;
|
|||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceGroup;
|
import android.preference.PreferenceGroup;
|
||||||
import android.preference.SwitchPreference;
|
import android.preference.SwitchPreference;
|
||||||
@@ -120,14 +121,16 @@ public class TrustAgentSettings extends SettingsPreferenceFragment implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void loadActiveAgents() {
|
private void loadActiveAgents() {
|
||||||
List<ComponentName> activeTrustAgents = mLockPatternUtils.getEnabledTrustAgents();
|
List<ComponentName> activeTrustAgents = mLockPatternUtils.getEnabledTrustAgents(
|
||||||
|
UserHandle.myUserId());
|
||||||
if (activeTrustAgents != null) {
|
if (activeTrustAgents != null) {
|
||||||
mActiveAgents.addAll(activeTrustAgents);
|
mActiveAgents.addAll(activeTrustAgents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveActiveAgents() {
|
private void saveActiveAgents() {
|
||||||
mLockPatternUtils.setEnabledTrustAgents(mActiveAgents);
|
mLockPatternUtils.setEnabledTrustAgents(mActiveAgents,
|
||||||
|
UserHandle.myUserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayMap<ComponentName, AgentInfo> findAvailableTrustAgents() {
|
ArrayMap<ComponentName, AgentInfo> findAvailableTrustAgents() {
|
||||||
|
@@ -29,6 +29,7 @@ import android.content.pm.ResolveInfo;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -368,7 +369,7 @@ public class ToggleAccessibilityServicePreferenceFragment
|
|||||||
|
|
||||||
private String createConfirmCredentialReasonMessage() {
|
private String createConfirmCredentialReasonMessage() {
|
||||||
int resId = R.string.enable_service_password_reason;
|
int resId = R.string.enable_service_password_reason;
|
||||||
switch (mLockPatternUtils.getKeyguardStoredPasswordQuality()) {
|
switch (mLockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId())) {
|
||||||
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING: {
|
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING: {
|
||||||
resId = R.string.enable_service_pattern_reason;
|
resId = R.string.enable_service_pattern_reason;
|
||||||
} break;
|
} break;
|
||||||
|
@@ -26,6 +26,7 @@ import android.content.pm.PackageManager;
|
|||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.Preference.OnPreferenceChangeListener;
|
import android.preference.Preference.OnPreferenceChangeListener;
|
||||||
import android.preference.SwitchPreference;
|
import android.preference.SwitchPreference;
|
||||||
@@ -191,7 +192,8 @@ public class AppNotificationSettings extends SettingsPreferenceFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateDependents(boolean banned) {
|
private void updateDependents(boolean banned) {
|
||||||
final boolean lockscreenSecure = new LockPatternUtils(getActivity()).isSecure();
|
final boolean lockscreenSecure = new LockPatternUtils(getActivity()).isSecure(
|
||||||
|
UserHandle.myUserId());
|
||||||
final boolean lockscreenNotificationsEnabled = getLockscreenNotificationsEnabled();
|
final boolean lockscreenNotificationsEnabled = getLockscreenNotificationsEnabled();
|
||||||
final boolean allowPrivate = getLockscreenAllowPrivateNotifications();
|
final boolean allowPrivate = getLockscreenAllowPrivateNotifications();
|
||||||
|
|
||||||
|
@@ -36,6 +36,7 @@ import android.os.Bundle;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.Preference.OnPreferenceChangeListener;
|
import android.preference.Preference.OnPreferenceChangeListener;
|
||||||
@@ -116,7 +117,7 @@ public class NotificationSettings extends SettingsPreferenceFragment implements
|
|||||||
mContext = getActivity();
|
mContext = getActivity();
|
||||||
mPM = mContext.getPackageManager();
|
mPM = mContext.getPackageManager();
|
||||||
mVoiceCapable = Utils.isVoiceCapable(mContext);
|
mVoiceCapable = Utils.isVoiceCapable(mContext);
|
||||||
mSecure = new LockPatternUtils(getActivity()).isSecure();
|
mSecure = new LockPatternUtils(getActivity()).isSecure(UserHandle.myUserId());
|
||||||
|
|
||||||
mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
|
mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
|
||||||
mVibrator = (Vibrator) getActivity().getSystemService(Context.VIBRATOR_SERVICE);
|
mVibrator = (Vibrator) getActivity().getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
|
@@ -357,7 +357,7 @@ public class UserSettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
private boolean hasLockscreenSecurity() {
|
private boolean hasLockscreenSecurity() {
|
||||||
LockPatternUtils lpu = new LockPatternUtils(getActivity());
|
LockPatternUtils lpu = new LockPatternUtils(getActivity());
|
||||||
return lpu.isLockPasswordEnabled() || lpu.isLockPatternEnabled();
|
return lpu.isSecure(UserHandle.myUserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void launchChooseLockscreen() {
|
private void launchChooseLockscreen() {
|
||||||
|
Reference in New Issue
Block a user