Merge "[5G settings UI] add String for the 5G limited VoLTE dialog" into rvc-dev
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 14975fa..a695b1a 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4894,49 +4894,57 @@
     </string>
     <!-- Summary for the accessibility preference screen to enable screen magnification via the nav bar. [CHAR LIMIT=none] -->
     <string name="accessibility_screen_magnification_navbar_summary">When magnification is turned on, you can zoom in on your screen.\n\n<b>To zoom</b>, start magnification, then tap anywhere on the screen.\n<ul><li>Drag 2 or more fingers to scroll</li>\n<li>Pinch 2 or more fingers to adjust zoom</li></ul>\n\n<b>To zoom temporarily</b>, start magnification, then touch &amp; hold anywhere on the screen.\n<ul><li>Drag to move around the screen</li>\n<li>Lift finger to zoom out</li></ul>\n\nYou can’t zoom in on the keyboard or navigation bar.</string>
-    <!-- Title for the Accessibility tutorial dialog in Accessibility service with button. [CHAR LIMIT=50] -->
+    <!-- Title for the accessibility tutorial dialog in accessibility service with button. [CHAR LIMIT=50] -->
     <string name="accessibility_tutorial_dialog_title_button">Use accessibility button to open</string>
-    <!-- Title for the Accessibility tutorial dialog in Accessibility service with gesture. [CHAR LIMIT=50] -->
+    <!-- Title for the accessibility tutorial dialog in accessibility service with volume keys. [CHAR LIMIT=50] -->
+    <string name="accessibility_tutorial_dialog_title_volume">Hold volume key to open</string>
+    <!-- Title for the accessibility tutorial dialog in accessibility service with triple tap. [CHAR LIMIT=100] -->
+    <string name="accessibility_tutorial_dialog_title_triple">Triple tap screen to open</string>
+    <!-- Title for the accessibility tutorial dialog in accessibility service with gesture. [CHAR LIMIT=50] -->
     <string name="accessibility_tutorial_dialog_title_gesture">Use gesture to open</string>
-    <!-- Title for the Accessibility tutorial dialog in gesture navigation settings. [CHAR LIMIT=50] -->
+    <!-- Title for the accessibility tutorial dialog in gesture navigation settings. [CHAR LIMIT=50] -->
     <string name="accessibility_tutorial_dialog_title_gesture_settings">Use new accessibility gesture</string>
