Merge "Remove provisioned check before eSIM provision"
diff --git a/res/values-cs/strings.xml b/res/values-cs/strings.xml
index 6c41e2b..8c2e98a 100644
--- a/res/values-cs/strings.xml
+++ b/res/values-cs/strings.xml
@@ -34,7 +34,7 @@
     <string name="ok" msgid="3811371167865772377">"OK"</string>
     <string name="audio_mode_speaker" msgid="27649582100085266">"Reproduktor"</string>
     <string name="audio_mode_earpiece" msgid="4156527186373869107">"Sluchátko"</string>
-    <string name="audio_mode_wired_headset" msgid="1465350758489175975">"Kabelová náhlavní soupr."</string>
+    <string name="audio_mode_wired_headset" msgid="1465350758489175975">"Kabelová sluchátka"</string>
     <string name="audio_mode_bluetooth" msgid="3047641300848211128">"Bluetooth"</string>
     <string name="wait_prompt_str" msgid="7601815427707856238">"Odeslat následující tóny?\n"</string>
     <string name="pause_prompt_str" msgid="1789964702154314806">"Odesílání tónů\n"</string>
diff --git a/res/values-nl/strings.xml b/res/values-nl/strings.xml
index 7bac40e..80b4c19 100644
--- a/res/values-nl/strings.xml
+++ b/res/values-nl/strings.xml
@@ -237,9 +237,9 @@
     <string name="roaming" msgid="7894878421600247140">"Roaming"</string>
     <string name="roaming_enable" msgid="7331106985174381987">"Verbinding maken met gegevensservices tijdens roaming"</string>
     <string name="roaming_disable" msgid="1843417228755568110">"Verbinding maken met gegevensservices tijdens roaming"</string>
-    <string name="roaming_reenable_message" msgid="8913735676127858115">"De gegevensverbinding is verbroken, omdat je je thuisnetwerk hebt verlaten terwijl gegevensroaming was uitgeschakeld."</string>
+    <string name="roaming_reenable_message" msgid="8913735676127858115">"De gegevensverbinding is verbroken, omdat je je thuisnetwerk hebt verlaten terwijl dataroaming was uitgeschakeld."</string>
     <string name="roaming_warning" msgid="1603164667540144353">"Er kunnen hoge roamingkosten in rekening worden gebracht."</string>
-    <string name="roaming_alert_title" msgid="3654815360303826008">"Gegevensroaming toestaan?"</string>
+    <string name="roaming_alert_title" msgid="3654815360303826008">"Dataroaming toestaan?"</string>
     <string name="data_usage_title" msgid="8759619109516889802">"Datagebruik"</string>
     <string name="data_usage_template" msgid="8526428824844656364">"<xliff:g id="ID_1">%1$s</xliff:g> mobiele data gebruikt van <xliff:g id="ID_2">%2$s</xliff:g>"</string>
     <string name="advanced_options_title" msgid="8074895510265488035">"Geavanceerd"</string>
@@ -266,7 +266,7 @@
     <string name="throttle_data_rate_reduced_subtext" msgid="7492763592720107737">"Maximum van <xliff:g id="USED_0">%1$s</xliff:g> overschreden\nGegevenssnelheid verlaagd tot <xliff:g id="USED_1">%2$d</xliff:g>  KB/s"</string>
     <string name="throttle_time_frame_subtext" msgid="7732763021560399960">" ٪<xliff:g id="USED_0">%1$d</xliff:g>van cyclus verstreken\nDe volgende periode start over <xliff:g id="USED_1">%2$d</xliff:g> dagen (<xliff:g id="USED_2">%3$s</xliff:g>)"</string>
     <string name="throttle_rate_subtext" msgid="2149102656120726855">"Gegevenssnelheid wordt verlaagd tot <xliff:g id="USED">%1$d</xliff:g>  KB/s als de limiet voor gegevensgebruik wordt overschreden"</string>
-    <string name="throttle_help_subtext" msgid="5217706521499010816">"Meer informatie over het beleid voor gegevensgebruik van je mobiele provider"</string>
+    <string name="throttle_help_subtext" msgid="5217706521499010816">"Meer informatie over het beleid voor datagebruik van je mobiele provider"</string>
     <string name="cell_broadcast_sms" msgid="5584192824053625842">"Infodienstbericht"</string>
     <string name="enable_disable_cell_bc_sms" msgid="4851147873691392255">"SMS Infodienstbericht"</string>
     <string name="cell_bc_sms_enable" msgid="6441688565738921084">"SMS Infodienstbericht ingeschakeld"</string>
