Merge "renounce location permission for service state callback" into tm-dev
diff --git a/res/layout/radio_info.xml b/res/layout/radio_info.xml
index 1f137b0..866252a 100644
--- a/res/layout/radio_info.xml
+++ b/res/layout/radio_info.xml
@@ -435,6 +435,40 @@
                       android:layout_toEndOf="@id/smsc_label" />
         </RelativeLayout>
 
+        <!-- WFC Entitlement ID -->
+        <RelativeLayout android:layout_width="match_parent"
+                        android:layout_height="wrap_content">
+            <TextView android:id="@+id/wfc_entitlement_id"
+                      android:text="@string/provisioning_info_wfc_entitlement_id"
+                      android:labelFor="@+id/edit_wfc_entitlement_id"
+                      android:layout_alignBaseline="@+id/update_wfc_entitlement_id"
+                      style="@style/info_label" />
+            <Button android:id="@+id/refresh_wfc_entitlement_id"
+                    android:textSize="14sp"
+                    android:layout_marginTop="8dip"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="@string/refresh_provisioning_info_wfc_entitlement_id"
+                    android:layout_alignParentEnd="true"
+                    />
+            <Button android:id="@+id/update_wfc_entitlement_id"
+                    android:textSize="14sp"
+                    android:layout_marginTop="8dip"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="@string/update_provisioning_info_wfc_entitlement_id"
+                    android:layout_toStartOf="@+id/refresh_wfc_entitlement_id"
+                    android:layout_alignBaseline="@+id/refresh_wfc_entitlement_id"
+                    />
+            <EditText android:id="@+id/edit_wfc_entitlement_id"
+                      style="@style/form_value"
+                      android:autofillHints="@null"
+                      android:inputType="text"
+                      android:layout_alignBaseline="@+id/refresh_wfc_entitlement_id"
+                      android:layout_toStartOf="@id/update_wfc_entitlement_id"
+                      android:layout_toEndOf="@id/wfc_entitlement_id" />
+        </RelativeLayout>
+
         <!-- Test setting to ignore bad DNS, useful in lab environments -->
         <LinearLayout style="@style/RadioInfo_entry_layout">
             <Button android:id="@+id/dns_check_toggle"
diff --git a/res/values-b+sr+Latn/strings.xml b/res/values-b+sr+Latn/strings.xml
index e92ca54..08cdf4a 100644
--- a/res/values-b+sr+Latn/strings.xml
+++ b/res/values-b+sr+Latn/strings.xml
@@ -857,7 +857,7 @@
     <string name="radioInfo_phone_offhook" msgid="7564601639749936170">"Poziv je u toku"</string>
     <string name="radioInfo_data_disconnected" msgid="8085447971880814541">"Veza je prekinuta"</string>
     <string name="radioInfo_data_connecting" msgid="925092271092152472">"Povezuje se"</string>
-    <string name="radioInfo_data_connected" msgid="7637335645634239508">"Povezano je"</string>
+    <string name="radioInfo_data_connected" msgid="7637335645634239508">"Povezano"</string>
     <string name="radioInfo_data_suspended" msgid="8695262782642002785">"Suspendovano"</string>
     <string name="radioInfo_unknown" msgid="5401423738500672850">"Nepoznato"</string>
     <string name="radioInfo_display_packets" msgid="6794302192441084157">"pak."</string>
diff --git a/res/values-eu/strings.xml b/res/values-eu/strings.xml
index 3a2d2f1..6d1ee85 100644
--- a/res/values-eu/strings.xml
+++ b/res/values-eu/strings.xml
@@ -875,7 +875,7 @@
     <string name="radio_info_cellinfo_label" msgid="8199062974670377659">"Sare mugikorraren neurketa guztien informazioa:"</string>
     <string name="radio_info_gprs_service_label" msgid="6819204246355412952">"Datu-zerbitzua:"</string>
     <string name="radio_info_roaming_label" msgid="6636932886446857120">"Ibiltaritza:"</string>
