Merge "Import translations. DO NOT MERGE" into rvc-dev
diff --git a/res/values-ar/arrays.xml b/res/values-ar/arrays.xml
index 60f7832..4218a24 100644
--- a/res/values-ar/arrays.xml
+++ b/res/values-ar/arrays.xml
@@ -288,7 +288,7 @@
     <item msgid="7621394050624063528">"موقع وهمي"</item>
     <item msgid="37519917674959757">"قراءة مساحة التخزين"</item>
     <item msgid="3868809525697401379">"كتابة مساحة التخزين"</item>
-    <item msgid="2504191192460059817">"تشغيل الشاشة"</item>
+    <item msgid="2504191192460059817">"تفعيل الشاشة"</item>
     <item msgid="7905819538788103556">"الحصول على الحسابات"</item>
     <item msgid="1675025662248079254">"التشغيل في الخلفية"</item>
     <item msgid="2553974920157061225">"مستوى صوت \"سهولة الاستخدام\""</item>
@@ -355,7 +355,7 @@
     <item msgid="2363460595607829243">"موقع وهمي"</item>
     <item msgid="3778165903878569143">"قراءة مساحة التخزين"</item>
     <item msgid="555939881912035315">"كتابة مساحة التخزين"</item>
-    <item msgid="4281352581602735717">"تشغيل الشاشة"</item>
+    <item msgid="4281352581602735717">"تفعيل الشاشة"</item>
     <item msgid="346122795998225472">"الحصول على الحسابات"</item>
     <item msgid="3756073389408535680">"التشغيل في الخلفية"</item>
     <item msgid="2114661179947426734">"مستوى صوت \"سهولة الاستخدام\""</item>
diff --git a/res/values-az/arrays.xml b/res/values-az/arrays.xml
index 2a657b8..1a73dd6 100644
--- a/res/values-az/arrays.xml
+++ b/res/values-az/arrays.xml
@@ -330,7 +330,7 @@
     <item msgid="745291221457314879">"Master həcmi"</item>
     <item msgid="4722479281326245754">"Səs həcmi"</item>
     <item msgid="6749550886745567276">"Zəng həcmi"</item>
-    <item msgid="2218685029915863168">"Media həcmi"</item>
+    <item msgid="2218685029915863168">"Media səsi"</item>
     <item msgid="4266577290496513640">"Siqnal səsi"</item>
     <item msgid="8608084169623998854">"Bildiriş həcmi"</item>
     <item msgid="7948784184567841794">"Bluetooth həcmi"</item>
diff --git a/res/values-be/arrays.xml b/res/values-be/arrays.xml
index 30d93d9..0e22b48 100644
--- a/res/values-be/arrays.xml
+++ b/res/values-be/arrays.xml
@@ -100,8 +100,8 @@
     <!-- no translation found for wifi_tether_security:1 (1428294025896439258) -->
   <string-array name="eap_ocsp_type">
     <item msgid="7202884222741437608">"Не правяраць"</item>
-    <item msgid="5703177653586269306">"Запыт стану сертыфікату"</item>
-    <item msgid="326388247868439528">"Патрэбны стан сертыфікату"</item>
+    <item msgid="5703177653586269306">"Запыт стану сертыфіката"</item>
+    <item msgid="326388247868439528">"Патрэбны стан сертыфіката"</item>
     <item msgid="1090956283885790552">"Патрабуюцца станы ўсіх недавераных сертыфікатаў"</item>
   </string-array>
   <string-array name="wifi_p2p_wps_setup">
diff --git a/res/values-fr-rCA/arrays.xml b/res/values-fr-rCA/arrays.xml
index cc6ea49..70688e9 100644
--- a/res/values-fr-rCA/arrays.xml
+++ b/res/values-fr-rCA/arrays.xml
@@ -102,7 +102,7 @@
     <item msgid="7202884222741437608">"Ne pas valider"</item>
     <item msgid="5703177653586269306">"Demander l\'état du certificat"</item>
     <item msgid="326388247868439528">"Exiger l\'état du certificat"</item>
