Update work profile app lock to latest spec
* Updated text and description for PIN, password and pattern * Added enterprise logo to work profile lock Bug: 141290838 Test: Manual testing atest com.android.systemui.biometrics.AuthBiometricViewTest atest com.android.systemui.biometrics.AuthContainerViewTest Change-Id: Iac6c9ca15e7446cbd7cce9fc1a1ac4e1c867bf31
This commit is contained in:
@@ -688,6 +688,15 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
return um.getCredentialOwnerProfile(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the credential type of the given user id.
|
||||
*/
|
||||
public static @LockPatternUtils.CredentialType int getCredentialType(Context context,
|
||||
int userId) {
|
||||
final LockPatternUtils lpu = new LockPatternUtils(context);
|
||||
return lpu.getCredentialTypeForUser(userId);
|
||||
}
|
||||
|
||||
private static final StringBuilder sBuilder = new StringBuilder(50);
|
||||
private static final java.util.Formatter sFormatter = new java.util.Formatter(
|
||||
sBuilder, Locale.getDefault());
|
||||
|
@@ -182,6 +182,15 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
if ((mTitle == null) && isManagedProfile) {
|
||||
mTitle = getTitleFromOrganizationName(mUserId);
|
||||
}
|
||||
final @LockPatternUtils.CredentialType int credentialType = Utils.getCredentialType(
|
||||
mContext, effectiveUserId);
|
||||
if (mTitle == null) {
|
||||
mTitle = getTitleFromCredentialType(credentialType, isManagedProfile);
|
||||
}
|
||||
if (mDetails == null) {
|
||||
mDetails = getDetailsFromCredentialType(credentialType, isManagedProfile);
|
||||
}
|
||||
|
||||
mChooseLockSettingsHelper = new ChooseLockSettingsHelper(this);
|
||||
final LockPatternUtils lockPatternUtils = new LockPatternUtils(this);
|
||||
|
||||
@@ -233,6 +242,44 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private String getTitleFromCredentialType(@LockPatternUtils.CredentialType int credentialType,
|
||||
boolean isManagedProfile) {
|
||||
switch (credentialType) {
|
||||
case LockPatternUtils.CREDENTIAL_TYPE_PIN:
|
||||
return isManagedProfile
|
||||
? getString(R.string.lockpassword_confirm_your_work_pin_header)
|
||||
: getString(R.string.lockpassword_confirm_your_pin_header);
|
||||
case LockPatternUtils.CREDENTIAL_TYPE_PATTERN:
|
||||
return isManagedProfile
|
||||
? getString(R.string.lockpassword_confirm_your_work_pattern_header)
|
||||
: getString(R.string.lockpassword_confirm_your_pattern_header);
|
||||
case LockPatternUtils.CREDENTIAL_TYPE_PASSWORD:
|
||||
return isManagedProfile
|
||||
? getString(R.string.lockpassword_confirm_your_work_password_header)
|
||||
: getString(R.string.lockpassword_confirm_your_password_header);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getDetailsFromCredentialType(@LockPatternUtils.CredentialType int credentialType,
|
||||
boolean isManagedProfile) {
|
||||
switch (credentialType) {
|
||||
case LockPatternUtils.CREDENTIAL_TYPE_PIN:
|
||||
return isManagedProfile
|
||||
? getString(R.string.lockpassword_confirm_your_pin_generic_profile)
|
||||
: getString(R.string.lockpassword_confirm_your_pin_generic);
|
||||
case LockPatternUtils.CREDENTIAL_TYPE_PATTERN:
|
||||
return isManagedProfile
|
||||
? getString(R.string.lockpassword_confirm_your_pattern_generic_profile)
|
||||
: getString(R.string.lockpassword_confirm_your_pattern_generic);
|
||||
case LockPatternUtils.CREDENTIAL_TYPE_PASSWORD:
|
||||
return isManagedProfile
|
||||
? getString(R.string.lockpassword_confirm_your_password_generic_profile)
|
||||
: getString(R.string.lockpassword_confirm_your_password_generic);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
Reference in New Issue
Block a user