diff --git a/res/layout/trusted_credential_list_container.xml b/res/layout/trusted_credential_list_container.xml
index aca0bc8..42dbfd9 100644
--- a/res/layout/trusted_credential_list_container.xml
+++ b/res/layout/trusted_credential_list_container.xml
@@ -16,6 +16,8 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
               android:layout_width="match_parent"
               android:layout_height="match_parent"
+              android:clipToPadding="true"
+              android:clipChildren="true"
               android:orientation="vertical">
     <LinearLayout
         android:id="@+id/header_view"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 53f96a0..a730aa1 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4048,14 +4048,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>
diff --git a/res/xml/firmware_version.xml b/res/xml/firmware_version.xml
index f55ee11..443ae35 100644
--- a/res/xml/firmware_version.xml
+++ b/res/xml/firmware_version.xml
@@ -27,6 +27,7 @@
         android:key="os_firmware_version"
         android:title="@string/firmware_version"
         android:summary="@string/summary_placeholder"
+        android:selectable="false"
         settings:enableCopying="true"
         settings:controller="com.android.settings.deviceinfo.firmwareversion.FirmwareVersionDetailPreferenceController"/>
 
@@ -42,6 +43,7 @@
         android:key="module_version"
         android:title="@string/module_version"
         android:summary="@string/summary_placeholder"
+        android:selectable="false"
         settings:enableCopying="true"
         settings:controller="com.android.settings.deviceinfo.firmwareversion.MainlineModuleVersionPreferenceController"/>
 
@@ -50,6 +52,7 @@
         android:key="base_band"
         android:title="@string/baseband_version"
         android:summary="@string/summary_placeholder"
+        android:selectable="false"
         settings:enableCopying="true"
         settings:controller="com.android.settings.deviceinfo.firmwareversion.BasebandVersionPreferenceController"/>
 
@@ -58,6 +61,7 @@
         android:key="kernel_version"
         android:title="@string/kernel_version"
         android:summary="@string/summary_placeholder"
+        android:selectable="false"
         settings:enableCopying="true"
         settings:controller="com.android.settings.deviceinfo.firmwareversion.KernelVersionPreferenceController"/>
 
@@ -66,7 +70,8 @@
         android:key="os_build_number"
         android:title="@string/build_number"
         android:summary="@string/summary_placeholder"
+        android:selectable="false"
         settings:enableCopying="true"
         settings:controller="com.android.settings.deviceinfo.firmwareversion.SimpleBuildNumberPreferenceController"/>
 
-</PreferenceScreen>
\ No newline at end of file
+</PreferenceScreen>
diff --git a/src/com/android/settings/password/BiometricFragment.java b/src/com/android/settings/password/BiometricFragment.java
index 66b665b..9898719 100644
--- a/src/com/android/settings/password/BiometricFragment.java
+++ b/src/com/android/settings/password/BiometricFragment.java
@@ -24,7 +24,6 @@
 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 @@
         }
     };
 
-    // 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 @@
         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