-    <item msgid="1090956283885790552">"Exiger tous les états de certificat non fiable"</item>
+    <item msgid="1090956283885790552">"Exiger tous les états de certificats non fiables"</item>
   </string-array>
   <string-array name="wifi_p2p_wps_setup">
     <item msgid="1446717102923442720">"Bouton de commande"</item>
diff --git a/res/values-gu/arrays.xml b/res/values-gu/arrays.xml
index d326195..f019fd5 100644
--- a/res/values-gu/arrays.xml
+++ b/res/values-gu/arrays.xml
@@ -366,7 +366,7 @@
     <item msgid="6740026006576843477">"લાંબો"</item>
   </string-array>
   <string-array name="captioning_typeface_selector_titles">
-    <item msgid="2166553138528640250">"ડિફોલ્ટ"</item>
+    <item msgid="2166553138528640250">"ડિફૉલ્ટ"</item>
     <item msgid="4234707448428002595">"Sans-serif"</item>
     <item msgid="2390008695651897663">"Sans-serif condensed"</item>
     <item msgid="2396492419730702454">"Sans-serif monospace"</item>
@@ -391,7 +391,7 @@
     <item msgid="6838252010935384975">"ખૂબ મોટું ટેક્સ્ટ કદ"</item>
   </string-array>
   <string-array name="captioning_edge_type_selector_titles">
-    <item msgid="70686029249840227">"ડિફોલ્ટ"</item>
+    <item msgid="70686029249840227">"ડિફૉલ્ટ"</item>
     <item msgid="4224714345662348668">"કોઈ નહીં"</item>
     <item msgid="4132127611510627490">"બાહ્યરેખા"</item>
     <item msgid="1226216870460161087">"છાયો છોડો"</item>
diff --git a/res/values-uz/arrays.xml b/res/values-uz/arrays.xml
index 8c2b21e..7b0af94 100644
--- a/res/values-uz/arrays.xml
+++ b/res/values-uz/arrays.xml
@@ -264,7 +264,7 @@
     <item msgid="1249691739381713634">"ovoz balandligi"</item>
     <item msgid="6485000384018554920">"jiringlash tovushi"</item>
     <item msgid="3378000878531336372">"multimedia tovushi"</item>
-    <item msgid="5272927168355895681">"Signal balandligi"</item>
+    <item msgid="5272927168355895681">"Signal tovushi"</item>
     <item msgid="4422070755065530548">"xabarnoma tovush balandligi"</item>
     <item msgid="3250654589277825306">"bluetooth tovush balandligi"</item>
     <item msgid="4212187233638382465">"uyg‘oq turish"</item>
@@ -331,7 +331,7 @@
     <item msgid="4722479281326245754">"Ovoz balandligi"</item>
     <item msgid="6749550886745567276">"Jiringlash tovushi"</item>
     <item msgid="2218685029915863168">"Multimedia tovushi"</item>
-    <item msgid="4266577290496513640">"Signal balandligi"</item>
+    <item msgid="4266577290496513640">"Signal tovushi"</item>
     <item msgid="8608084169623998854">"Xabarnoma tovush balandligi"</item>
     <item msgid="7948784184567841794">"Bluetooth tovush balandligi"</item>
     <item msgid="1148968792599973150">"Uyg‘oq turish"</item>
diff --git a/res/values-vi/arrays.xml b/res/values-vi/arrays.xml
index 767ca83..ced3b5a 100644
--- a/res/values-vi/arrays.xml
+++ b/res/values-vi/arrays.xml
@@ -264,7 +264,7 @@
     <item msgid="1249691739381713634">"âm lượng thoại"</item>
     <item msgid="6485000384018554920">"âm lượng chuông"</item>
     <item msgid="3378000878531336372">"âm lượng nội dung nghe nhìn"</item>
-    <item msgid="5272927168355895681">"âm lượng báo thức"</item>
+    <item msgid="5272927168355895681">"âm lượng chuông báo"</item>
     <item msgid="4422070755065530548">"âm lượng thông báo"</item>
     <item msgid="3250654589277825306">"âm lượng bluetooth"</item>
     <item msgid="4212187233638382465">"không khóa màn hình"</item>