-    <string name="radio_info_imei_label" msgid="8947899706930120368">"IMEI:"</string>
+    <string name="radio_info_imei_label" msgid="8947899706930120368">"IMEIa:"</string>
     <string name="radio_info_call_redirect_label" msgid="4526480903023362276">"Dei-desbideratzea:"</string>
     <string name="radio_info_ppp_resets_label" msgid="9131901102339077661">"PPP berrezarpen kopurua abiarazi ezkero:"</string>
     <string name="radio_info_current_network_label" msgid="3052098695239642450">"Oraingo sarea:"</string>
diff --git a/res/values-pt-rPT/strings.xml b/res/values-pt-rPT/strings.xml
index e1f00a4..9c477a4 100644
--- a/res/values-pt-rPT/strings.xml
+++ b/res/values-pt-rPT/strings.xml
@@ -104,7 +104,7 @@
     <string name="call_forwarding_settings_with_label" msgid="2345432813399564272">"Definições de encaminhamento de chamadas (<xliff:g id="SUBSCRIPTIONLABEL">%s</xliff:g>)"</string>
     <string name="labelCF" msgid="3578719437928476078">"Encaminhamento de chamadas"</string>
     <string name="labelCFU" msgid="8870170873036279706">"Encaminhar sempre"</string>
-    <string name="messageCFU" msgid="1361806450979589744">"Utilizar sempre este número"</string>
+    <string name="messageCFU" msgid="1361806450979589744">"Usar sempre este número"</string>
     <string name="sum_cfu_enabled_indicator" msgid="9030139213402432776">"A reencaminhar todas as chamadas"</string>
     <string name="sum_cfu_enabled" msgid="5806923046528144526">"A encaminhar todas as chamadas para <xliff:g id="PHONENUMBER">{0}</xliff:g>"</string>
     <string name="sum_cfu_enabled_no_number" msgid="7287752761743377930">"O número está indisponível"</string>
@@ -305,7 +305,7 @@
     <string name="carrier_settings_euicc_summary" msgid="2027941166597330117">"<xliff:g id="CARRIER_NAME">%1$s</xliff:g> – <xliff:g id="PHONE_NUMBER">%2$s</xliff:g>"</string>
     <string name="mobile_data_settings_title" msgid="7228249980933944101">"Dados móveis"</string>
     <string name="mobile_data_settings_summary" msgid="5012570152029118471">"Aceder aos dados através de rede móvel"</string>
-    <string name="data_usage_disable_mobile" msgid="5669109209055988308">"Pretende desativar os dados móveis?"</string>
+    <string name="data_usage_disable_mobile" msgid="5669109209055988308">"Desativar os dados móveis?"</string>
     <string name="sim_selection_required_pref" msgid="6985901872978341314">"A seleção é necessária"</string>
     <string name="sim_change_data_title" msgid="9142726786345906606">"Pretende alterar o SIM de dados?"</string>
     <string name="sim_change_data_message" msgid="3567358694255933280">"Pretende utilizar o <xliff:g id="NEW_SIM">%1$s</xliff:g> em vez do <xliff:g id="OLD_SIM">%2$s</xliff:g> para os dados móveis?"</string>
diff --git a/res/values-sr/strings.xml b/res/values-sr/strings.xml
index 22dc2c8..772314a 100644
--- a/res/values-sr/strings.xml
+++ b/res/values-sr/strings.xml
@@ -857,7 +857,7 @@
     <string name="radioInfo_phone_offhook" msgid="7564601639749936170">"Позив је у току"</string>
     <string name="radioInfo_data_disconnected" msgid="8085447971880814541">"Веза је прекинута"</string>
     <string name="radioInfo_data_connecting" msgid="925092271092152472">"Повезује се"</string>
-    <string name="radioInfo_data_connected" msgid="7637335645634239508">"Повезано је"</string>
+    <string name="radioInfo_data_connected" msgid="7637335645634239508">"Повезано"</string>
     <string name="radioInfo_data_suspended" msgid="8695262782642002785">"Суспендовано"</string>
     <string name="radioInfo_unknown" msgid="5401423738500672850">"Непознато"</string>
     <string name="radioInfo_display_packets" msgid="6794302192441084157">"пак."</string>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c17f9b9..8112dd5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2185,6 +2185,13 @@
     <!-- Trigger Carrier Provisioning [CHAR LIMIT=NONE] -->
     <string name="trigger_carrier_provisioning">Trigger Carrier Provisioning</string>
 