diff --git a/src/com/android/settings/password/ChooseLockGeneric.java b/src/com/android/settings/password/ChooseLockGeneric.java
index 4e2e90d..f86292b 100644
--- a/src/com/android/settings/password/ChooseLockGeneric.java
+++ b/src/com/android/settings/password/ChooseLockGeneric.java
@@ -725,30 +725,6 @@
         }
 
         /**
-         * Keeps track of the biometric removal status. When all biometrics (including managed
-         * profiles) are removed, finishes the activity. Otherwise, it's possible the UI still
-         * shows enrolled biometrics due to the async remove.
-         */
-        private class RemovalTracker {
-            boolean mFingerprintDone;
-            boolean mFaceDone;
-
-            void onFingerprintDone() {
-                mFingerprintDone = true;
-                if (mFingerprintDone && mFaceDone) {
-                    finish();
-                }
-            }
-
-            void onFaceDone() {
-                mFaceDone = true;
-                if (mFingerprintDone && mFaceDone) {
-                    finish();
-                }
-            }
-        }
-
-        /**
          * Invokes an activity to change the user's pattern, password or PIN based on given quality
          * and minimum quality specified by DevicePolicyManager. If quality is
          * {@link DevicePolicyManager#PASSWORD_QUALITY_UNSPECIFIED}, password is cleared.
@@ -781,21 +757,15 @@
             }
 
             if (quality == DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED) {
+                // Clearing of user biometrics when screen lock is cleared is done at
+                // LockSettingsService.removeBiometricsForUser().
                 mChooseLockSettingsHelper.utils().clearLock(mUserPassword, mUserId);
                 mChooseLockSettingsHelper.utils().setLockScreenDisabled(disabled, mUserId);
                 getActivity().setResult(Activity.RESULT_OK);
-                removeAllBiometricsForUserAndFinish(mUserId);
-            } else {
-                removeAllBiometricsForUserAndFinish(mUserId);
+                finish();
             }
         }
 
-        private void removeAllBiometricsForUserAndFinish(final int userId) {
-            final RemovalTracker tracker = new RemovalTracker();
-            removeAllFingerprintForUserAndFinish(userId, tracker);
-            removeAllFaceForUserAndFinish(userId, tracker);
-        }
-
         private Intent getIntentForUnlockMethod(int quality) {
             Intent intent = null;
             if (quality >= DevicePolicyManager.PASSWORD_QUALITY_MANAGED) {
@@ -808,128 +778,6 @@
             return intent;
         }
 
-        private void removeAllFingerprintForUserAndFinish(final int userId,
-                RemovalTracker tracker) {
-            if (mFingerprintManager != null && mFingerprintManager.isHardwareDetected()) {
-                if (mFingerprintManager.hasEnrolledFingerprints(userId)) {
-                    mFingerprintManager.setActiveUser(userId);
-                    // For the purposes of M and N, groupId is the same as userId.
-                    final int groupId = userId;
-                    Fingerprint finger = new Fingerprint(null, groupId, 0, 0);
-                    mFingerprintManager.remove(finger, userId,
-                            new RemovalCallback() {
-                                @Override
-                                public void onRemovalError(Fingerprint fp, int errMsgId,
-                                        CharSequence errString) {
-                                    Log.e(TAG, String.format(
-                                            "Can't remove fingerprint %d in group %d. Reason: %s",
-                                            fp.getBiometricId(), fp.getGroupId(), errString));
-                                    // TODO: need to proceed with the removal of managed profile
-                                    // fingerprints and finish() gracefully.
-                                }
-
-                                @Override
-                                public void onRemovalSucceeded(Fingerprint fp, int remaining) {
-                                    if (remaining == 0) {
-                                        removeManagedProfileFingerprintsAndFinishIfNecessary(userId,
-                                                tracker);
-                                    }
-                                }
-                            });
-                } else {
-                    // No fingerprints in this user, we may also want to delete managed profile
-                    // fingerprints
-                    removeManagedProfileFingerprintsAndFinishIfNecessary(userId, tracker);
-                }
-            } else {
-                // The removal callback will call finish, once all fingerprints are removed.
-                // We need to wait for that to occur, otherwise, the UI will still show that
-                // fingerprints exist even though they are (about to) be removed depending on
-                // the race condition.
-                tracker.onFingerprintDone();
-            }
-        }
-
-        private void removeManagedProfileFingerprintsAndFinishIfNecessary(final int parentUserId,
-                RemovalTracker tracker) {
-            if (mFingerprintManager != null && mFingerprintManager.isHardwareDetected()) {
-                mFingerprintManager.setActiveUser(UserHandle.myUserId());
-            }
-            boolean hasChildProfile = false;
-            if (!mUserManager.getUserInfo(parentUserId).isManagedProfile()) {
-                // Current user is primary profile, remove work profile fingerprints if necessary
-                final List<UserInfo> profiles = mUserManager.getProfiles(parentUserId);
-                final int profilesSize = profiles.size();
-                for (int i = 0; i < profilesSize; i++) {
-                    final UserInfo userInfo = profiles.get(i);
-                    if (userInfo.isManagedProfile() && !mLockPatternUtils
-                            .isSeparateProfileChallengeEnabled(userInfo.id)) {
-                        removeAllFingerprintForUserAndFinish(userInfo.id, tracker);
-                        hasChildProfile = true;
-                        break;
-                    }
-                }
-            }
-            if (!hasChildProfile) {
-                tracker.onFingerprintDone();
-            }
-        }
-
-        // TODO: figure out how to eliminate duplicated code. It's a bit hard due to the async-ness
-        private void removeAllFaceForUserAndFinish(final int userId, RemovalTracker tracker) {
-            if (mFaceManager != null && mFaceManager.isHardwareDetected()) {
-                if (mFaceManager.hasEnrolledTemplates(userId)) {
-                    mFaceManager.setActiveUser(userId);
-                    Face face = new Face(null, 0, 0);
-                    mFaceManager.remove(face, userId,
-                            new FaceManager.RemovalCallback() {
-                        @Override
-                        public void onRemovalError(Face face, int errMsgId, CharSequence err) {
-                            Log.e(TAG, String.format("Can't remove face %d. Reason: %s",
-                                    face.getBiometricId(), err));
-                        }
-                        @Override
-                        public void onRemovalSucceeded(Face face, int remaining) {
-                            if (remaining == 0) {
-                                removeManagedProfileFacesAndFinishIfNecessary(userId, tracker);
-                            }
-                        }
-                    });
-                } else {
-                    // No faces in this user, we may also want to delete managed profile faces
-                    removeManagedProfileFacesAndFinishIfNecessary(userId, tracker);
-                }
-            } else {
-                tracker.onFaceDone();
-            }
-        }
-
-        // TODO: figure out how to eliminate duplicated code. It's a bit hard due to the async-ness
-        private void removeManagedProfileFacesAndFinishIfNecessary(final int parentUserId,
-                RemovalTracker tracker) {
-            if (mFaceManager != null && mFaceManager.isHardwareDetected()) {
-                mFaceManager.setActiveUser(UserHandle.myUserId());
-            }
-            boolean hasChildProfile = false;
-            if (!mUserManager.getUserInfo(parentUserId).isManagedProfile()) {
-                // Current user is primary profile, remove work profile faces if necessary
-                final List<UserInfo> profiles = mUserManager.getProfiles(parentUserId);
-                final int profilesSize = profiles.size();
-                for (int i = 0; i < profilesSize; i++) {
-                    final UserInfo userInfo = profiles.get(i);
-                    if (userInfo.isManagedProfile() && !mLockPatternUtils
-                            .isSeparateProfileChallengeEnabled(userInfo.id)) {
-                        removeAllFaceForUserAndFinish(userInfo.id, tracker);
-                        hasChildProfile = true;
-                        break;
-                    }
-                }
-            }
-            if (!hasChildProfile) {
-                tracker.onFaceDone();
-            }
-        }
-
         @Override
         public void onDestroy() {
             super.onDestroy();
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
index 8476f92..1da2a63 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
@@ -90,8 +90,6 @@
     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 @@
             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 @@
             ConfirmDeviceCredentialUtils.checkForPendingIntent(
                     ConfirmDeviceCredentialActivity.this);
 
-            if (mIsFallback) {
-                mBiometricManager.onConfirmDeviceCredentialSuccess();
-            }
-
             setResult(Activity.RESULT_OK);
             finish();
         }
@@ -183,17 +173,11 @@
         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 @@
                 }
             }
 
-            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 @@
      * 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
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialBaseActivity.java b/src/com/android/settings/password/ConfirmDeviceCredentialBaseActivity.java
index 5407776..a30d2e1 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialBaseActivity.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialBaseActivity.java
@@ -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 @@
     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 @@
         }
         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 @@
     @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();
         }
     }
 
diff --git a/src/com/android/settings/password/ConfirmLockPassword.java b/src/com/android/settings/password/ConfirmLockPassword.java
index 12b2724..5c891cd 100644
--- a/src/com/android/settings/password/ConfirmLockPassword.java
+++ b/src/com/android/settings/password/ConfirmLockPassword.java
@@ -446,7 +446,6 @@
                     ConfirmDeviceCredentialUtils.reportSuccessfulAttempt(mLockPatternUtils,
                             mUserManager, mEffectiveUserId);
                 }
-                mBiometricManager.onConfirmDeviceCredentialSuccess();
                 startDisappearAnimation(intent);
                 ConfirmDeviceCredentialUtils.checkForPendingIntent(getActivity());
             } else {
diff --git a/src/com/android/settings/password/ConfirmLockPattern.java b/src/com/android/settings/password/ConfirmLockPattern.java
index f43ee7f..b1d8e60 100644
--- a/src/com/android/settings/password/ConfirmLockPattern.java
+++ b/src/com/android/settings/password/ConfirmLockPattern.java
@@ -490,7 +490,6 @@
                     ConfirmDeviceCredentialUtils.reportSuccessfulAttempt(mLockPatternUtils,
                             mUserManager, mEffectiveUserId);
                 }
-                mBiometricManager.onConfirmDeviceCredentialSuccess();
                 startDisappearAnimation(intent);
                 ConfirmDeviceCredentialUtils.checkForPendingIntent(getActivity());
             } else {