-    <!-- Message for the Accessibility tutorial dialog when user enables an accessibility service while using the 3-button nav bar. [CHAR LIMIT=NONE] -->
-    <string name="accessibility_tutorial_dialog_message_button">To turn this service on or off, tap the accessibility button <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> on the bottom of your screen.\n\nTo switch between services, touch &amp; hold the accessibility button.</string>
-    <!-- Message for the Accessibility tutorial dialog when user enables an accessibility service while using gesture navigation and touch exploration is not enabled. [CHAR LIMIT=NONE] -->
-    <string name="accessibility_tutorial_dialog_message_gesture">To turn this service on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between services, swipe up with two fingers and hold.</string>
-    <!-- Message for the Accessibility tutorial dialog when user enables an accessibility service while using gesture navigation and touch exploration is enabled. [CHAR LIMIT=NONE] -->
-    <string name="accessibility_tutorial_dialog_message_gesture_talkback">To turn this service on or off, swipe up from the bottom of the screen with three fingers.\n\nTo switch between services, swipe up with three fingers and hold.</string>
-    <!-- Message for the Accessibility tutorial dialog when user chooses gesture navigation in navigation settings, an accessibility service is using the accessibility button, and touch exploration is disabled. [CHAR LIMIT=NONE] -->
-    <string name="accessibility_tutorial_dialog_message_gesture_settings">To turn an accessibility service on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between services, swipe up with two fingers and hold.</string>
-    <!-- Message for the Accessibility tutorial dialog when user chooses gesture navigation in navigation settings, an accessibility service is using the accessibility button, and touch exploration is enabled. [CHAR LIMIT=NONE] -->
-    <string name="accessibility_tutorial_dialog_message_gesture_settings_talkback">To turn an accessibility service on or off, swipe up from the bottom of the screen with three fingers.\n\nTo switch between services, swipe up with three fingers and hold.</string>
-    <!-- Button for the Accessibility tutorial dialog to dismiss the dialog when user clicks it. [CHAR LIMIT=10] -->
+    <!-- Message for the accessibility tutorial dialog when user enables an accessibility service while using the 3-button nav bar. [CHAR LIMIT=NONE] -->
+    <string name="accessibility_tutorial_dialog_message_button">To turn this app on or off, tap the accessibility button <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> on the bottom of your screen.\n\nTo switch between apps, touch &amp; hold the accessibility button.</string>
+    <!-- Instruction for the accessibility tutorial dialog in accessibility service with volume keys. [CHAR LIMIT=100] -->
+    <string name="accessibility_tutorial_dialog_message_volume">To turn this app on or off, press &amp; hold both volume keys for 1 second.</string>
+    <!-- Instruction for the accessibility tutorial dialog in accessibility service with triple tap. [CHAR LIMIT=100] -->
+    <string name="accessibility_tutorial_dialog_message_triple">To start and stop magnification, triple-tap anywhere on your screen.</string>
+    <!-- Message for the accessibility tutorial dialog when user enables an accessibility service while using gesture navigation and touch exploration is not enabled. [CHAR LIMIT=NONE] -->
+    <string name="accessibility_tutorial_dialog_message_gesture">To turn this app on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between apps, swipe up with two fingers and hold.</string>
+    <!-- Message for the accessibility tutorial dialog when user enables an accessibility service while using gesture navigation and touch exploration is enabled. [CHAR LIMIT=NONE] -->
+    <string name="accessibility_tutorial_dialog_message_gesture_talkback">To turn this app on or off, swipe up from the bottom of the screen with three fingers.\n\nTo switch between apps, swipe up with three fingers and hold.</string>
+    <!-- Message for the accessibility tutorial dialog when user chooses gesture navigation in navigation settings, an accessibility service is using the accessibility button, and touch exploration is disabled. [CHAR LIMIT=NONE] -->
+    <string name="accessibility_tutorial_dialog_message_gesture_settings">To turn an accessibility app on or off, swipe up from the bottom of the screen with two fingers.\n\nTo switch between apps, swipe up with two fingers and hold.</string>
+    <!-- Message for the accessibility tutorial dialog when user chooses gesture navigation in navigation settings, an accessibility service is using the accessibility button, and touch exploration is enabled. [CHAR LIMIT=NONE] -->
+    <string name="accessibility_tutorial_dialog_message_gesture_settings_talkback">To turn an accessibility app on or off, swipe up from the bottom of the screen with three fingers.\n\nTo switch between apps, swipe up with three fingers and hold.</string>
+    <!-- Button for the accessibility tutorial dialog to dismiss the dialog when user clicks it. [CHAR LIMIT=10] -->
     <string name="accessibility_tutorial_dialog_button">Got it</string>
     <!-- Title for accessibility shortcut preference for accessibility apps. [CHAR LIMIT=40] -->
     <string name="accessibility_shortcut_title"><xliff:g id="service" example="Select to Speak">%1$s</xliff:g> shortcut</string>
-    <!-- Title for software shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
+    <!-- Title for software shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
     <string name="accessibility_shortcut_edit_summary_software">Accessibility Button</string>
-    <!-- Title for software shortcut in gesture mode in Accessibility edit shortcut dialog while using gesture navigation is enabled. [CHAR LIMIT=NONE] -->
+    <!-- Title for software shortcut in gesture mode in accessibility edit shortcut dialog while using gesture navigation is enabled. [CHAR LIMIT=NONE] -->
     <string name="accessibility_shortcut_edit_dialog_title_software_gesture">Swipe up with 2 fingers</string>
-    <!-- Title for software shortcut in gesture mode in Accessibility edit shortcut dialog while using gesture navigation and touch exploration are enabled. [CHAR LIMIT=NONE] -->
+    <!-- Title for software shortcut in gesture mode in accessibility edit shortcut dialog while using gesture navigation and touch exploration are enabled. [CHAR LIMIT=NONE] -->
     <string name="accessibility_shortcut_edit_dialog_title_software_gesture_talkback">Swipe up with 3 fingers</string>
     <!-- Summary for accessibility shortcut preference for software shortcut type. [CHAR LIMIT=NONE] -->
     <string name="accessibility_shortcut_edit_dialog_title_software">Tap accessibility button</string>
-    <!-- Summary for software shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
+    <!-- Summary for software shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
     <string name="accessibility_shortcut_edit_dialog_summary_software">Tap the accessibility button <xliff:g id="accessibility_icon" example="[Icon]">%s</xliff:g> at the bottom of your screen</string>