+    <!-- Provisionin WFC Entitlement ID  -->
+    <string name="provisioning_info_wfc_entitlement_id">WFC Entitlement ID:</string>
+    <!-- Update Provisionin WFC Entitlement ID -->
+    <string name="update_provisioning_info_wfc_entitlement_id">Update</string>
+    <!-- Refresh Provisionin WFC Entitlement ID -->
+    <string name="refresh_provisioning_info_wfc_entitlement_id">Refresh</string>
+
     <!-- details of the message popped up when there is
     bad call quality caused by bluetooth connection-->
     <string name="call_quality_notification_bluetooth_details">
diff --git a/src/com/android/phone/TelephonyShellCommand.java b/src/com/android/phone/TelephonyShellCommand.java
index cbbad82..669e830 100644
--- a/src/com/android/phone/TelephonyShellCommand.java
+++ b/src/com/android/phone/TelephonyShellCommand.java
@@ -30,7 +30,6 @@
 import android.os.RemoteException;
 import android.os.ServiceSpecificException;
 import android.provider.BlockedNumberContract;
-import android.provider.DeviceConfig;
 import android.telephony.BarringInfo;
 import android.telephony.CarrierConfigManager;
 import android.telephony.SubscriptionInfo;
@@ -2929,14 +2928,6 @@
 
         getOutPrintWriter().println("Telephony is running with the "
                 + (newDataStackEnabled ? "new" : "old") + " data stack.");
-
-        boolean configEnabled = Boolean.parseBoolean(DeviceConfig.getProperty(
-                DeviceConfig.NAMESPACE_TELEPHONY, "enable_new_data_stack"));
-        if (configEnabled != newDataStackEnabled) {
-            getOutPrintWriter().println("The new data config has been "
-                    + (configEnabled ? "enabled" : "disabled")
-                    + ". It will be effective after reboot.");
-        }
         return 0;
     }
 
diff --git a/src/com/android/phone/settings/RadioInfo.java b/src/com/android/phone/settings/RadioInfo.java
index b4c885e..8d76cae 100644
--- a/src/com/android/phone/settings/RadioInfo.java
+++ b/src/com/android/phone/settings/RadioInfo.java
@@ -71,6 +71,8 @@
 import android.telephony.TelephonyDisplayInfo;
 import android.telephony.TelephonyManager;
 import android.telephony.data.NetworkSlicingConfig;
+import android.telephony.ims.ProvisioningManager;
+import android.telephony.ims.stub.ImsConfigImplBase;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.Menu;
@@ -186,6 +188,9 @@
     private static final int EAB_PROVISIONED_CONFIG_ID =
             ImsConfig.ConfigConstants.EAB_SETTING_ENABLED;
 