diff --git a/src/com/android/phone/CallNotifier.java b/src/com/android/phone/CallNotifier.java
index d084e92..1a7a1d1 100644
--- a/src/com/android/phone/CallNotifier.java
+++ b/src/com/android/phone/CallNotifier.java
@@ -105,6 +105,10 @@
     // they don't step on each others' toes.
     public static final int INTERNAL_SHOW_MESSAGE_NOTIFICATION_DONE = 22;
 
+    public static final int UPDATE_TYPE_MWI = 0;
+    public static final int UPDATE_TYPE_CFI = 1;
+    public static final int UPDATE_TYPE_MWI_CFI = 2;
+
     /**
      * Initialize the singleton CallNotifier instance.
      * This is only done once, at startup, from PhoneApp.onCreate().
@@ -578,6 +582,11 @@
     }
 
     public void updatePhoneStateListeners(boolean isRefresh) {
+        updatePhoneStateListeners(isRefresh, UPDATE_TYPE_MWI_CFI,
+                SubscriptionManager.INVALID_SUBSCRIPTION_ID);
+    }
+
+    public void updatePhoneStateListeners(boolean isRefresh, int updateType, int subIdToUpdate) {
         List<SubscriptionInfo> subInfos = mSubscriptionManager.getActiveSubscriptionInfoList();
 
         // Sort sub id list based on slot id, so that CFI/MWI notifications will be updated for
@@ -609,10 +618,20 @@
                 Log.d(LOG_TAG, "updatePhoneStateListeners: update CF notifications.");
 
                 if (mCFIStatus.containsKey(subId)) {
-                    mApplication.notificationMgr.updateCfi(subId, mCFIStatus.get(subId));
+                    if ((updateType == UPDATE_TYPE_CFI) && (subId == subIdToUpdate)) {
+                        mApplication.notificationMgr.updateCfi(subId, mCFIStatus.get(subId),
+                                isRefresh);
+                    } else {
+                        mApplication.notificationMgr.updateCfi(subId, mCFIStatus.get(subId), true);
+                    }
                 }
                 if (mMWIStatus.containsKey(subId)) {
-                    mApplication.notificationMgr.updateMwi(subId, mMWIStatus.get(subId), isRefresh);
+                    if ((updateType == UPDATE_TYPE_MWI) && (subId == subIdToUpdate)) {
+                        mApplication.notificationMgr.updateMwi(subId, mMWIStatus.get(subId),
+                            isRefresh);
+                    } else {
+                        mApplication.notificationMgr.updateMwi(subId, mMWIStatus.get(subId), true);
+                    }
                 }
             }
         }
@@ -785,7 +804,7 @@
         public void onMessageWaitingIndicatorChanged(boolean visible) {
             if (VDBG) log("onMessageWaitingIndicatorChanged(): " + this.mSubId + " " + visible);
             mMWIStatus.put(this.mSubId, visible);
-            updatePhoneStateListeners(false);
+            updatePhoneStateListeners(false, UPDATE_TYPE_MWI, this.mSubId);
         }
 
         @Override
@@ -793,7 +812,7 @@
             Log.i(LOG_TAG, "onCallForwardingIndicatorChanged(): subId=" + this.mSubId
                     + ", visible=" + (visible ? "Y" : "N"));
             mCFIStatus.put(this.mSubId, visible);
-            updatePhoneStateListeners(false);
+            updatePhoneStateListeners(false, UPDATE_TYPE_CFI, this.mSubId);
         }
     };
 
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index b50ab39..48c9086 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -444,9 +444,19 @@
     /**
      * Updates the message call forwarding indicator notification.
      *
-     * @param visible true if there are messages waiting
+     * @param visible true if call forwarding enabled
      */