-    <!-- Summary for software shortcut in gesture mode in Accessibility edit shortcut dialog while using gesture navigation is enabled. [CHAR LIMIT=NONE] -->
+    <!-- Summary for software shortcut in gesture mode in accessibility edit shortcut dialog while using gesture navigation is enabled. [CHAR LIMIT=NONE] -->
     <string name="accessibility_shortcut_edit_dialog_summary_software_gesture">Swipe up from the bottom of the screen with 2 fingers</string>
-    <!-- Summary for software shortcut in gesture mode in Accessibility edit shortcut dialog while using gesture navigation and touch exploration are enabled [CHAR LIMIT=NONE] -->
+    <!-- Summary for software shortcut in gesture mode in accessibility edit shortcut dialog while using gesture navigation and touch exploration are enabled [CHAR LIMIT=NONE] -->
     <string name="accessibility_shortcut_edit_dialog_summary_software_gesture_talkback">Swipe up from the bottom of the screen with 3 fingers</string>
-    <!-- Title for hardware shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
+    <!-- Title for hardware shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
     <string name="accessibility_shortcut_edit_dialog_title_hardware">Hold volume keys</string>
-    <!-- Summary for hardware shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
+    <!-- Summary for hardware shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
     <string name="accessibility_shortcut_edit_dialog_summary_hardware">Press &amp; hold both volume keys for 1 second</string>
-    <!-- Title for triple tap shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
+    <!-- Title for triple tap shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
     <string name="accessibility_shortcut_edit_dialog_title_triple_tap">Triple-tap screen</string>
-    <!-- Summary for triple tap shortcut in Accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
+    <!-- Summary for triple tap shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
     <string name="accessibility_shortcut_edit_dialog_summary_triple_tap">Quickly tap screen 3 times. This shortcut may slow down your device.</string>
-    <!-- Title for the Accessibility edit shortcut dialog to save the preference when user clicks it. [CHAR LIMIT=10] -->
+    <!-- Title for the accessibility edit shortcut dialog to save the preference when user clicks it. [CHAR LIMIT=10] -->
     <string name="accessibility_shortcut_edit_dialog_title_advance">Advanced</string>
     <!-- Summary text appearing on the accessibility preference screen to enable screen magnification from the nav bar when the feature is enabled, but the accessibility button is not configured correctly for the feature to be used [CHAR LIMIT=none] -->
     <string name="accessibility_screen_magnification_navbar_configuration_warning">The Accessibility button is set to <xliff:g id="service" example="Select to Speak">%1$s</xliff:g>. To use magnification, touch &amp; hold the Accessibility button, then select magnification.</string>
@@ -6997,7 +7005,7 @@
     <string name="apps_with_restrictions_settings_button">Expand settings for application</string>
 
     <!-- NFC payment settings --><skip/>
-    <string name="nfc_payment_settings_title">Tap &amp; pay</string>
+    <string name="nfc_payment_settings_title">Contactless payments</string>
     <!-- Caption for button linking to a page explaining how Tap and Pay works-->
     <string name="nfc_payment_how_it_works">How it works</string>
     <!-- String shown when there are no NFC payment applications installed -->
@@ -9748,7 +9756,7 @@
     <!-- Label for setting which controls whether app can display over other apps [CHAR LIMIT=45] -->
     <string name="permit_draw_overlay">Allow display over other apps</string>
     <!-- Description of allowing overlay setting [CHAR LIMIT=NONE] -->
-    <string name="allow_overlay_description">Allow this app to display on top of other apps you\u2019re using. It may interfere with your use of those apps or change the way they seem to appear or behave.</string>
+    <string name="allow_overlay_description">Allow this app to display on top of other apps you\u2019re using. This app will be able to see where you tap or change what\u2019s displayed on the screen.</string>
 
     <!-- Manager External Storage settings title [CHAR LIMIT=40] -->
     <string name="manage_external_storage_title">All files access</string>
diff --git a/src/com/android/settings/development/EnhancedConnectivityPreferenceController.java b/src/com/android/settings/development/EnhancedConnectivityPreferenceController.java
index 2dbd7d1..dc65973 100644
--- a/src/com/android/settings/development/EnhancedConnectivityPreferenceController.java
+++ b/src/com/android/settings/development/EnhancedConnectivityPreferenceController.java
@@ -37,7 +37,7 @@
 
     @VisibleForTesting
     static final int ENHANCED_CONNECTIVITY_ON = 1;
-    // default is enhanced connectivity disabled.
+    // default is enhanced connectivity enabled.
     @VisibleForTesting
     static final int ENHANCED_CONNECTIVITY_OFF = 0;
 