+    private static final int KEY_VOICE_OVER_WIFI_ENTITLEMENT_ID =
+            ProvisioningManager.KEY_VOICE_OVER_WIFI_ENTITLEMENT_ID;
+
     //Values in must match CELL_INFO_REFRESH_RATES
     private static final String[] CELL_INFO_REFRESH_RATE_LABELS = {
             "Disabled",
@@ -212,6 +217,8 @@
     private static final int EVENT_QUERY_SMSC_DONE = 1005;
     private static final int EVENT_UPDATE_SMSC_DONE = 1006;
     private static final int EVENT_PHYSICAL_CHANNEL_CONFIG_CHANGED = 1007;
+    private static final int EVENT_QUERY_WFC_ENTILEMENT_ID_DONE = 1008;
+    private static final int EVENT_UPDATE_WFC_ENTILEMENT_ID_DONE = 1009;
 
     private static final int MENU_ITEM_SELECT_BAND         = 0;
     private static final int MENU_ITEM_VIEW_ADN            = 1;
@@ -258,6 +265,7 @@
     private TextView mNrFrequency;
     private TextView mNetworkSlicingConfig;
     private EditText mSmsc;
+    private EditText mWfcEntitlementId;
     private Switch mRadioPowerOnSwitch;
     private Button mCellInfoRefreshRateButton;
     private Button mDnsCheckToggleButton;
@@ -276,6 +284,8 @@
     private Spinner mPreferredNetworkType;
     private Spinner mSelectPhoneIndex;
     private Spinner mCellInfoRefreshRateSpinner;
+    private Button mUpdateWfcEntitlementIdButton;
+    private Button mRefreshWfcEntitlementIdButton;
 
     private static final long RUNNABLE_TIMEOUT_MS = 5 * 60 * 1000L;
 
@@ -285,6 +295,7 @@
     private TelephonyManager mTelephonyManager;
     private ImsManager mImsManager = null;
     private Phone mPhone = null;
+    private ProvisioningManager mProvisioningManager = null;
 
     private String mPingHostnameResultV4;
     private String mPingHostnameResultV6;
@@ -415,6 +426,7 @@
 
         // update the subId
         mTelephonyManager = mTelephonyManager.createForSubscriptionId(subId);
+        mProvisioningManager = ProvisioningManager.createForSubscriptionId(subId);
 
         // update the phoneId
         mImsManager = ImsManager.getInstance(getApplicationContext(), phoneIndex);
@@ -450,6 +462,13 @@
                     }
                     updatePhysicalChannelConfiguration((List<PhysicalChannelConfig>) ar.result);
                     break;
+                case EVENT_QUERY_WFC_ENTILEMENT_ID_DONE:
+                    mWfcEntitlementId.setText((String) msg.obj);
+                    break;
+                case EVENT_UPDATE_WFC_ENTILEMENT_ID_DONE:
+                    mUpdateWfcEntitlementIdButton.setEnabled(true);
+                    mWfcEntitlementId.setText((String) msg.obj);
+                    break;
                 default:
                     super.handleMessage(msg);
                     break;
@@ -480,6 +499,8 @@
 
         mImsManager = ImsManager.getInstance(getApplicationContext(), mPhone.getPhoneId());
 
+        mProvisioningManager = ProvisioningManager.createForSubscriptionId(mPhone.getSubId());
+
         sPhoneIndexLabels = getPhoneIndexLabels(mTelephonyManager);
 
         mDeviceId = (TextView) findViewById(R.id.imei);
@@ -504,6 +525,8 @@
         mSent = (TextView) findViewById(R.id.sent);
         mReceived = (TextView) findViewById(R.id.received);
         mSmsc = (EditText) findViewById(R.id.smsc);
+        mWfcEntitlementId = (EditText) findViewById(R.id.edit_wfc_entitlement_id);
+        mWfcEntitlementId.setVisibility(!IS_USER_BUILD ? View.VISIBLE : View.GONE);
         mDnsCheckState = (TextView) findViewById(R.id.dnsCheckState);
         mPingHostnameV4 = (TextView) findViewById(R.id.pingHostnameV4);
         mPingHostnameV6 = (TextView) findViewById(R.id.pingHostnameV6);
@@ -585,6 +608,12 @@
         mUpdateSmscButton.setOnClickListener(mUpdateSmscButtonHandler);
         mRefreshSmscButton = (Button) findViewById(R.id.refresh_smsc);
         mRefreshSmscButton.setOnClickListener(mRefreshSmscButtonHandler);
+        mUpdateWfcEntitlementIdButton = (Button) findViewById(R.id.update_wfc_entitlement_id);
+        mUpdateWfcEntitlementIdButton.setOnClickListener(mUpdateWfcEntitlementIdButtonHandler);
+        mUpdateWfcEntitlementIdButton.setVisibility(!IS_USER_BUILD ? View.VISIBLE : View.GONE);
+        mRefreshWfcEntitlementIdButton = (Button) findViewById(R.id.refresh_wfc_entitlement_id);
+        mRefreshWfcEntitlementIdButton.setOnClickListener(mRefreshWfcEntitlementIdButtonHandler);
+        mRefreshWfcEntitlementIdButton.setVisibility(!IS_USER_BUILD ? View.VISIBLE : View.GONE);
         mDnsCheckToggleButton = (Button) findViewById(R.id.dns_check_toggle);
         mDnsCheckToggleButton.setOnClickListener(mDnsCheckButtonHandler);
         mCarrierProvisioningButton = (Button) findViewById(R.id.carrier_provisioning);
