Removed old settings device credential logic.
Bug: 140128468 Test: Verified with biometricpromptdemo that confirm device credential still works correctly. Change-Id: I0f608ba1256c696317402f56549452bf6933066b
This commit is contained in:
@@ -4024,14 +4024,6 @@
|
||||
<!-- About phone settings screen, Safety Legal dialog title until the link is fully loaded -->
|
||||
<string name="settings_safetylegal_activity_loading">Loading\u2026</string>
|
||||
|
||||
<!-- ConfirmDeviceCredential settings-->
|
||||
<!-- Button text shown on BiometricPrompt (system dialog that asks for biometric authentication) giving the user the option to use an alternate form of authentication (Pin) [CHAR LIMIT=30] -->
|
||||
<string name="confirm_device_credential_pin">Use PIN</string>
|
||||
<!-- Button text shown on BiometricPrompt (system dialog that asks for biometric authentication) giving the user the option to use an alternate form of authentication (Pattern) [CHAR LIMIT=30] -->
|
||||
<string name="confirm_device_credential_pattern">Use pattern</string>
|
||||
<!-- Button text shown on BiometricPrompt (system dialog that asks for biometric authentication) giving the user the option to use an alternate form of authentication (Pass) [CHAR LIMIT=30] -->
|
||||
<string name="confirm_device_credential_password">Use password</string>
|
||||
|
||||
<!-- Lock Pattern settings -->
|
||||
<!-- Header on first screen of choose password/PIN flow [CHAR LIMIT=40] -->
|
||||
<string name="lockpassword_choose_your_screen_lock_header">Set screen lock</string>
|
||||
|
@@ -24,7 +24,6 @@ import android.hardware.biometrics.BiometricConstants;
|
||||
import android.hardware.biometrics.BiometricPrompt;
|
||||
import android.hardware.biometrics.BiometricPrompt.AuthenticationCallback;
|
||||
import android.hardware.biometrics.BiometricPrompt.AuthenticationResult;
|
||||
import android.hardware.biometrics.IBiometricConfirmDeviceCredentialCallback;
|
||||
import android.os.Bundle;
|
||||
import android.os.CancellationSignal;
|
||||
import android.os.Handler;
|
||||
@@ -91,20 +90,6 @@ public class BiometricFragment extends InstrumentedFragment {
|
||||
}
|
||||
};
|
||||
|
||||
// TODO(b/123378871): Remove when moved.
|
||||
private final IBiometricConfirmDeviceCredentialCallback mCancelCallback
|
||||
= new IBiometricConfirmDeviceCredentialCallback.Stub() {
|
||||
@Override
|
||||
public void cancel() {
|
||||
final Activity activity = getActivity();
|
||||
if (activity != null) {
|
||||
activity.finish();
|
||||
} else {
|
||||
Log.e(TAG, "Activity null!");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param bundle Bundle passed from {@link BiometricPrompt.Builder#buildIntent()}
|
||||
* @return
|
||||
@@ -150,46 +135,19 @@ public class BiometricFragment extends InstrumentedFragment {
|
||||
final BiometricPrompt.Builder builder = new BiometricPrompt.Builder(getContext())
|
||||
.setTitle(mBundle.getString(BiometricPrompt.KEY_TITLE))
|
||||
.setUseDefaultTitle() // use default title if title is null/empty
|
||||
.setFromConfirmDeviceCredential()
|
||||
.setDeviceCredentialAllowed(true)
|
||||
.setSubtitle(mBundle.getString(BiometricPrompt.KEY_SUBTITLE))
|
||||
.setDescription(mBundle.getString(BiometricPrompt.KEY_DESCRIPTION))
|
||||
.setConfirmationRequired(
|
||||
mBundle.getBoolean(BiometricPrompt.KEY_REQUIRE_CONFIRMATION, true));
|
||||
|
||||
final LockPatternUtils lockPatternUtils = FeatureFactory.getFactory(
|
||||
getContext())
|
||||
.getSecurityFeatureProvider()
|
||||
.getLockPatternUtils(getContext());
|
||||
|
||||
switch (lockPatternUtils.getKeyguardStoredPasswordQuality(mUserId)) {
|
||||
case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
|
||||
builder.setNegativeButton(getResources().getString(
|
||||
R.string.confirm_device_credential_pattern),
|
||||
mClientExecutor, mNegativeButtonListener);
|
||||
break;
|
||||
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
|
||||
case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC_COMPLEX:
|
||||
builder.setNegativeButton(getResources().getString(
|
||||
R.string.confirm_device_credential_pin),
|
||||
mClientExecutor, mNegativeButtonListener);
|
||||
break;
|
||||
case DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC:
|
||||
case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC:
|
||||
case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX:
|
||||
case DevicePolicyManager.PASSWORD_QUALITY_MANAGED:
|
||||
builder.setNegativeButton(getResources().getString(
|
||||
R.string.confirm_device_credential_password),
|
||||
mClientExecutor, mNegativeButtonListener);
|
||||
break;
|
||||
}
|
||||
|
||||
mBiometricPrompt = builder.build();
|
||||
mCancellationSignal = new CancellationSignal();
|
||||
|
||||
// TODO: CC doesn't use crypto for now
|
||||
mAuthenticating = true;
|
||||
mBiometricPrompt.authenticateUser(mCancellationSignal, mClientExecutor,
|
||||
mAuthenticationCallback, mUserId, mCancelCallback);
|
||||
mAuthenticationCallback, mUserId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -90,8 +90,6 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
private TrustManager mTrustManager;
|
||||
private ChooseLockSettingsHelper mChooseLockSettingsHelper;
|
||||
private Handler mHandler = new Handler(Looper.getMainLooper());
|
||||
private boolean mIsFallback; // BiometricPrompt fallback
|
||||
private boolean mCCLaunched;
|
||||
|
||||
private String mTitle;
|
||||
private String mDetails;
|
||||
@@ -108,10 +106,6 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
if (!mGoingToBackground) {
|
||||
if (errorCode == BiometricPrompt.BIOMETRIC_ERROR_USER_CANCELED
|
||||
|| errorCode == BiometricPrompt.BIOMETRIC_ERROR_CANCELED) {
|
||||
if (mIsFallback) {
|
||||
mBiometricManager.onConfirmDeviceCredentialError(
|
||||
errorCode, getStringForError(errorCode));
|
||||
}
|
||||
finish();
|
||||
} else {
|
||||
// All other errors go to some version of CC
|
||||
@@ -128,10 +122,6 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
ConfirmDeviceCredentialUtils.checkForPendingIntent(
|
||||
ConfirmDeviceCredentialActivity.this);
|
||||
|
||||
if (mIsFallback) {
|
||||
mBiometricManager.onConfirmDeviceCredentialSuccess();
|
||||
}
|
||||
|
||||
setResult(Activity.RESULT_OK);
|
||||
finish();
|
||||
}
|
||||
@@ -183,17 +173,11 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
mChooseLockSettingsHelper = new ChooseLockSettingsHelper(this);
|
||||
final LockPatternUtils lockPatternUtils = new LockPatternUtils(this);
|
||||
|
||||
Bundle bpBundle =
|
||||
intent.getBundleExtra(KeyguardManager.EXTRA_BIOMETRIC_PROMPT_BUNDLE);
|
||||
if (bpBundle != null) {
|
||||
mIsFallback = true;
|
||||
mTitle = bpBundle.getString(BiometricPrompt.KEY_TITLE);
|
||||
mDetails = bpBundle.getString(BiometricPrompt.KEY_SUBTITLE);
|
||||
} else {
|
||||
bpBundle = new Bundle();
|
||||
bpBundle.putString(BiometricPrompt.KEY_TITLE, mTitle);
|
||||
bpBundle.putString(BiometricPrompt.KEY_DESCRIPTION, mDetails);
|
||||
}
|
||||
final Bundle bpBundle = new Bundle();
|
||||
mTitle = bpBundle.getString(BiometricPrompt.KEY_TITLE);
|
||||
mDetails = bpBundle.getString(BiometricPrompt.KEY_SUBTITLE);
|
||||
bpBundle.putString(BiometricPrompt.KEY_TITLE, mTitle);
|
||||
bpBundle.putString(BiometricPrompt.KEY_DESCRIPTION, mDetails);
|
||||
|
||||
boolean launchedBiometric = false;
|
||||
boolean launchedCDC = false;
|
||||
@@ -257,12 +241,6 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
}
|
||||
}
|
||||
|
||||
if (mIsFallback && !mCCLaunched) {
|
||||
mBiometricManager.onConfirmDeviceCredentialError(
|
||||
BiometricConstants.BIOMETRIC_ERROR_CANCELED,
|
||||
getString(com.android.internal.R.string.biometric_error_user_canceled));
|
||||
}
|
||||
|
||||
finish();
|
||||
} else {
|
||||
mGoingToBackground = false;
|
||||
@@ -314,7 +292,6 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
|
||||
* Shows ConfirmDeviceCredentials for normal apps.
|
||||
*/
|
||||
private void showConfirmCredentials() {
|
||||
mCCLaunched = true;
|
||||
boolean launched = false;
|
||||
// The only difference between CREDENTIAL_MANAGED and CREDENTIAL_NORMAL is that for
|
||||
// CREDENTIAL_MANAGED, we launch the real confirm credential activity with an explicit
|
||||
|
@@ -17,15 +17,12 @@
|
||||
package com.android.settings.password;
|
||||
|
||||
import android.app.KeyguardManager;
|
||||
import android.hardware.biometrics.BiometricConstants;
|
||||
import android.hardware.biometrics.BiometricManager;
|
||||
import android.hardware.biometrics.IBiometricConfirmDeviceCredentialCallback;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserManager;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
@@ -50,16 +47,6 @@ public abstract class ConfirmDeviceCredentialBaseActivity extends SettingsActivi
|
||||
private boolean mFirstTimeVisible = true;
|
||||
private boolean mIsKeyguardLocked = false;
|
||||
private ConfirmCredentialTheme mConfirmCredentialTheme;
|
||||
private BiometricManager mBiometricManager;
|
||||
|
||||
// TODO(b/123378871): Remove when moved.
|
||||
private final IBiometricConfirmDeviceCredentialCallback mCancelCallback
|
||||
= new IBiometricConfirmDeviceCredentialCallback.Stub() {
|
||||
@Override
|
||||
public void cancel() {
|
||||
finish();
|
||||
}
|
||||
};
|
||||
|
||||
private boolean isInternalActivity() {
|
||||
return (this instanceof ConfirmLockPassword.InternalActivity)
|
||||
@@ -90,9 +77,6 @@ public abstract class ConfirmDeviceCredentialBaseActivity extends SettingsActivi
|
||||
}
|
||||
super.onCreate(savedState);
|
||||
|
||||
mBiometricManager = getSystemService(BiometricManager.class);
|
||||
mBiometricManager.registerCancellationCallback(mCancelCallback);
|
||||
|
||||
if (mConfirmCredentialTheme == ConfirmCredentialTheme.NORMAL) {
|
||||
// Prevent the content parent from consuming the window insets because GlifLayout uses
|
||||
// it to show the status bar background.
|
||||
@@ -167,15 +151,10 @@ public abstract class ConfirmDeviceCredentialBaseActivity extends SettingsActivi
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
// TODO(b/123378871): Remove when moved.
|
||||
if (!isChangingConfigurations()) {
|
||||
mBiometricManager.onConfirmDeviceCredentialError(
|
||||
BiometricConstants.BIOMETRIC_ERROR_USER_CANCELED,
|
||||
getString(com.android.internal.R.string.biometric_error_user_canceled));
|
||||
if (getIntent().getBooleanExtra(
|
||||
ChooseLockSettingsHelper.EXTRA_KEY_FOREGROUND_ONLY, false)) {
|
||||
finish();
|
||||
}
|
||||
final boolean foregroundOnly = getIntent().getBooleanExtra(
|
||||
ChooseLockSettingsHelper.EXTRA_KEY_FOREGROUND_ONLY, false);
|
||||
if (!isChangingConfigurations() && foregroundOnly) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -446,7 +446,6 @@ public class ConfirmLockPassword extends ConfirmDeviceCredentialBaseActivity {
|
||||
ConfirmDeviceCredentialUtils.reportSuccessfulAttempt(mLockPatternUtils,
|
||||
mUserManager, mEffectiveUserId);
|
||||
}
|
||||
mBiometricManager.onConfirmDeviceCredentialSuccess();
|
||||
startDisappearAnimation(intent);
|
||||
ConfirmDeviceCredentialUtils.checkForPendingIntent(getActivity());
|
||||
} else {
|
||||
|
@@ -490,7 +490,6 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
ConfirmDeviceCredentialUtils.reportSuccessfulAttempt(mLockPatternUtils,
|
||||
mUserManager, mEffectiveUserId);
|
||||
}
|
||||
mBiometricManager.onConfirmDeviceCredentialSuccess();
|
||||
startDisappearAnimation(intent);
|
||||
ConfirmDeviceCredentialUtils.checkForPendingIntent(getActivity());
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user