@@ -65,7 +65,7 @@
     public void updateState(Preference preference) {
         final int enhancedConnectivityEnabled = Settings.Global.getInt(
                 mContext.getContentResolver(), Settings.Global.ENHANCED_CONNECTIVITY_ENABLED,
-                ENHANCED_CONNECTIVITY_OFF);
+                ENHANCED_CONNECTIVITY_ON);
         ((SwitchPreference) mPreference).setChecked(
                 enhancedConnectivityEnabled == ENHANCED_CONNECTIVITY_ON);
     }
@@ -75,7 +75,7 @@
         super.onDeveloperOptionsSwitchDisabled();
         Settings.Global.putInt(mContext.getContentResolver(),
                 Settings.Global.ENHANCED_CONNECTIVITY_ENABLED,
-                ENHANCED_CONNECTIVITY_OFF);
-        ((SwitchPreference) mPreference).setChecked(false);
+                ENHANCED_CONNECTIVITY_ON);
+        ((SwitchPreference) mPreference).setChecked(true);
     }
 }
diff --git a/src/com/android/settings/network/ims/ImsQueryController.java b/src/com/android/settings/network/ims/ImsQueryController.java
index 8fdad40..068a805 100644
--- a/src/com/android/settings/network/ims/ImsQueryController.java
+++ b/src/com/android/settings/network/ims/ImsQueryController.java
@@ -20,6 +20,7 @@
 import android.telephony.SubscriptionManager;
 import android.telephony.ims.ImsException;
 import android.telephony.ims.ImsMmTelManager;
+import android.telephony.ims.feature.ImsFeature;
 import android.telephony.ims.feature.MmTelFeature;
 import android.telephony.ims.stub.ImsRegistrationImplBase;
 
@@ -84,4 +85,20 @@
     boolean isProvisionedOnDevice(int subId) {
         return (new ImsQueryProvisioningStat(subId, mCapability, mTech)).query();
     }
+
+    @VisibleForTesting
+    boolean isServiceStateReady(int subId) throws InterruptedException, ImsException,
+            IllegalArgumentException {
+        if (!SubscriptionManager.isValidSubscriptionId(subId)) {
+            return false;
+        }
+
+        final ImsMmTelManager imsMmTelManager = ImsMmTelManager.createForSubscriptionId(subId);
+        // TODO: have a shared thread pool instead of create ExecutorService
+        //       everytime to improve performance.
+        final ExecutorService executor = Executors.newSingleThreadExecutor();
+        final IntegerConsumer intResult = new IntegerConsumer();
+        imsMmTelManager.getFeatureState(executor, intResult);
+        return (intResult.get(TIMEOUT_MILLIS) == ImsFeature.STATE_READY);
+    }
 }
diff --git a/src/com/android/settings/network/ims/IntegerConsumer.java b/src/com/android/settings/network/ims/IntegerConsumer.java
new file mode 100644
index 0000000..02c8227
--- /dev/null
+++ b/src/com/android/settings/network/ims/IntegerConsumer.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.network.ims;
+
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Consumer;
+
+class IntegerConsumer extends Semaphore implements Consumer<Integer> {
+
+    private static final String TAG = "IntegerConsumer";
+
+    IntegerConsumer() {
+        super(0);
+        mValue = new AtomicInteger();
+    }
+
+    private volatile AtomicInteger mValue;
+
+    /**
+     * Get boolean value reported from callback
+     *
+     * @param timeout callback waiting time in milliseconds
+     * @return int value reported
+     * @throws InterruptedException when thread get interrupted
+     */
+    int get(long timeout) throws InterruptedException {
+        tryAcquire(timeout, TimeUnit.MILLISECONDS);
+        return mValue.get();
+    }
+
+    /**
+     * Implementation of {@link Consumer#accept(Integer)}
+     *
+     * @param value int reported from {@link Consumer#accept(Integer)}
+     */
+    public void accept(Integer value) {
+        if (value != null) {
+            mValue.set(value.intValue());
+        }
+        release();
+    }
+}
diff --git a/src/com/android/settings/network/ims/VtQueryImsState.java b/src/com/android/settings/network/ims/VtQueryImsState.java
index 60bd729..c077603 100644
--- a/src/com/android/settings/network/ims/VtQueryImsState.java
+++ b/src/com/android/settings/network/ims/VtQueryImsState.java
@@ -20,20 +20,23 @@
 import android.telecom.TelecomManager;
 import android.telephony.AccessNetworkConstants;
 import android.telephony.SubscriptionManager;
+import android.telephony.ims.ImsException;
 import android.telephony.ims.feature.MmTelFeature;
 import android.telephony.ims.stub.ImsRegistrationImplBase;