-    /* package */ void updateCfi(int subId, boolean visible) {
+
+     /* package */ void updateCfi(int subId, boolean visible) {
+        updateCfi(subId, visible, false /* isRefresh */);
+    }
+
+    /**
+     * Updates the message call forwarding indicator notification.
+     *
+     * @param visible true if call forwarding enabled
+     */
+    /* package */ void updateCfi(int subId, boolean visible, boolean isRefresh) {
         logi("updateCfi: subId= " + subId + ", visible=" + (visible ? "Y" : "N"));
         if (visible) {
             // If Unconditional Call Forwarding (forward all calls) for VOICE
@@ -484,7 +494,8 @@
                     .setContentText(mContext.getString(R.string.sum_cfu_enabled_indicator))
                     .setShowWhen(false)
                     .setOngoing(true)
-                    .setChannel(NotificationChannelController.CHANNEL_ID_CALL_FORWARD);
+                    .setChannel(NotificationChannelController.CHANNEL_ID_CALL_FORWARD)
+                    .setOnlyAlertOnce(isRefresh);
 
             Intent intent = new Intent(Intent.ACTION_MAIN);
             intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
diff --git a/src/com/android/phone/PhoneSearchIndexablesProvider.java b/src/com/android/phone/PhoneSearchIndexablesProvider.java
index c066acd..22786a3 100644
--- a/src/com/android/phone/PhoneSearchIndexablesProvider.java
+++ b/src/com/android/phone/PhoneSearchIndexablesProvider.java
@@ -31,6 +31,7 @@
 import android.content.Context;
 import android.database.Cursor;
 import android.database.MatrixCursor;
+import android.os.Binder;
 import android.os.UserManager;
 import android.provider.SearchIndexableResource;
 import android.provider.SearchIndexablesContract.RawData;
@@ -97,28 +98,34 @@
 
     @Override
     public Cursor queryNonIndexableKeys(String[] projection) {
-        MatrixCursor cursor = new MatrixCursor(NON_INDEXABLES_KEYS_COLUMNS);
+        final long uidToken = Binder.clearCallingIdentity();
+        try {
+            MatrixCursor cursor = new MatrixCursor(NON_INDEXABLES_KEYS_COLUMNS);
 
-        if (!mUserManager.isAdminUser()) {
-            final String[] values = new String[]{"preferred_network_mode_key", "button_roaming_key",
-                    "cdma_lte_data_service_key", "enabled_networks_key", "enhanced_4g_lte",
-                    "button_apn_key", "button_carrier_sel_key", "carrier_settings_key",
-                    "cdma_system_select_key", "esim_list_profile", "mobile_data_enable",
-                    "data_usage_summary", "wifi_calling_key", "video_calling_key"};
-            for (String nik : values) {
-                cursor.addRow(createNonIndexableRow(nik));
+            if (!mUserManager.isAdminUser()) {
+                final String[] values = new String[]{"preferred_network_mode_key",
+                        "button_roaming_key",
+                        "cdma_lte_data_service_key", "enabled_networks_key", "enhanced_4g_lte",
+                        "button_apn_key", "button_carrier_sel_key", "carrier_settings_key",
+                        "cdma_system_select_key", "esim_list_profile", "mobile_data_enable",
+                        "data_usage_summary", "wifi_calling_key", "video_calling_key"};
+                for (String nik : values) {
+                    cursor.addRow(createNonIndexableRow(nik));
+                }
+            } else {
+                if (isEuiccSettingsHidden()) {
+                    cursor.addRow(createNonIndexableRow("esim_list_profile" /* key */));
+                }
+                if (isEnhanced4gLteHidden()) {
+                    cursor.addRow(createNonIndexableRow("enhanced_4g_lte" /* key */));
+                }
             }
-        } else {
-            if (isEuiccSettingsHidden()) {
-                cursor.addRow(createNonIndexableRow("esim_list_profile" /* key */));
-            }
-            if (isEnhanced4gLteHidden()) {
-                cursor.addRow(createNonIndexableRow("enhanced_4g_lte" /* key */));
-            }
+            cursor.addRow(createNonIndexableRow("carrier_settings_euicc_key" /* key */));
+            cursor.addRow(createNonIndexableRow("advanced_options" /* key */));
+            return cursor;
+        } finally {
+            Binder.restoreCallingIdentity(uidToken);
         }
-        cursor.addRow(createNonIndexableRow("carrier_settings_euicc_key" /* key */));
-        cursor.addRow(createNonIndexableRow("advanced_options" /* key */));
-        return cursor;
     }
 
     @VisibleForTesting boolean isEuiccSettingsHidden() {