@@ -331,7 +331,7 @@
     <item msgid="4722479281326245754">"Âm lượng thoại"</item>
     <item msgid="6749550886745567276">"Âm lượng chuông"</item>
     <item msgid="2218685029915863168">"Âm lượng nội dung nghe nhìn"</item>
-    <item msgid="4266577290496513640">"Âm lượng báo thức"</item>
+    <item msgid="4266577290496513640">"Âm lượng chuông báo"</item>
     <item msgid="8608084169623998854">"Âm lượng thông báo"</item>
     <item msgid="7948784184567841794">"Âm lượng bluetooth"</item>
     <item msgid="1148968792599973150">"Không khóa màn hình"</item>
diff --git a/src/com/android/settings/media/MediaDeviceUpdateWorker.java b/src/com/android/settings/media/MediaDeviceUpdateWorker.java
index a976811..bce9c34 100644
--- a/src/com/android/settings/media/MediaDeviceUpdateWorker.java
+++ b/src/com/android/settings/media/MediaDeviceUpdateWorker.java
@@ -128,10 +128,11 @@
 
     public void connectDevice(MediaDevice device) {
         ThreadUtils.postOnBackgroundThread(() -> {
-            mLocalMediaManager.connectDevice(device);
-            ThreadUtils.postOnMainThread(() -> {
-                notifySliceChange();
-            });
+            if (mLocalMediaManager.connectDevice(device)) {
+                ThreadUtils.postOnMainThread(() -> {
+                    notifySliceChange();
+                });
+            }
         });
     }
 
diff --git a/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java b/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java
index 6917549..26c206d 100644
--- a/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java
+++ b/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceController.java
@@ -204,13 +204,16 @@
                     .createForSubscriptionId(mSubId);
 
             final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(mSubId);
+            final boolean isNrEnabledFromCarrierConfig = carrierConfig != null
+                    && carrierConfig.getBoolean(CarrierConfigManager.KEY_NR_ENABLED_BOOL);
             mAllowed5gNetworkType = checkSupportedRadioBitmask(
                     mTelephonyManager.getAllowedNetworkTypes(),
                     TelephonyManager.NETWORK_TYPE_BITMASK_NR);
