Merge Android 24Q1 Release (ab/11220357)
Bug: 319669529 Merged-In: If21ca5e914a5ee5aff3fbeeee9595bb77a8fc3d0 Change-Id: I87182e72d0ceb75499528f9011d009d772045e09
This commit is contained in:
@@ -126,10 +126,9 @@ public class BiometricFragment extends InstrumentedFragment {
|
||||
final Bundle bundle = getArguments();
|
||||
final PromptInfo promptInfo = bundle.getParcelable(KEY_PROMPT_INFO);
|
||||
|
||||
mBiometricPrompt = new BiometricPrompt.Builder(getContext())
|
||||
BiometricPrompt.Builder promptBuilder = new BiometricPrompt.Builder(getContext())
|
||||
.setTitle(promptInfo.getTitle())
|
||||
.setUseDefaultTitle() // use default title if title is null/empty
|
||||
.setUseDefaultSubtitle() // use default subtitle if subtitle is null/empty
|
||||
.setDeviceCredentialAllowed(true)
|
||||
.setSubtitle(promptInfo.getSubtitle())
|
||||
.setDescription(promptInfo.getDescription())
|
||||
@@ -140,9 +139,15 @@ public class BiometricFragment extends InstrumentedFragment {
|
||||
.setConfirmationRequired(promptInfo.isConfirmationRequested())
|
||||
.setDisallowBiometricsIfPolicyExists(
|
||||
promptInfo.isDisallowBiometricsIfPolicyExists())
|
||||
.setShowEmergencyCallButton(promptInfo.isShowEmergencyCallButton())
|
||||
.setReceiveSystemEvents(true)
|
||||
.setAllowBackgroundAuthentication(true)
|
||||
.build();
|
||||
.setAllowBackgroundAuthentication(true);
|
||||
|
||||
// Check if the default subtitle should be used if subtitle is null/empty
|
||||
if (promptInfo.isUseDefaultSubtitle()) {
|
||||
promptBuilder.setUseDefaultSubtitle();
|
||||
}
|
||||
mBiometricPrompt = promptBuilder.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -30,6 +30,8 @@ import static android.app.admin.DevicePolicyResources.Strings.Settings.WORK_PROF
|
||||
|
||||
import static com.android.settings.password.ChooseLockPassword.ChooseLockPasswordFragment.RESULT_FINISHED;
|
||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_CALLER_APP_NAME;
|
||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_CHOOSE_LOCK_SCREEN_DESCRIPTION;
|
||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_CHOOSE_LOCK_SCREEN_TITLE;
|
||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_DEVICE_PASSWORD_REQUIREMENT_ONLY;
|
||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_IS_CALLING_APP_ADMIN;
|
||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_REQUESTED_MIN_COMPLEXITY;
|
||||
@@ -86,6 +88,10 @@ import com.android.settingslib.widget.FooterPreference;
|
||||
|
||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||
|
||||
/**
|
||||
* Activity class that provides a generic implementation for displaying options to choose a lock
|
||||
* type, either for setting up a new lock or updating an existing lock.
|
||||
*/
|
||||
public class ChooseLockGeneric extends SettingsActivity {
|
||||
public static final String CONFIRM_CREDENTIALS = "confirm_credentials";
|
||||
|
||||
@@ -194,6 +200,8 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
protected boolean mForBiometrics = false;
|
||||
|
||||
private boolean mOnlyEnforceDevicePasswordRequirement = false;
|
||||
private int mExtraLockScreenTitleResId;
|
||||
private int mExtraLockScreenDescriptionResId;
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
@@ -242,6 +250,10 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
mForBiometrics = intent.getBooleanExtra(
|
||||
ChooseLockSettingsHelper.EXTRA_KEY_FOR_BIOMETRICS, false);
|
||||
|
||||
mExtraLockScreenTitleResId = intent.getIntExtra(EXTRA_KEY_CHOOSE_LOCK_SCREEN_TITLE, -1);
|
||||
mExtraLockScreenDescriptionResId =
|
||||
intent.getIntExtra(EXTRA_KEY_CHOOSE_LOCK_SCREEN_DESCRIPTION, -1);
|
||||
|
||||
mRequestedMinComplexity = intent.getIntExtra(
|
||||
EXTRA_KEY_REQUESTED_MIN_COMPLEXITY, PASSWORD_COMPLEXITY_NONE);
|
||||
mOnlyEnforceDevicePasswordRequirement = intent.getBooleanExtra(
|
||||
@@ -343,13 +355,19 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
if (updateExistingLock) {
|
||||
getActivity().setTitle(mDpm.getResources().getString(
|
||||
LOCK_SETTINGS_UPDATE_PROFILE_LOCK_TITLE,
|
||||
() -> getString(
|
||||
R.string.lock_settings_picker_update_profile_lock_title)));
|
||||
() -> getString(mExtraLockScreenTitleResId != -1
|
||||
? mExtraLockScreenTitleResId
|
||||
: R.string.lock_settings_picker_update_profile_lock_title)));
|
||||
} else {
|
||||
getActivity().setTitle(mDpm.getResources().getString(
|
||||
LOCK_SETTINGS_NEW_PROFILE_LOCK_TITLE,
|
||||
() -> getString(R.string.lock_settings_picker_new_profile_lock_title)));
|
||||
() -> getString(mExtraLockScreenTitleResId != -1
|
||||
? mExtraLockScreenTitleResId
|
||||
: R.string.lock_settings_picker_new_profile_lock_title)));
|
||||
}
|
||||
} else if (mExtraLockScreenTitleResId != -1) {
|
||||
// Show customized screen lock title if it is passed as an extra in the intent.
|
||||
getActivity().setTitle(mExtraLockScreenTitleResId);
|
||||
} else {
|
||||
updateExistingLock = mLockPatternUtils.isSecure(mUserId);
|
||||
if (updateExistingLock) {
|
||||
@@ -377,7 +395,16 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
setHeaderView(R.layout.choose_lock_generic_biometric_header);
|
||||
TextView textView = getHeaderView().findViewById(R.id.biometric_header_description);
|
||||
|
||||
if (mForFingerprint) {
|
||||
if (mIsManagedProfile) {
|
||||
textView.setText(mDpm.getResources().getString(
|
||||
WORK_PROFILE_SCREEN_LOCK_SETUP_MESSAGE,
|
||||
() -> getString(mExtraLockScreenDescriptionResId != -1
|
||||
? mExtraLockScreenDescriptionResId
|
||||
: R.string.lock_settings_picker_profile_message)));
|
||||
} else if (mExtraLockScreenDescriptionResId != -1) {
|
||||
// Show customized description in screen lock if passed as an extra in the intent.
|
||||
textView.setText(mExtraLockScreenDescriptionResId);
|
||||
} else if (mForFingerprint) {
|
||||
if (mIsSetNewPassword) {
|
||||
textView.setText(R.string.fingerprint_unlock_title);
|
||||
} else {
|
||||
@@ -396,13 +423,7 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
textView.setText(R.string.lock_settings_picker_biometric_message);
|
||||
}
|
||||
} else {
|
||||
if (mIsManagedProfile) {
|
||||
textView.setText(mDpm.getResources().getString(
|
||||
WORK_PROFILE_SCREEN_LOCK_SETUP_MESSAGE,
|
||||
() -> getString(R.string.lock_settings_picker_profile_message)));
|
||||
} else {
|
||||
textView.setText("");
|
||||
}
|
||||
textView.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,6 +447,8 @@ public class ChooseLockGeneric extends SettingsActivity {
|
||||
}
|
||||
// Forward the target user id to ChooseLockGeneric.
|
||||
chooseLockGenericIntent.putExtra(Intent.EXTRA_USER_ID, mUserId);
|
||||
chooseLockGenericIntent.putExtra(
|
||||
EXTRA_KEY_CHOOSE_LOCK_SCREEN_TITLE, mExtraLockScreenTitleResId);
|
||||
chooseLockGenericIntent.putExtra(CONFIRM_CREDENTIALS, !mPasswordConfirmed);
|
||||
chooseLockGenericIntent.putExtra(EXTRA_KEY_REQUESTED_MIN_COMPLEXITY,
|
||||
mRequestedMinComplexity);
|
||||
|
||||
@@ -497,7 +497,8 @@ public class ChooseLockPassword extends SettingsActivity {
|
||||
.setText(R.string.lockpassword_clear_label)
|
||||
.setListener(this::onSkipOrClearButtonClick)
|
||||
.setButtonType(FooterButton.ButtonType.SKIP)
|
||||
.setTheme(R.style.SudGlifButton_Secondary)
|
||||
.setTheme(
|
||||
com.google.android.setupdesign.R.style.SudGlifButton_Secondary)
|
||||
.build()
|
||||
);
|
||||
mixin.setPrimaryButton(
|
||||
@@ -505,7 +506,7 @@ public class ChooseLockPassword extends SettingsActivity {
|
||||
.setText(R.string.next_label)
|
||||
.setListener(this::onNextButtonClick)
|
||||
.setButtonType(FooterButton.ButtonType.NEXT)
|
||||
.setTheme(R.style.SudGlifButton_Primary)
|
||||
.setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary)
|
||||
.build()
|
||||
);
|
||||
mSkipOrClearButton = mixin.getSecondaryButton();
|
||||
@@ -519,7 +520,7 @@ public class ChooseLockPassword extends SettingsActivity {
|
||||
|| DevicePolicyManager.PASSWORD_QUALITY_COMPLEX == mPasswordType;
|
||||
|
||||
final LinearLayout headerLayout = view.findViewById(
|
||||
R.id.sud_layout_header);
|
||||
com.google.android.setupdesign.R.id.sud_layout_header);
|
||||
setupPasswordRequirementsView(headerLayout);
|
||||
|
||||
mPasswordRestrictionView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
|
||||
@@ -514,7 +514,8 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
.setText(R.string.lockpattern_tutorial_cancel_label)
|
||||
.setListener(this::onSkipOrClearButtonClick)
|
||||
.setButtonType(FooterButton.ButtonType.OTHER)
|
||||
.setTheme(R.style.SudGlifButton_Secondary)
|
||||
.setTheme(
|
||||
com.google.android.setupdesign.R.style.SudGlifButton_Secondary)
|
||||
.build()
|
||||
);
|
||||
mixin.setPrimaryButton(
|
||||
@@ -522,13 +523,14 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
.setText(R.string.lockpattern_tutorial_continue_label)
|
||||
.setListener(this::onNextButtonClick)
|
||||
.setButtonType(FooterButton.ButtonType.NEXT)
|
||||
.setTheme(R.style.SudGlifButton_Primary)
|
||||
.setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary)
|
||||
.build()
|
||||
);
|
||||
mSkipOrClearButton = mixin.getSecondaryButton();
|
||||
mNextButton = mixin.getPrimaryButton();
|
||||
// TODO(b/243008023) Workaround for Glif layout on 2 panel choose lock settings.
|
||||
mSudContent = layout.findViewById(R.id.sud_layout_content);
|
||||
mSudContent = layout.findViewById(
|
||||
com.google.android.setupdesign.R.id.sud_layout_content);
|
||||
mSudContent.setPadding(mSudContent.getPaddingLeft(), 0, mSudContent.getPaddingRight(),
|
||||
0);
|
||||
|
||||
@@ -741,7 +743,7 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
if (stage == Stage.ConfirmWrong || stage == Stage.ChoiceTooShort) {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
Theme theme = getActivity().getTheme();
|
||||
theme.resolveAttribute(R.attr.colorError, typedValue, true);
|
||||
theme.resolveAttribute(androidx.appcompat.R.attr.colorError, typedValue, true);
|
||||
mHeaderText.setTextColor(typedValue.data);
|
||||
} else if (mDefaultHeaderColorList != null) {
|
||||
mHeaderText.setTextColor(mDefaultHeaderColorList);
|
||||
|
||||
@@ -118,6 +118,14 @@ public final class ChooseLockSettingsHelper {
|
||||
public static final String EXTRA_KEY_DEVICE_PASSWORD_REQUIREMENT_ONLY =
|
||||
"device_password_requirement_only";
|
||||
|
||||
/** Intent extra for passing the screen title resource ID to show in the set lock screen. */
|
||||
public static final String EXTRA_KEY_CHOOSE_LOCK_SCREEN_TITLE =
|
||||
"choose_lock_setup_screen_title";
|
||||
|
||||
/** Intent extra for passing the description resource ID to show in the set lock screen. */
|
||||
public static final String EXTRA_KEY_CHOOSE_LOCK_SCREEN_DESCRIPTION =
|
||||
"choose_lock_setup_screen_description";
|
||||
|
||||
@VisibleForTesting @NonNull LockPatternUtils mLockPatternUtils;
|
||||
@NonNull private final Activity mActivity;
|
||||
@Nullable private final Fragment mFragment;
|
||||
|
||||
@@ -26,10 +26,12 @@ import android.app.Activity;
|
||||
import android.app.KeyguardManager;
|
||||
import android.app.RemoteLockscreenValidationSession;
|
||||
import android.app.admin.DevicePolicyManager;
|
||||
import android.app.admin.ManagedSubscriptionsPolicy;
|
||||
import android.app.trust.TrustManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.UserProperties;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.hardware.biometrics.BiometricConstants;
|
||||
@@ -41,6 +43,7 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
|
||||
@@ -60,11 +63,6 @@ import java.util.concurrent.Executor;
|
||||
public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
public static final String TAG = ConfirmDeviceCredentialActivity.class.getSimpleName();
|
||||
|
||||
// The normal flow that apps go through
|
||||
private static final int CREDENTIAL_NORMAL = 1;
|
||||
// Unlocks the managed profile when the primary profile is unlocked
|
||||
private static final int CREDENTIAL_MANAGED = 2;
|
||||
|
||||
private static final String TAG_BIOMETRIC_FRAGMENT = "fragment";
|
||||
|
||||
public static class InternalActivity extends ConfirmDeviceCredentialActivity {
|
||||
@@ -83,7 +81,9 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
private String mTitle;
|
||||
private CharSequence mDetails;
|
||||
private int mUserId;
|
||||
private int mCredentialMode;
|
||||
// Used to force the verification path required to unlock profile that shares credentials with
|
||||
// with parent
|
||||
private boolean mForceVerifyPath = false;
|
||||
private boolean mGoingToBackground;
|
||||
private boolean mWaitingForBiometricCallback;
|
||||
|
||||
@@ -188,7 +188,9 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
}
|
||||
final int effectiveUserId = mUserManager.getCredentialOwnerProfile(mUserId);
|
||||
final boolean isEffectiveUserManagedProfile =
|
||||
UserManager.get(this).isManagedProfile(effectiveUserId);
|
||||
mUserManager.isManagedProfile(effectiveUserId);
|
||||
final UserProperties userProperties =
|
||||
mUserManager.getUserProperties(UserHandle.of(mUserId));
|
||||
// if the client app did not hand in a title and we are about to show the work challenge,
|
||||
// check whether there is a policy setting the organization name and use that as title
|
||||
if ((mTitle == null) && isEffectiveUserManagedProfile) {
|
||||
@@ -200,6 +202,13 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
promptInfo.setDescription(mDetails);
|
||||
promptInfo.setDisallowBiometricsIfPolicyExists(mCheckDevicePolicyManager);
|
||||
|
||||
final int policyType = mDevicePolicyManager.getManagedSubscriptionsPolicy().getPolicyType();
|
||||
|
||||
if (isEffectiveUserManagedProfile
|
||||
&& (policyType == ManagedSubscriptionsPolicy.TYPE_ALL_MANAGED_SUBSCRIPTIONS)) {
|
||||
promptInfo.setShowEmergencyCallButton(true);
|
||||
}
|
||||
|
||||
final @LockPatternUtils.CredentialType int credentialType = Utils.getCredentialType(
|
||||
mContext, effectiveUserId);
|
||||
if (mTitle == null) {
|
||||
@@ -270,20 +279,49 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
.setForceVerifyPath(true)
|
||||
.show();
|
||||
} else if (isEffectiveUserManagedProfile && isInternalActivity()) {
|
||||
mCredentialMode = CREDENTIAL_MANAGED;
|
||||
// When the mForceVerifyPath is set to true, we launch the real confirm credential
|
||||
// activity with an explicit but fake challenge value (0L). This will result in
|
||||
// ConfirmLockPassword calling verifyTiedProfileChallenge() (if it's a profile with
|
||||
// unified challenge), due to the difference between
|
||||
// ConfirmLockPassword.startVerifyPassword() and
|
||||
// ConfirmLockPassword.startCheckPassword(). Calling verifyTiedProfileChallenge() here
|
||||
// is necessary when this is part of the turning on work profile flow, because it forces
|
||||
// unlocking the work profile even before the profile is running.
|
||||
// TODO: Remove the duplication of checkPassword and verifyPassword in
|
||||
// ConfirmLockPassword,
|
||||
// LockPatternChecker and LockPatternUtils. verifyPassword should be the only API to
|
||||
// use, which optionally accepts a challenge.
|
||||
mForceVerifyPath = true;
|
||||
if (isBiometricAllowed(effectiveUserId, mUserId)) {
|
||||
showBiometricPrompt(promptInfo);
|
||||
showBiometricPrompt(promptInfo, mUserId);
|
||||
launchedBiometric = true;
|
||||
} else {
|
||||
showConfirmCredentials();
|
||||
launchedCDC = true;
|
||||
}
|
||||
} else if (android.os.Flags.allowPrivateProfile()
|
||||
&& userProperties != null
|
||||
&& userProperties.isAuthAlwaysRequiredToDisableQuietMode()
|
||||
&& isInternalActivity()) {
|
||||
// Force verification path is required to be invoked as we might need to verify the
|
||||
// tied profile challenge if the profile is using the unified challenge mode. This
|
||||
// would result in ConfirmLockPassword.startVerifyPassword/
|
||||
// ConfirmLockPattern.startVerifyPattern being called instead of the
|
||||
// startCheckPassword/startCheckPattern
|
||||
mForceVerifyPath = userProperties.isCredentialShareableWithParent();
|
||||
if (android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()
|
||||
&& isBiometricAllowed(effectiveUserId, mUserId)) {
|
||||
showBiometricPrompt(promptInfo, effectiveUserId);
|
||||
launchedBiometric = true;
|
||||
} else {
|
||||
showConfirmCredentials();
|
||||
launchedCDC = true;
|
||||
}
|
||||
} else {
|
||||
mCredentialMode = CREDENTIAL_NORMAL;
|
||||
if (isBiometricAllowed(effectiveUserId, mUserId)) {
|
||||
// Don't need to check if biometrics / pin/pattern/pass are enrolled. It will go to
|
||||
// onAuthenticationError and do the right thing automatically.
|
||||
showBiometricPrompt(promptInfo);
|
||||
showBiometricPrompt(promptInfo, mUserId);
|
||||
launchedBiometric = true;
|
||||
} else {
|
||||
showConfirmCredentials();
|
||||
@@ -305,11 +343,8 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
|
||||
private String getTitleFromCredentialType(@LockPatternUtils.CredentialType int credentialType,
|
||||
boolean isEffectiveUserManagedProfile) {
|
||||
int overrideStringId;
|
||||
int defaultStringId;
|
||||
switch (credentialType) {
|
||||
case LockPatternUtils.CREDENTIAL_TYPE_PIN:
|
||||
|
||||
if (isEffectiveUserManagedProfile) {
|
||||
return mDevicePolicyManager.getResources().getString(
|
||||
CONFIRM_WORK_PROFILE_PIN_HEADER,
|
||||
@@ -372,7 +407,19 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
// biometric is disabled due to device restart.
|
||||
private boolean isStrongAuthRequired(int effectiveUserId) {
|
||||
return !mLockPatternUtils.isBiometricAllowedForUser(effectiveUserId)
|
||||
|| !mUserManager.isUserUnlocked(mUserId);
|
||||
|| doesUserStateEnforceStrongAuth(mUserId);
|
||||
}
|
||||
|
||||
private boolean doesUserStateEnforceStrongAuth(int userId) {
|
||||
if (android.os.Flags.allowPrivateProfile()
|
||||
&& android.multiuser.Flags.enableBiometricsToUnlockPrivateSpace()) {
|
||||
// Check if CE storage for user is locked since biometrics can't unlock fbe/keystore of
|
||||
// the profile user using verifyTiedProfileChallenge. Biometrics can still be used if
|
||||
// the user is stopped with delayed locking (i.e., with storage unlocked), so the user
|
||||
// state (whether the user is in the RUNNING_UNLOCKED state) should not be relied upon.
|
||||
return !StorageManager.isCeStorageUnlocked(userId);
|
||||
}
|
||||
return !mUserManager.isUserUnlocked(userId);
|
||||
}
|
||||
|
||||
private boolean isBiometricAllowed(int effectiveUserId, int realUserId) {
|
||||
@@ -380,7 +427,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
.hasPendingEscrowToken(realUserId);
|
||||
}
|
||||
|
||||
private void showBiometricPrompt(PromptInfo promptInfo) {
|
||||
private void showBiometricPrompt(PromptInfo promptInfo, int userId) {
|
||||
mBiometricFragment = (BiometricFragment) getSupportFragmentManager()
|
||||
.findFragmentByTag(TAG_BIOMETRIC_FRAGMENT);
|
||||
boolean newFragment = false;
|
||||
@@ -390,7 +437,9 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
newFragment = true;
|
||||
}
|
||||
mBiometricFragment.setCallbacks(mExecutor, mAuthenticationCallback);
|
||||
mBiometricFragment.setUser(mUserId);
|
||||
// TODO(b/315864564): Move the logic of choosing the user id against which the
|
||||
// authentication needs to happen to the BiometricPrompt API
|
||||
mBiometricFragment.setUser(userId);
|
||||
|
||||
if (newFragment) {
|
||||
getSupportFragmentManager().beginTransaction()
|
||||
@@ -402,29 +451,15 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
* Shows ConfirmDeviceCredentials for normal apps.
|
||||
*/
|
||||
private void showConfirmCredentials() {
|
||||
boolean launched = false;
|
||||
ChooseLockSettingsHelper.Builder builder = new ChooseLockSettingsHelper.Builder(this)
|
||||
boolean launched = new ChooseLockSettingsHelper.Builder(this)
|
||||
.setHeader(mTitle)
|
||||
.setDescription(mDetails)
|
||||
.setExternal(true)
|
||||
.setUserId(mUserId)
|
||||
.setTaskOverlay(mTaskOverlay);
|
||||
// The only difference between CREDENTIAL_MANAGED and CREDENTIAL_NORMAL is that for
|
||||
// CREDENTIAL_MANAGED, we launch the real confirm credential activity with an explicit
|
||||
// but fake challenge value (0L). This will result in ConfirmLockPassword calling
|
||||
// verifyTiedProfileChallenge() (if it's a profile with unified challenge), due to the
|
||||
// difference between ConfirmLockPassword.startVerifyPassword() and
|
||||
// ConfirmLockPassword.startCheckPassword(). Calling verifyTiedProfileChallenge() here is
|
||||
// necessary when this is part of the turning on work profile flow, because it forces
|
||||
// unlocking the work profile even before the profile is running.
|
||||
// TODO: Remove the duplication of checkPassword and verifyPassword in ConfirmLockPassword,
|
||||
// LockPatternChecker and LockPatternUtils. verifyPassword should be the only API to use,
|
||||
// which optionally accepts a challenge.
|
||||
if (mCredentialMode == CREDENTIAL_MANAGED) {
|
||||
launched = builder.setForceVerifyPath(true).show();
|
||||
} else if (mCredentialMode == CREDENTIAL_NORMAL) {
|
||||
launched = builder.show();
|
||||
}
|
||||
.setTaskOverlay(mTaskOverlay)
|
||||
.setForceVerifyPath(mForceVerifyPath)
|
||||
.show();
|
||||
|
||||
if (!launched) {
|
||||
Log.d(TAG, "No pin/pattern/pass set");
|
||||
setResult(Activity.RESULT_OK);
|
||||
|
||||
@@ -419,6 +419,10 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends InstrumentedFr
|
||||
}
|
||||
}
|
||||
|
||||
protected void clearResetErrorRunnable() {
|
||||
mHandler.removeCallbacks(mResetErrorRunnable);
|
||||
}
|
||||
|
||||
protected void validateGuess(LockscreenCredential credentialGuess) {
|
||||
mRemoteLockscreenValidationFragment.validateLockscreenGuess(
|
||||
mRemoteLockscreenValidationClient, credentialGuess,
|
||||
|
||||
@@ -666,6 +666,7 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
||||
}
|
||||
|
||||
private void handleAttemptLockout(long elapsedRealtimeDeadline) {
|
||||
clearResetErrorRunnable();
|
||||
mCountdownTimer = new CountDownTimer(
|
||||
elapsedRealtimeDeadline - SystemClock.elapsedRealtime(),
|
||||
LockPatternUtils.FAILED_ATTEMPT_COUNTDOWN_INTERVAL_MS) {
|
||||
|
||||
@@ -135,7 +135,8 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
|
||||
mErrorTextView = (TextView) view.findViewById(R.id.errorText);
|
||||
// TODO(b/243008023) Workaround for Glif layout on 2 panel choose lock settings.
|
||||
mSudContent = mGlifLayout.findViewById(R.id.sud_layout_content);
|
||||
mSudContent = mGlifLayout.findViewById(
|
||||
com.google.android.setupdesign.R.id.sud_layout_content);
|
||||
mSudContent.setPadding(mSudContent.getPaddingLeft(), 0, mSudContent.getPaddingRight(),
|
||||
0);
|
||||
mIsManagedProfile = UserManager.get(getActivity()).isManagedProfile(mEffectiveUserId);
|
||||
@@ -696,6 +697,7 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
}
|
||||
|
||||
private void handleAttemptLockout(long elapsedRealtimeDeadline) {
|
||||
clearResetErrorRunnable();
|
||||
updateStage(Stage.LockedOut);
|
||||
long elapsedRealtime = SystemClock.elapsedRealtime();
|
||||
mCountdownTimer = new CountDownTimer(
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ForgotPasswordActivity extends Activity {
|
||||
.setText(android.R.string.ok)
|
||||
.setListener(v -> finish())
|
||||
.setButtonType(FooterButton.ButtonType.DONE)
|
||||
.setTheme(R.style.SudGlifButton_Primary)
|
||||
.setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary)
|
||||
.build()
|
||||
);
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ public final class PasswordUtils extends com.android.settingslib.Utils {
|
||||
/** Setup screen lock options button under the Glif Header. */
|
||||
public static void setupScreenLockOptionsButton(Context context, View view, Button optButton) {
|
||||
final LinearLayout headerLayout = view.findViewById(
|
||||
R.id.sud_layout_header);
|
||||
com.google.android.setupdesign.R.id.sud_layout_header);
|
||||
final TextView sucTitleView = headerLayout.findViewById(R.id.suc_layout_title);
|
||||
if (headerLayout != null && sucTitleView != null) {
|
||||
final ViewGroup.MarginLayoutParams layoutTitleParams =
|
||||
|
||||
@@ -24,6 +24,8 @@ import static android.app.admin.DevicePolicyManager.EXTRA_PASSWORD_COMPLEXITY;
|
||||
import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_NONE;
|
||||
|
||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_CALLER_APP_NAME;
|
||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_CHOOSE_LOCK_SCREEN_DESCRIPTION;
|
||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_CHOOSE_LOCK_SCREEN_TITLE;
|
||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_DEVICE_PASSWORD_REQUIREMENT_ONLY;
|
||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_IS_CALLING_APP_ADMIN;
|
||||
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_REQUESTED_MIN_COMPLEXITY;
|
||||
@@ -126,6 +128,10 @@ public class SetNewPasswordActivity extends Activity implements SetNewPasswordCo
|
||||
: new Intent(this, ChooseLockGeneric.class);
|
||||
intent.setAction(mNewPasswordAction);
|
||||
intent.putExtras(chooseLockFingerprintExtras);
|
||||
intent.putExtra(EXTRA_KEY_CHOOSE_LOCK_SCREEN_TITLE,
|
||||
getIntent().getIntExtra(EXTRA_KEY_CHOOSE_LOCK_SCREEN_TITLE, -1));
|
||||
intent.putExtra(EXTRA_KEY_CHOOSE_LOCK_SCREEN_DESCRIPTION,
|
||||
getIntent().getIntExtra(EXTRA_KEY_CHOOSE_LOCK_SCREEN_DESCRIPTION, -1));
|
||||
if (mCallerAppName != null) {
|
||||
intent.putExtra(EXTRA_KEY_CALLER_APP_NAME, mCallerAppName);
|
||||
}
|
||||
@@ -180,7 +186,7 @@ public class SetNewPasswordActivity extends Activity implements SetNewPasswordCo
|
||||
: SettingsEnums.ACTION_SET_NEW_PARENT_PROFILE_PASSWORD;
|
||||
|
||||
final MetricsFeatureProvider metricsProvider =
|
||||
FeatureFactory.getFactory(this).getMetricsFeatureProvider();
|
||||
FeatureFactory.getFeatureFactory().getMetricsFeatureProvider();
|
||||
metricsProvider.action(
|
||||
metricsProvider.getAttribution(this),
|
||||
action,
|
||||
|
||||
@@ -113,7 +113,7 @@ public class SetupChooseLockGeneric extends ChooseLockGeneric {
|
||||
layout.setDescriptionText(loadDescriptionText());
|
||||
layout.setDividerItemDecoration(new SettingsDividerItemDecoration(getContext()));
|
||||
layout.setDividerInset(getContext().getResources().getDimensionPixelSize(
|
||||
R.dimen.sud_items_glif_text_divider_inset));
|
||||
com.google.android.setupdesign.R.dimen.sud_items_glif_text_divider_inset));
|
||||
|
||||
layout.setIcon(getContext().getDrawable(R.drawable.ic_lock));
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ public class SetupChooseLockPassword extends ChooseLockPassword {
|
||||
|
||||
if (showOptionsButton && anyOptionsShown) {
|
||||
mOptionsButton = new Button(new ContextThemeWrapper(getActivity(),
|
||||
R.style.SudGlifButton_Tertiary));
|
||||
com.google.android.setupdesign.R.style.SudGlifButton_Tertiary));
|
||||
mOptionsButton.setId(R.id.screen_lock_options);
|
||||
PasswordUtils.setupScreenLockOptionsButton(getActivity(), view, mOptionsButton);
|
||||
mOptionsButton.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -85,7 +85,7 @@ public class SetupChooseLockPattern extends ChooseLockPattern {
|
||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||
if (!getResources().getBoolean(R.bool.config_lock_pattern_minimal_ui)) {
|
||||
mOptionsButton = new Button(new ContextThemeWrapper(getActivity(),
|
||||
R.style.SudGlifButton_Tertiary));
|
||||
com.google.android.setupdesign.R.style.SudGlifButton_Tertiary));
|
||||
mOptionsButton.setId(R.id.screen_lock_options);
|
||||
PasswordUtils.setupScreenLockOptionsButton(getActivity(), view, mOptionsButton);
|
||||
mOptionsButton.setOnClickListener((btn) ->
|
||||
|
||||
Reference in New Issue
Block a user