+import android.util.Log;
 
 import androidx.annotation.VisibleForTesting;
 
 import com.android.ims.ImsManager;
 import com.android.settings.network.SubscriptionUtil;
-import com.android.settings.network.telephony.MobileNetworkUtils;
 
 /**
  * Controller class for querying VT status
  */
 public class VtQueryImsState extends ImsQueryController {
 
+    private static final String LOG_TAG = "VtQueryImsState";
+
     private Context mContext;
     private int mSubId;
 
@@ -71,14 +74,25 @@
      * @return true when Video Call can be performed, otherwise false
      */
     public boolean isReadyToVideoCall() {
+        if (!isProvisionedOnDevice(mSubId)) {
+            return false;
+        }
+
         final ImsManager imsManager = getImsManager(mSubId);
         if (imsManager == null) {
             return false;
         }
 
-        return imsManager.isVtEnabledByPlatform()
-                && isProvisionedOnDevice(mSubId)
-                && MobileNetworkUtils.isImsServiceStateReady(imsManager);
+        if (!imsManager.isVtEnabledByPlatform()) {
+            return false;
+        }
+
+        try {
+            return isServiceStateReady(mSubId);
+        } catch (InterruptedException | IllegalArgumentException | ImsException exception) {
+            Log.w(LOG_TAG, "fail to get Vt service status. subId=" + mSubId, exception);
+        }
+        return false;
     }
 
     /**
diff --git a/src/com/android/settings/panel/MediaOutputPanel.java b/src/com/android/settings/panel/MediaOutputPanel.java
index 2a9669a..998cfc8 100644
--- a/src/com/android/settings/panel/MediaOutputPanel.java
+++ b/src/com/android/settings/panel/MediaOutputPanel.java
@@ -33,6 +33,7 @@
 import android.media.MediaMetadata;
 import android.media.session.MediaController;
 import android.media.session.MediaSessionManager;
+import android.media.session.PlaybackState;
 import android.net.Uri;
 import android.text.TextUtils;
 import android.util.Log;
@@ -66,12 +67,11 @@
     private final Context mContext;
     private final String mPackageName;
 
-    private PanelContentCallback mCallback;
-    private boolean mIsCustomizedButtonUsed = true;
-
     @VisibleForTesting
     LocalMediaManager mLocalMediaManager;
 
+    private PanelContentCallback mCallback;
+    private boolean mIsCustomizedButtonUsed = true;
     private MediaSessionManager mMediaSessionManager;
     private MediaController mMediaController;
 
@@ -255,5 +255,12 @@
                 mCallback.onHeaderChanged();
             }
         }
+
+        @Override
+        public void onPlaybackStateChanged(PlaybackState state) {
+            if (mCallback != null && state.getState() != PlaybackState.STATE_PLAYING) {
+                mCallback.forceClose();
+            }
+        }
     };
 }
diff --git a/src/com/android/settings/panel/PanelContentCallback.java b/src/com/android/settings/panel/PanelContentCallback.java
index 989082f..63c2c55 100644
--- a/src/com/android/settings/panel/PanelContentCallback.java
+++ b/src/com/android/settings/panel/PanelContentCallback.java
@@ -32,4 +32,9 @@
      * a group
      */
     void onHeaderChanged();
+
+    /**
+     * It will be called when panel requests to close itself.
+     */
+    void forceClose();
 }
diff --git a/src/com/android/settings/panel/PanelFragment.java b/src/com/android/settings/panel/PanelFragment.java
index ed5c755..28515fd 100644
--- a/src/com/android/settings/panel/PanelFragment.java
+++ b/src/com/android/settings/panel/PanelFragment.java
@@ -433,5 +433,16 @@
                 mHeaderSubtitle.setText(mPanel.getSubTitle());
             });
         }
+
+        @Override
+        public void forceClose() {
+            mPanelClosedKey = PanelClosedKeys.KEY_OTHERS;
+            getFragmentActivity().finish();
+        }
+
+        @VisibleForTesting
+        FragmentActivity getFragmentActivity() {
+            return getActivity();
+        }
     }
 }
diff --git a/src/com/android/settings/password/BiometricFragment.java b/src/com/android/settings/password/BiometricFragment.java
index bc0e5c7..7e78322 100644
--- a/src/com/android/settings/password/BiometricFragment.java
+++ b/src/com/android/settings/password/BiometricFragment.java
@@ -70,6 +70,13 @@
             });
             cleanup();
         }