@@ -612,6 +641,9 @@
             mOemInfoButton.setEnabled(false);
         }
 
+        TextView textView = (TextView) findViewById(R.id.wfc_entitlement_id);
+        textView.setVisibility(!IS_USER_BUILD ? View.VISIBLE : View.GONE);
+
         mCellInfoRefreshRateIndex = 0; //disabled
         mPreferredNetworkTypeResult = PREFERRED_NETWORK_LABELS.length - 1; //Unknown
         mSelectedPhoneIndex = 0; //phone 0
@@ -703,6 +735,7 @@
                 mDefaultNetworkRequest, mNetworkCallback, mHandler);
 
         mSmsc.clearFocus();
+        mWfcEntitlementId.clearFocus();
     }
 
     @Override
@@ -1309,6 +1342,25 @@
         });
     }
 
+    private void refreshWfcEntitilementId() {
+        mQueuedWork.execute(() -> {
+            String result = null;
+            Message msg = mHandler.obtainMessage(EVENT_QUERY_WFC_ENTILEMENT_ID_DONE);
+            try {
+               result =
+                        mProvisioningManager.getProvisioningStringValue(
+                                KEY_VOICE_OVER_WIFI_ENTITLEMENT_ID);
+               if (result == null) {
+                    result = "key not exist";
+                }
+            } catch (RuntimeException e) {
+                result = "refresh error";
+            }
+            msg.obj = result;
+            msg.sendToTarget();
+        });
+    }
+
     private void updateAllCellInfo() {
 
         mCellInfo.setText("");
@@ -1709,6 +1761,27 @@
         }
     };
 
+    OnClickListener mUpdateWfcEntitlementIdButtonHandler = v -> {
+        mUpdateWfcEntitlementIdButton.setEnabled(false);
+        mQueuedWork.execute(() -> {
+            String value = mWfcEntitlementId.getText().toString();
+            String result = null;
+            Message msg = mHandler.obtainMessage(EVENT_UPDATE_WFC_ENTILEMENT_ID_DONE);
+            try {
+                result = (mProvisioningManager.setProvisioningStringValue(
+                            KEY_VOICE_OVER_WIFI_ENTITLEMENT_ID, value)
+                                    == ImsConfigImplBase.CONFIG_RESULT_SUCCESS)
+                                            ? value : "update failure";
+            } catch (RuntimeException e) {
+                result = "update error";
+            }
+            msg.obj = result;
+            msg.sendToTarget();
+        });
+    };
+
+    OnClickListener mRefreshWfcEntitlementIdButtonHandler = v -> refreshWfcEntitilementId();
+
     OnClickListener mCarrierProvisioningButtonHandler = v -> {
         String carrierProvisioningApp = getCarrierProvisioningAppString();
         if (!TextUtils.isEmpty(carrierProvisioningApp)) {
diff --git a/testapps/GbaTestApp/res/values-te/strings.xml b/testapps/GbaTestApp/res/values-te/strings.xml
index 7434bca..72bd28b 100644
--- a/testapps/GbaTestApp/res/values-te/strings.xml
+++ b/testapps/GbaTestApp/res/values-te/strings.xml
@@ -9,7 +9,7 @@
     <string name="button_name_running" msgid="4557363091224858010">"రన్ అవుతోంది"</string>
     <string name="button_name_exit" msgid="8025683733431538975">"నిష్క్రమించు"</string>
     <string name="label_test_result" msgid="892984695972956196">"పరీక్ష ఫలితం"</string>
-    <string name="button_name_clear" msgid="436313515327318537">"రీసెట్ చేయి"</string>
+    <string name="button_name_clear" msgid="436313515327318537">"రీసెట్ చేయండి"</string>
     <string name="button_name_done" msgid="6030406534322497491">"పూర్తయింది"</string>
     <string name="title_activity_carrier_config" msgid="7807803900475957717">"CarrierConfigActivity"</string>
     <string name="title_activity_service_config" msgid="5394662739555577279">"ServiceConfigActivity"</string>