-            mSupported5gRadioAccessFamily = checkSupportedRadioBitmask(
-                    mTelephonyManager.getSupportedRadioAccessFamily(),
+            mSupported5gRadioAccessFamily = isNrEnabledFromCarrierConfig
+                    && checkSupportedRadioBitmask(mTelephonyManager.getSupportedRadioAccessFamily(),
                     TelephonyManager.NETWORK_TYPE_BITMASK_NR);
             mIsGlobalCdma = mTelephonyManager.isLteCdmaEvdoGsmWcdmaEnabled()
+                    && carrierConfig != null
                     && carrierConfig.getBoolean(CarrierConfigManager.KEY_SHOW_CDMA_CHOICES_BOOL);
             mShow4gForLTE = carrierConfig != null && carrierConfig.getBoolean(
                     CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL);
@@ -573,7 +576,7 @@
          */
         private void add5gEntry(int value) {
             boolean isNRValue = value >= TelephonyManagerConstants.NETWORK_MODE_NR_ONLY;
-            if (mSupported5gRadioAccessFamily && mAllowed5gNetworkType && isNRValue) {
+            if (showNrList() && isNRValue) {
                 mEntries.add(mContext.getString(R.string.network_5G)
                         + mContext.getString(R.string.network_recommended));
                 mEntriesValue.add(value);
@@ -592,7 +595,7 @@
                     + " supported5GRadioAccessFamily: " + mSupported5gRadioAccessFamily
                     + " allowed5GNetworkType: " + mAllowed5gNetworkType);
             mEntries.add(mContext.getString(R.string.network_global));
-            if (mSupported5gRadioAccessFamily & mAllowed5gNetworkType) {
+            if (showNrList()) {
                 mEntriesValue.add(
                         TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA);
             } else {
@@ -601,11 +604,15 @@
             }
         }
 
+        private boolean showNrList() {
+            return mSupported5gRadioAccessFamily && mAllowed5gNetworkType;
+        }
+
         /**
          * Add LTE entry. If device supported 5G, show "LTE" instead of "LTE (recommended)".
          */
         private void addLteEntry(int value) {
-            if (mSupported5gRadioAccessFamily) {
+            if (showNrList()) {
                 mEntries.add(mContext.getString(R.string.network_lte_pure));
             } else {
                 mEntries.add(mContext.getString(R.string.network_lte));
@@ -617,7 +624,7 @@
          * Add 4G entry. If device supported 5G, show "4G" instead of "4G (recommended)".
          */
         private void add4gEntry(int value) {
-            if (mSupported5gRadioAccessFamily) {
+            if (showNrList()) {
                 mEntries.add(mContext.getString(R.string.network_4G_pure));
             } else {
                 mEntries.add(mContext.getString(R.string.network_4G));
diff --git a/src/com/android/settings/network/telephony/Enhanced4gBasePreferenceController.java b/src/com/android/settings/network/telephony/Enhanced4gBasePreferenceController.java
index 91d01d3..d6aed67 100644
--- a/src/com/android/settings/network/telephony/Enhanced4gBasePreferenceController.java
+++ b/src/com/android/settings/network/telephony/Enhanced4gBasePreferenceController.java
@@ -55,6 +55,7 @@
     Preference mPreference;
     private PhoneCallStateListener mPhoneStateListener;
     private boolean mShow5gLimitedDialog;
+    boolean mIsNrEnabledFromCarrierConfig;
     private boolean mHas5gCapability;
     @VisibleForTesting
     Integer mCallState;
@@ -95,6 +96,8 @@
 
         mShow5gLimitedDialog = carrierConfig.getBoolean(
                 CarrierConfigManager.KEY_VOLTE_5G_LIMITED_ALERT_DIALOG_BOOL);
+        mIsNrEnabledFromCarrierConfig = carrierConfig.getBoolean(
+                CarrierConfigManager.KEY_NR_ENABLED_BOOL);
         return this;
     }
 
@@ -244,7 +247,7 @@
 
     private boolean isDialogNeeded() {
         Log.d(TAG, "Has5gCapability:" + mHas5gCapability);
-        return mShow5gLimitedDialog && mHas5gCapability;
+        return mShow5gLimitedDialog && mHas5gCapability && mIsNrEnabledFromCarrierConfig;
     }
 
     private void show5gLimitedDialog(ImsMmTelManager imsMmTelManager) {
diff --git a/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java b/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java
index b4c1815..aaa96bc 100644
--- a/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java
+++ b/src/com/android/settings/notification/RecentNotifyingAppsPreferenceController.java
@@ -31,6 +31,7 @@
 import android.util.ArrayMap;
 import android.util.ArraySet;
 import android.util.IconDrawableFactory;
+import android.util.Slog;
 
 import com.android.settings.R;
 import com.android.settings.Utils;
@@ -294,15 +295,19 @@
         List<NotifyingApp> displayableApps = new ArrayList<>(SHOW_RECENT_APP_COUNT);
         int count = 0;
         for (NotifyingApp app : mApps) {
-            final ApplicationsState.AppEntry appEntry = mApplicationsState.getEntry(
-                    app.getPackage(), app.getUserId());
-            if (appEntry == null) {
-                continue;
-            }
-            displayableApps.add(app);
-            count++;
-            if (count >= SHOW_RECENT_APP_COUNT) {
-                break;
+            try {
+                final ApplicationsState.AppEntry appEntry = mApplicationsState.getEntry(
+                        app.getPackage(), app.getUserId());
+                if (appEntry == null) {
+                    continue;
+                }
+                displayableApps.add(app);
+                count++;
+                if (count >= SHOW_RECENT_APP_COUNT) {
+                    break;
+                }
+            } catch (Exception e) {
+                Slog.e(TAG, "Failed to find app " + app.getPackage() + "/" + app.getUserId(), e);
             }
         }
         return displayableApps;
diff --git a/src/com/android/settings/notification/app/ConversationPriorityPreference.java b/src/com/android/settings/notification/app/ConversationPriorityPreference.java
index ff1dc6c..307abec 100644
--- a/src/com/android/settings/notification/app/ConversationPriorityPreference.java
+++ b/src/com/android/settings/notification/app/ConversationPriorityPreference.java
@@ -179,7 +179,11 @@
             // a11y service won't always read the newly appearing text in the right order if the
             // selection happens too soon (readback happens on a different thread as layout). post
             // the selection to make that conflict less likely
-            parent.post(() -> mSilenceButton.setSelected(true));
+            parent.post(() -> {
+                mSilenceButton.setSelected(true);
+                mAlertButton.setSelected(false);
+                mPriorityButton.setSelected(false);
+            });
         } else {
             if (isPriority) {
                 alertSummary.setVisibility(GONE);
@@ -197,7 +201,11 @@
                 mAlertButton.setBackground(unselectedBackground);
                 mPriorityButton.setBackground(selectedBackground);
                 mSilenceButton.setBackground(unselectedBackground);
-                parent.post(() -> mPriorityButton.setSelected(true));
+                parent.post(() -> {
+                    mSilenceButton.setSelected(false);
+                    mAlertButton.setSelected(false);
+                    mPriorityButton.setSelected(true);
+                });
             } else {
                 alertSummary.setVisibility(VISIBLE);
                 alertIcon.setImageTintList(colorAccent);
@@ -214,7 +222,11 @@
                 mAlertButton.setBackground(selectedBackground);
                 mPriorityButton.setBackground(unselectedBackground);
                 mSilenceButton.setBackground(unselectedBackground);
-                parent.post(() -> mAlertButton.setSelected(true));
+                parent.post(() -> {
+                    mSilenceButton.setSelected(false);
+                    mAlertButton.setSelected(true);
+                    mPriorityButton.setSelected(false);
+                });
             }
         }
     }
diff --git a/src/com/android/settings/notification/history/NotificationHistoryAdapter.java b/src/com/android/settings/notification/history/NotificationHistoryAdapter.java
index afe36ef..4a5c627 100644
--- a/src/com/android/settings/notification/history/NotificationHistoryAdapter.java
+++ b/src/com/android/settings/notification/history/NotificationHistoryAdapter.java
@@ -98,7 +98,8 @@
             public boolean performAccessibilityAction(View host, int action, Bundle args) {
                 super.performAccessibilityAction(host, action, args);
                 if (action == AccessibilityNodeInfo.AccessibilityAction.ACTION_DISMISS.getId()) {
-                    onItemSwipeDeleted(position);
+                    int currPosition = mValues.indexOf(hn);
+                    onItemSwipeDeleted(currPosition);
                     return true;
                 }
                 return false;
@@ -119,6 +120,11 @@
 
     @Override
     public void onItemSwipeDeleted(int position) {
+        if (position > (mValues.size() - 1)) {
+            Slog.d(TAG, "Tried to swipe element out of list: position: " + position
+                    + " size? " + mValues.size());
+            return;
+        }
         HistoricalNotification hn = mValues.remove(position);
         if (hn != null) {
             try {
diff --git a/tests/robotests/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceControllerTest.java
index 57729ea..a818852 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/EnabledNetworkModePreferenceControllerTest.java
@@ -155,6 +155,7 @@
 
     @Test
     public void updateState_5gWorldPhone_GlobalHasNr() {
+        mPersistableBundle.putBoolean(CarrierConfigManager.KEY_NR_ENABLED_BOOL, true);
         mockAccessFamily(TelephonyManager.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA);
         mController.init(mLifecycle, SUB_ID);
         mPersistableBundle.putBoolean(CarrierConfigManager.KEY_WORLD_MODE_ENABLED_BOOL, true);
@@ -168,6 +169,7 @@
 
     @Test
     public void updateState_selectedOn5gItem() {
+        mPersistableBundle.putBoolean(CarrierConfigManager.KEY_NR_ENABLED_BOOL, true);
         mockEnabledNetworkMode(TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA);
         mockAccessFamily(TelephonyManager.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA);
         mController.init(mLifecycle, SUB_ID);