+
+        @Override
+        public void onAuthenticationFailed() {
+            mClientExecutor.execute(() -> {
+                mClientCallback.onAuthenticationFailed();
+            });
+        }
     };
 
     private final DialogInterface.OnClickListener mNegativeButtonListener =
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
index 83368f9..220b649 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialActivity.java
@@ -111,6 +111,7 @@
     });
 
     private AuthenticationCallback mAuthenticationCallback = new AuthenticationCallback() {
+        @Override
         public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) {
             if (!mGoingToBackground) {
                 if (errorCode == BiometricPrompt.BIOMETRIC_ERROR_USER_CANCELED
@@ -123,17 +124,24 @@
             }
         }
 
+        @Override
         public void onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result) {
             mTrustManager.setDeviceLockedForUser(mUserId, false);
-
+            final boolean isStrongAuth = result.getAuthenticationType()
+                    == BiometricPrompt.AUTHENTICATION_RESULT_TYPE_DEVICE_CREDENTIAL;
             ConfirmDeviceCredentialUtils.reportSuccessfulAttempt(mLockPatternUtils, mUserManager,
-                    mUserId);
+                    mDevicePolicyManager, mUserId, isStrongAuth);
             ConfirmDeviceCredentialUtils.checkForPendingIntent(
                     ConfirmDeviceCredentialActivity.this);
 
             setResult(Activity.RESULT_OK);
             finish();
         }
