Merge "[Settings] Add a verification flow for exiting repair mode" into udc-qpr-dev am: e1c9d65cda
am: 721a7bacaa
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/23629341 Change-Id: If01a1c5c13433e85f9b91790375dc2f297777dd7 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -2398,6 +2398,7 @@
|
||||
<action android:name="android.app.action.CONFIRM_DEVICE_CREDENTIAL" />
|
||||
<action android:name="android.app.action.CONFIRM_FRP_CREDENTIAL" />
|
||||
<action android:name="android.app.action.PREPARE_REPAIR_MODE_DEVICE_CREDENTIAL" />
|
||||
<action android:name="android.app.action.CONFIRM_REPAIR_MODE_DEVICE_CREDENTIAL" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
@@ -3501,6 +3501,18 @@
|
||||
<!-- Checkbox label to set password as new screen lock if remote device credential validation succeeds. [CHAR LIMIT=43] -->
|
||||
<string name="lockpassword_remote_validation_set_password_as_screenlock">Also use password to unlock this device</string>
|
||||
|
||||
<!-- Header shown when pattern needs to be solved before the device exits repair mode. [CHAR LIMIT=100] [DO NOT TRANSLATE] TODO(b/275677027): update with finalized UX string -->
|
||||
<string name="lockpassword_confirm_repair_mode_pattern_header">Verify pattern</string>
|
||||
<!-- Header shown when the pin needs to be solved before the device exits repair mode. [CHAR LIMIT=100] [DO NOT TRANSLATE] TODO(b/275677027): update with finalized UX string -->
|
||||
<string name="lockpassword_confirm_repair_mode_pin_header">Verify PIN</string>
|
||||
<!-- Header shown when the password needs to be solved before the device exits repair mode. [CHAR LIMIT=100] [DO NOT TRANSLATE] TODO(b/275677027): update with finalized UX string -->
|
||||
<string name="lockpassword_confirm_repair_mode_password_header">Verify password</string>
|
||||
<!-- An explanation text that the pattern needs to be solved before the device exits repair mode. [CHAR LIMIT=100] [DO NOT TRANSLATE] TODO(b/275677027): update with finalized UX string -->
|
||||
<string name="lockpassword_confirm_repair_mode_pattern_details" translatable="false">Enter your device pattern enrolled in normal mode to continue</string>
|
||||
<!-- An explanation text that the PIN needs to be solved before the device exits repair mode. [CHAR LIMIT=100] [DO NOT TRANSLATE] TODO(b/275677027): update with finalized UX string -->
|
||||
<string name="lockpassword_confirm_repair_mode_pin_details" translatable="false">Enter your device PIN enrolled in normal mode to continue</string>
|
||||
<!-- An explanation text that the password needs to be solved before the device exits repair mode. [CHAR LIMIT=100] [DO NOT TRANSLATE] TODO(b/275677027): update with finalized UX string -->
|
||||
<string name="lockpassword_confirm_repair_mode_password_details" translatable="false">Enter your device password enrolled in normal mode to continue</string>
|
||||
|
||||
<!-- Security & location settings screen, change security method screen instruction if user
|
||||
enters incorrect PIN [CHAR LIMIT=30] -->
|
||||
|
@@ -708,9 +708,13 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
final int userId = bundle.getInt(Intent.EXTRA_USER_ID, UserHandle.myUserId());
|
||||
if (userId == LockPatternUtils.USER_FRP) {
|
||||
return allowAnyUser ? userId : checkUserOwnsFrpCredential(context, userId);
|
||||
} else {
|
||||
return allowAnyUser ? userId : enforceSameOwner(context, userId);
|
||||
}
|
||||
if (userId == LockPatternUtils.USER_REPAIR_MODE) {
|
||||
enforceRepairModeActive(context);
|
||||
// any users can exit repair mode
|
||||
return userId;
|
||||
}
|
||||
return allowAnyUser ? userId : enforceSameOwner(context, userId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -729,6 +733,16 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
+ " does not own frp credential.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws {@link SecurityException} if repair mode is not active on the device.
|
||||
*/
|
||||
private static void enforceRepairModeActive(Context context) {
|
||||
if (LockPatternUtils.isRepairModeActive(context)) {
|
||||
return;
|
||||
}
|
||||
throw new SecurityException("Repair mode is not active on the device.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the given user id if it belongs to the current user.
|
||||
*
|
||||
|
@@ -362,7 +362,8 @@ public final class ChooseLockSettingsHelper {
|
||||
}
|
||||
|
||||
@NonNull public ChooseLockSettingsHelper build() {
|
||||
if (!mAllowAnyUserId && mUserId != LockPatternUtils.USER_FRP) {
|
||||
if (!mAllowAnyUserId && mUserId != LockPatternUtils.USER_FRP
|
||||
&& mUserId != LockPatternUtils.USER_REPAIR_MODE) {
|
||||
Utils.enforceSameOwner(mActivity, mUserId);
|
||||
}
|
||||
|
||||
|
@@ -166,8 +166,12 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
mDetails = intent.getCharSequenceExtra(KeyguardManager.EXTRA_DESCRIPTION);
|
||||
String alternateButton = intent.getStringExtra(
|
||||
KeyguardManager.EXTRA_ALTERNATE_BUTTON_LABEL);
|
||||
boolean frp = KeyguardManager.ACTION_CONFIRM_FRP_CREDENTIAL.equals(intent.getAction());
|
||||
boolean remoteValidation =
|
||||
final boolean frp =
|
||||
KeyguardManager.ACTION_CONFIRM_FRP_CREDENTIAL.equals(intent.getAction());
|
||||
final boolean repairMode =
|
||||
KeyguardManager.ACTION_CONFIRM_REPAIR_MODE_DEVICE_CREDENTIAL
|
||||
.equals(intent.getAction());
|
||||
final boolean remoteValidation =
|
||||
KeyguardManager.ACTION_CONFIRM_REMOTE_DEVICE_CREDENTIAL.equals(intent.getAction());
|
||||
mTaskOverlay = isInternalActivity()
|
||||
&& intent.getBooleanExtra(KeyguardManager.EXTRA_FORCE_TASK_OVERLAY, false);
|
||||
@@ -222,6 +226,14 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
.setExternal(true)
|
||||
.setUserId(LockPatternUtils.USER_FRP)
|
||||
.show();
|
||||
} else if (repairMode) {
|
||||
final ChooseLockSettingsHelper.Builder builder =
|
||||
new ChooseLockSettingsHelper.Builder(this);
|
||||
launchedCDC = builder.setHeader(mTitle)
|
||||
.setDescription(mDetails)
|
||||
.setExternal(true)
|
||||
.setUserId(LockPatternUtils.USER_REPAIR_MODE)
|
||||
.show();
|
||||
} else if (remoteValidation) {
|
||||
RemoteLockscreenValidationSession remoteLockscreenValidationSession =
|
||||
intent.getParcelableExtra(
|
||||
|
@@ -106,6 +106,7 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends InstrumentedFr
|
||||
protected boolean mFrp;
|
||||
protected boolean mRemoteValidation;
|
||||
protected boolean mRequestWriteRepairModePassword;
|
||||
protected boolean mRepairMode;
|
||||
protected CharSequence mAlternateButtonText;
|
||||
protected BiometricManager mBiometricManager;
|
||||
@Nullable protected RemoteLockscreenValidationSession mRemoteLockscreenValidationSession;
|
||||
@@ -181,6 +182,7 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends InstrumentedFr
|
||||
mUserId = Utils.getUserIdFromBundle(getActivity(), intent.getExtras(),
|
||||
isInternalActivity());
|
||||
mFrp = (mUserId == LockPatternUtils.USER_FRP);
|
||||
mRepairMode = (mUserId == LockPatternUtils.USER_REPAIR_MODE);
|
||||
mUserManager = UserManager.get(getActivity());
|
||||
mEffectiveUserId = mUserManager.getCredentialOwnerProfile(mUserId);
|
||||
mLockPatternUtils = new LockPatternUtils(getActivity());
|
||||
@@ -269,7 +271,7 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends InstrumentedFr
|
||||
// verifyTiedProfileChallenge. In such case, we also wanna show the user message that
|
||||
// fingerprint is disabled due to device restart.
|
||||
protected boolean isStrongAuthRequired() {
|
||||
return mFrp
|
||||
return mFrp || mRepairMode
|
||||
|| !mLockPatternUtils.isBiometricAllowedForUser(mEffectiveUserId)
|
||||
|| !mUserManager.isUserUnlocked(mUserId);
|
||||
}
|
||||
|
@@ -284,6 +284,11 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
||||
return mIsAlpha ? getString(R.string.lockpassword_confirm_your_password_header_frp)
|
||||
: getString(R.string.lockpassword_confirm_your_pin_header_frp);
|
||||
}
|
||||
if (mRepairMode) {
|
||||
return mIsAlpha
|
||||
? getString(R.string.lockpassword_confirm_repair_mode_password_header)
|
||||
: getString(R.string.lockpassword_confirm_repair_mode_pin_header);
|
||||
}
|
||||
if (mRemoteValidation) {
|
||||
return getString(R.string.lockpassword_remote_validation_header);
|
||||
}
|
||||
@@ -307,6 +312,11 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
||||
return mIsAlpha ? getString(R.string.lockpassword_confirm_your_password_details_frp)
|
||||
: getString(R.string.lockpassword_confirm_your_pin_details_frp);
|
||||
}
|
||||
if (mRepairMode) {
|
||||
return mIsAlpha
|
||||
? getString(R.string.lockpassword_confirm_repair_mode_password_details)
|
||||
: getString(R.string.lockpassword_confirm_repair_mode_pin_details);
|
||||
}
|
||||
if (mRemoteValidation) {
|
||||
return getContext().getString(mIsAlpha
|
||||
? R.string.lockpassword_remote_validation_password_details
|
||||
|
@@ -179,7 +179,7 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
// ability to disable the pattern in L. Remove this block after
|
||||
// ensuring it's safe to do so. (Note that ConfirmLockPassword
|
||||
// doesn't have this).
|
||||
if (!mFrp && !mRemoteValidation
|
||||
if (!mFrp && !mRemoteValidation && !mRepairMode
|
||||
&& !mLockPatternUtils.isLockPatternEnabled(mEffectiveUserId)) {
|
||||
getActivity().setResult(Activity.RESULT_OK);
|
||||
getActivity().finish();
|
||||
@@ -308,6 +308,9 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
if (mFrp) {
|
||||
return getString(R.string.lockpassword_confirm_your_pattern_details_frp);
|
||||
}
|
||||
if (mRepairMode) {
|
||||
return getString(R.string.lockpassword_confirm_repair_mode_pattern_details);
|
||||
}
|
||||
if (mRemoteValidation) {
|
||||
return getString(
|
||||
R.string.lockpassword_remote_validation_pattern_details);
|
||||
@@ -402,7 +405,12 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
}
|
||||
|
||||
private String getDefaultHeader() {
|
||||
if (mFrp) return getString(R.string.lockpassword_confirm_your_pattern_header_frp);
|
||||
if (mFrp) {
|
||||
return getString(R.string.lockpassword_confirm_your_pattern_header_frp);
|
||||
}
|
||||
if (mRepairMode) {
|
||||
return getString(R.string.lockpassword_confirm_repair_mode_pattern_header);
|
||||
}
|
||||
if (mRemoteValidation) {
|
||||
return getString(R.string.lockpassword_remote_validation_header);
|
||||
}
|
||||
|
Reference in New Issue
Block a user