+
+        @Override
+        public void onAuthenticationFailed() {
+            mDevicePolicyManager.reportFailedBiometricAttempt(mUserId);
+        }
     };
 
     private String getStringForError(int errorCode) {
diff --git a/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java b/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java
index 11d6924..a5febeb 100644
--- a/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java
+++ b/src/com/android/settings/password/ConfirmDeviceCredentialUtils.java
@@ -20,6 +20,7 @@
 import android.app.ActivityManager;
 import android.app.ActivityOptions;
 import android.app.IActivityManager;
+import android.app.admin.DevicePolicyManager;
 import android.content.Intent;
 import android.content.IntentSender;
 import android.os.RemoteException;
@@ -54,8 +55,12 @@
     }
 
     public static void reportSuccessfulAttempt(LockPatternUtils utils, UserManager userManager,
-            int userId) {
-        utils.reportSuccessfulPasswordAttempt(userId);
+            DevicePolicyManager dpm, int userId, boolean isStrongAuth) {
+        if (isStrongAuth) {
+            utils.reportSuccessfulPasswordAttempt(userId);
+        } else {
+            dpm.reportSuccessfulBiometricAttempt(userId);
+        }
         if (userManager.isManagedProfile(userId)) {
             // Keyguard is responsible to disable StrongAuth for primary user. Disable StrongAuth
             // for work challenge only here.
diff --git a/src/com/android/settings/password/ConfirmLockPassword.java b/src/com/android/settings/password/ConfirmLockPassword.java
index ce8813f..260919d 100644
--- a/src/com/android/settings/password/ConfirmLockPassword.java
+++ b/src/com/android/settings/password/ConfirmLockPassword.java
@@ -475,7 +475,8 @@
             if (matched) {
                 if (newResult) {
                     ConfirmDeviceCredentialUtils.reportSuccessfulAttempt(mLockPatternUtils,
-                            mUserManager, mEffectiveUserId);
+                            mUserManager, mDevicePolicyManager, mEffectiveUserId,
+                            /* isStrongAuth */ true);
                 }
                 startDisappearAnimation(intent);
                 ConfirmDeviceCredentialUtils.checkForPendingIntent(getActivity());
diff --git a/src/com/android/settings/password/ConfirmLockPattern.java b/src/com/android/settings/password/ConfirmLockPattern.java
index b2afb22..06f3d93 100644
--- a/src/com/android/settings/password/ConfirmLockPattern.java
+++ b/src/com/android/settings/password/ConfirmLockPattern.java
@@ -509,7 +509,8 @@
             if (matched) {
                 if (newResult) {
                     ConfirmDeviceCredentialUtils.reportSuccessfulAttempt(mLockPatternUtils,
-                            mUserManager, mEffectiveUserId);
+                            mUserManager, mDevicePolicyManager, mEffectiveUserId,
+                            /* isStrongAuth */ true);
                 }
                 startDisappearAnimation(intent);
                 ConfirmDeviceCredentialUtils.checkForPendingIntent(getActivity());
diff --git a/src/com/android/settings/security/ConfirmSimDeletionPreferenceController.java b/src/com/android/settings/security/ConfirmSimDeletionPreferenceController.java
index 8d093c0..bf807a1 100644
--- a/src/com/android/settings/security/ConfirmSimDeletionPreferenceController.java
+++ b/src/com/android/settings/security/ConfirmSimDeletionPreferenceController.java
@@ -17,6 +17,7 @@
 package com.android.settings.security;
 
 import android.app.KeyguardManager;
+import android.app.settings.SettingsEnums;
 import android.content.Context;
 import android.provider.Settings;
 
@@ -26,19 +27,23 @@
 import com.android.settings.R;
 import com.android.settings.core.BasePreferenceController;
 import com.android.settings.network.telephony.MobileNetworkUtils;
+import com.android.settings.overlay.FeatureFactory;
 import com.android.settings.wifi.dpp.WifiDppUtils;
+import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
 
 /** Enable/disable user confirmation before deleting an eSim */
 public class ConfirmSimDeletionPreferenceController extends BasePreferenceController implements
         Preference.OnPreferenceChangeListener{
     public static final String KEY_CONFIRM_SIM_DELETION = "confirm_sim_deletion";
     private boolean mConfirmationDefaultOn;
+    private MetricsFeatureProvider mMetricsFeatureProvider;
 
     public ConfirmSimDeletionPreferenceController(Context context, String key) {
         super(context, key);
         mConfirmationDefaultOn =
                 context.getResources()
                         .getBoolean(R.bool.config_sim_deletion_confirmation_default_on);
+        mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
     }
 
     @Override
@@ -72,11 +77,15 @@
             return false;
         }
         if (!isChecked()) {
+            mMetricsFeatureProvider.action(mContext,
+                    SettingsEnums.ACTION_CONFIRM_SIM_DELETION_ON);
             setChecked(true);
             return true;
         } else {
             // prevent disabling the feature until authorized
             WifiDppUtils.showLockScreen(mContext, () -> {
+                mMetricsFeatureProvider.action(mContext,
+                        SettingsEnums.ACTION_CONFIRM_SIM_DELETION_OFF);
                 // set data
                 setChecked(false);
                 // set UI
diff --git a/tests/robotests/src/com/android/settings/development/EnhancedConnectivityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/EnhancedConnectivityPreferenceControllerTest.java
index 6fd6f55..171fc6b 100644
--- a/tests/robotests/src/com/android/settings/development/EnhancedConnectivityPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/EnhancedConnectivityPreferenceControllerTest.java
@@ -88,20 +88,20 @@
     }
 
     @Test
-    public void onDeveloperOptionsDisabled_shouldDisablePreference() {
-        mController.onDeveloperOptionsDisabled();
+    public void onDeveloperOptionsDisabled_shouldEnablePreference() {
+        mController.onDeveloperOptionsSwitchDisabled();
 
         verify(mPreference).setEnabled(false);
-        verify(mPreference).setChecked(false);
+        verify(mPreference).setChecked(true);
 
-        assertThat(isSettingEnabled()).isFalse();
+        assertThat(isSettingEnabled()).isTrue();
     }
 
     private boolean isSettingEnabled() {
         return Settings.Global.getInt(mContext.getContentResolver(),
                 Settings.Global.ENHANCED_CONNECTIVITY_ENABLED,
-                EnhancedConnectivityPreferenceController.ENHANCED_CONNECTIVITY_OFF
-                /* default off */)
+                EnhancedConnectivityPreferenceController.ENHANCED_CONNECTIVITY_ON
+                /* default on */)
                 == EnhancedConnectivityPreferenceController.ENHANCED_CONNECTIVITY_ON;
     }
 }
diff --git a/tests/robotests/src/com/android/settings/network/ims/MockVtQueryImsState.java b/tests/robotests/src/com/android/settings/network/ims/MockVtQueryImsState.java
index 4fd7d0c..3daf6cb 100644
--- a/tests/robotests/src/com/android/settings/network/ims/MockVtQueryImsState.java
+++ b/tests/robotests/src/com/android/settings/network/ims/MockVtQueryImsState.java
@@ -17,6 +17,7 @@
 package com.android.settings.network.ims;
 
 import android.content.Context;
+import android.telephony.ims.ImsException;
 
 import com.android.ims.ImsManager;
 
@@ -29,6 +30,7 @@
     private Boolean mIsTtyOnVolteEnabled;
     private Boolean mIsProvisionedOnDevice;
     private Boolean mIsEnabledByUser;
+    private Boolean mIsServiceStateReady;
 
     /**
      * Constructor
@@ -68,6 +70,19 @@
         return super.isProvisionedOnDevice(subId);
     }
 
+    public void setServiceStateReady(boolean isReady) {
+        mIsServiceStateReady = isReady;
+    }
+
+    @Override
+    boolean isServiceStateReady(int subId) throws InterruptedException, ImsException,
+            IllegalArgumentException {
+        if (mIsServiceStateReady != null) {
+            return mIsServiceStateReady;
+        }
+        return super.isServiceStateReady(subId);
+    }
+
     public void setIsEnabledByUser(boolean enabled) {
         mIsEnabledByUser = enabled;
     }
diff --git a/tests/robotests/src/com/android/settings/network/telephony/VideoCallingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/VideoCallingPreferenceControllerTest.java
index c766289..04fc4b9 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/VideoCallingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/VideoCallingPreferenceControllerTest.java
@@ -27,7 +27,6 @@
 import android.telephony.CarrierConfigManager;
 import android.telephony.TelephonyManager;
 import android.telephony.ims.ProvisioningManager;
-import android.telephony.ims.feature.ImsFeature;
 
 import androidx.preference.PreferenceScreen;
 import androidx.preference.SwitchPreference;
@@ -98,7 +97,7 @@
 
         doReturn(true).when(mImsManager).isVtEnabledByPlatform();
         mQueryImsState.setIsProvisionedOnDevice(true);
-        doReturn(ImsFeature.STATE_READY).when(mImsManager).getImsServiceState();
+        mQueryImsState.setServiceStateReady(true);
         doReturn(true).when(mTelephonyManager).isDataEnabled();
 
         mController.mCallState = TelephonyManager.CALL_STATE_IDLE;
diff --git a/tests/robotests/src/com/android/settings/panel/MediaOutputPanelTest.java b/tests/robotests/src/com/android/settings/panel/MediaOutputPanelTest.java
index 07f01fc..43cecfe 100644
--- a/tests/robotests/src/com/android/settings/panel/MediaOutputPanelTest.java
+++ b/tests/robotests/src/com/android/settings/panel/MediaOutputPanelTest.java
@@ -22,6 +22,7 @@
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -30,6 +31,7 @@
 import android.media.MediaMetadata;
 import android.media.session.MediaController;
 import android.media.session.MediaSessionManager;
+import android.media.session.PlaybackState;
 import android.net.Uri;
 
 import com.android.settings.R;
@@ -67,6 +69,8 @@
     private LocalMediaManager mLocalMediaManager;
     @Mock
     private PanelContentCallback mCallback;
+    @Mock
+    private PlaybackState mPlaybackState;
 
     private MediaOutputPanel mPanel;
     private Context mContext;
@@ -259,4 +263,19 @@
 
         verify(mCallback).onHeaderChanged();
     }
+
+    @Test
+    public void onPlaybackStateChanged_stateFromPlayingToStopped_verifyCallForceClose() {
+        mPanel.onStart();
+        verify(mMediaController).registerCallback(mControllerCbs.capture());
+        final MediaController.Callback controllerCallbacks = mControllerCbs.getValue();
+        when(mPlaybackState.getState()).thenReturn(PlaybackState.STATE_PLAYING);
+        controllerCallbacks.onPlaybackStateChanged(mPlaybackState);
+        verify(mCallback, never()).forceClose();
+
+        when(mPlaybackState.getState()).thenReturn(PlaybackState.STATE_STOPPED);
+        controllerCallbacks.onPlaybackStateChanged(mPlaybackState);
+
+        verify(mCallback).forceClose();
+    }
 }
diff --git a/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java b/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java
index 07ca48b..9df5af1 100644
--- a/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/panel/PanelFragmentTest.java
@@ -23,6 +23,7 @@
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import android.app.settings.SettingsEnums;
 import android.content.Context;
@@ -236,4 +237,17 @@
         assertThat(headerTitle.getText()).isEqualTo(TITLE2);
         assertThat(headerSubtitle.getText()).isEqualTo(SUBTITLE2);
     }
+
+    @Test
+    public void forceClose_verifyFinish() {
+        initFakeActivity();
+        verify(mFakePanelContent).registerCallback(mPanelContentCbs.capture());
+        final PanelContentCallback panelContentCallbacks = spy(mPanelContentCbs.getValue());
+        when(((PanelFragment.LocalPanelCallback) panelContentCallbacks).getFragmentActivity())
+                .thenReturn(mActivity);
+
+        panelContentCallbacks.forceClose();
+
+        verify(mActivity).finish();
+    }
 }
\ No newline at end of file