Merge "Fix Text of VoLTE setting cannot be updated when SIM state is changed"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 568c933..81a255c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -12200,15 +12200,39 @@
     <string name="connected_device_see_all_summary">Bluetooth will turn on</string>
 
     <!-- Bluetooth message permission alert for notification content [CHAR LIMIT=none] -->
-    <string name="bluetooth_message_access_notification_content">Untrusted device wants to access your messages. Tap for details.</string>
+    <string name="bluetooth_message_access_notification_content">A device wants to access your messages. Tap for details.</string>
     <!-- Bluetooth message permission alert for dialog title [CHAR LIMIT=none] -->
     <string name="bluetooth_message_access_dialog_title">Allow access to messages?</string>
     <!-- Bluetooth message permission alert for dialog content [CHAR LIMIT=none] -->
-    <string name="bluetooth_message_access_dialog_content">An untrusted Bluetooth device, <xliff:g id="device_name" example="My device">%1$s</xliff:g>, wants to access your messages.\n\nYou haven\u2019t connected to <xliff:g id="device_name" example="My device">%2$s</xliff:g> before.</string>
+    <string name="bluetooth_message_access_dialog_content">A Bluetooth device, <xliff:g id="device_name" example="My device">%1$s</xliff:g>, wants to access your messages.\n\nYou haven\u2019t connected to <xliff:g id="device_name" example="My device">%2$s</xliff:g> before.</string>
     <!-- Bluetooth phonebook permission alert for notification content [CHAR LIMIT=none] -->
-    <string name="bluetooth_phonebook_access_notification_content">Untrusted device wants to access your contacts and call log. Tap for details.</string>
+    <string name="bluetooth_phonebook_access_notification_content">A device wants to access your contacts and call log. Tap for details.</string>
     <!-- Bluetooth phonebook permission alert for dialog title [CHAR LIMIT=none] -->
     <string name="bluetooth_phonebook_access_dialog_title">Allow access to contacts and call log?</string>
     <!-- Bluetooth phonebook permission alert for dialog content [CHAR LIMIT=none] -->
-    <string name="bluetooth_phonebook_access_dialog_content">An untrusted Bluetooth device, <xliff:g id="device_name" example="My device">%1$s</xliff:g>, wants to access your contacts and call log. This includes data about incoming and outgoing calls.\n\nYou haven\u2019t connected to <xliff:g id="device_name" example="My device">%2$s</xliff:g> before.</string>
+    <string name="bluetooth_phonebook_access_dialog_content">A Bluetooth device, <xliff:g id="device_name" example="My device">%1$s</xliff:g>, wants to access your contacts and call log. This includes data about incoming and outgoing calls.\n\nYou haven\u2019t connected to <xliff:g id="device_name" example="My device">%2$s</xliff:g> before.</string>
+
+    <!-- Label for button to not allow grant the permission for remote devices. [CHAR_LIMIT=50] -->
+    <string name="request_manage_bluetooth_permission_dont_allow">Don\u2019t allow</string>
+
+    <!-- Bluetooth sim card permission alert for notification title [CHAR LIMIT=none] -->
+    <string name="bluetooth_sim_card_access_notification_title">SIM card access request</string>
+    <!-- Bluetooth sim card permission alert for notification content [CHAR LIMIT=none] -->
+    <string name="bluetooth_sim_card_access_notification_content">A device wants to access your SIM card. Tap for details.</string>
+    <!-- Bluetooth sim card permission alert for dialog title [CHAR LIMIT=none] -->
+    <string name="bluetooth_sim_card_access_dialog_title">Allow access to SIM card?</string>
+    <!-- Bluetooth sim card permission alert for dialog content [CHAR LIMIT=none] -->
+    <string name="bluetooth_sim_card_access_dialog_content">A Bluetooth device, <xliff:g id="device_name" example="My device">%1$s</xliff:g>, wants to access data on your SIM card. This includes your contacts.\n\nWhile connected, <xliff:g id="device_name" example="My device">%2$s</xliff:g> will receive all calls made to <xliff:g id="phone_number" example="0912345678">%3$s</xliff:g>.</string>
+    <!-- Bluetooth connect permission alert for notification title [CHAR LIMIT=none] -->
+    <string name="bluetooth_connect_access_notification_title">Bluetooth device available</string>
+    <!-- Bluetooth connect permission alert for notification content [CHAR LIMIT=none] -->
+    <string name="bluetooth_connect_access_notification_content">A device wants to connect. Tap for details.</string>
+    <!-- Bluetooth connect permission alert for dialog title [CHAR LIMIT=none] -->
+    <string name="bluetooth_connect_access_dialog_title">Connect to Bluetooth device?</string>
+    <!-- Bluetooth connect permission alert for dialog content [CHAR LIMIT=none] -->
+    <string name="bluetooth_connect_access_dialog_content"><xliff:g id="device_name" example="My device">%1$s</xliff:g> wants to connect to this phone.\n\nYou haven\u2019t connected to <xliff:g id="device_name" example="My device">%2$s</xliff:g> before.</string>
+    <!-- Strings for Dialog don't connect button -->
+    <string name="bluetooth_connect_access_dialog_negative">Don\u2019t connect</string>
+    <!-- Strings for Dialog connect button -->
+    <string name="bluetooth_connect_access_dialog_positive">Connect</string>
 </resources>
diff --git a/src/com/android/settings/applications/specialaccess/DefaultPaymentSettingsPreferenceController.java b/src/com/android/settings/applications/specialaccess/DefaultPaymentSettingsPreferenceController.java
index 2f03c3d..763a500 100644
--- a/src/com/android/settings/applications/specialaccess/DefaultPaymentSettingsPreferenceController.java
+++ b/src/com/android/settings/applications/specialaccess/DefaultPaymentSettingsPreferenceController.java
@@ -82,7 +82,7 @@
                         PackageManager.FEATURE_NFC_HOST_CARD_EMULATION)) {
             return UNSUPPORTED_ON_DEVICE;
         }
-        if (!mUserManager.isAdminUser()) {
+        if (mUserManager.isGuestUser()) {
             return DISABLED_FOR_USER;
         }
         if (mNfcAdapter == null) {
diff --git a/src/com/android/settings/biometrics/OWNERS b/src/com/android/settings/biometrics/OWNERS
index 021e89d..23eaf7e 100644
--- a/src/com/android/settings/biometrics/OWNERS
+++ b/src/com/android/settings/biometrics/OWNERS
@@ -1,6 +1,9 @@
 # Default reviewers for this and subdirectories.
 curtislb@google.com
+ilyamaty@google.com
 jaggies@google.com
+jbolinger@google.com
+joshmccloskey@google.com
 kchyn@google.com
 yukl@google.com
 
diff --git a/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java b/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java
index 0cca4a4..211bcc6 100644
--- a/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java
+++ b/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java
@@ -25,6 +25,7 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.os.Bundle;
+import android.telephony.TelephonyManager;
 import android.util.Log;
 import android.view.View;
 import android.widget.Button;
@@ -94,13 +95,13 @@
         if(DEBUG) Log.i(TAG, "onCreate() Request type: " + mRequestType);
 
         if (mRequestType == BluetoothDevice.REQUEST_TYPE_PROFILE_CONNECTION) {
-            showDialog(getString(R.string.bluetooth_connection_permission_request), mRequestType);
+            showDialog(getString(R.string.bluetooth_connect_access_dialog_title), mRequestType);
         } else if (mRequestType == BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS) {
             showDialog(getString(R.string.bluetooth_phonebook_access_dialog_title), mRequestType);
         } else if (mRequestType == BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS) {
             showDialog(getString(R.string.bluetooth_message_access_dialog_title), mRequestType);
         } else if (mRequestType == BluetoothDevice.REQUEST_TYPE_SIM_ACCESS) {
-            showDialog(getString(R.string.bluetooth_sap_request), mRequestType);
+            showDialog(getString(R.string.bluetooth_sim_card_access_dialog_title), mRequestType);
         }
         else {
             Log.e(TAG, "Error: bad request type: " + mRequestType);
@@ -133,9 +134,14 @@
             p.mView = createSapDialogView();
             break;
         }
-        p.mPositiveButtonText = getString(R.string.allow);
+        p.mPositiveButtonText = getString(
+                requestType == BluetoothDevice.REQUEST_TYPE_PROFILE_CONNECTION
+                        ? R.string.bluetooth_connect_access_dialog_positive : R.string.allow);
         p.mPositiveButtonListener = this;
-        p.mNegativeButtonText = getString(R.string.deny);
+        p.mNegativeButtonText = getString(
+                requestType == BluetoothDevice.REQUEST_TYPE_PROFILE_CONNECTION
+                        ? R.string.bluetooth_connect_access_dialog_negative
+                        : R.string.request_manage_bluetooth_permission_dont_allow);
         p.mNegativeButtonListener = this;
         mOkButton = mAlert.getButton(DialogInterface.BUTTON_POSITIVE);
         setupAlert();
@@ -156,8 +162,8 @@
         String mRemoteName = Utils.createRemoteName(this, mDevice);
         mView = getLayoutInflater().inflate(R.layout.bluetooth_access, null);
         messageView = (TextView)mView.findViewById(R.id.message);
-        messageView.setText(getString(R.string.bluetooth_connection_dialog_text,
-                mRemoteName));
+        messageView.setText(getString(R.string.bluetooth_connect_access_dialog_content,
+                mRemoteName, mRemoteName));
         return mView;
     }
 
@@ -181,10 +187,11 @@
 
     private View createSapDialogView() {
         String mRemoteName = Utils.createRemoteName(this, mDevice);
+        TelephonyManager tm = getSystemService(TelephonyManager.class);
         mView = getLayoutInflater().inflate(R.layout.bluetooth_access, null);
         messageView = (TextView)mView.findViewById(R.id.message);
-        messageView.setText(getString(R.string.bluetooth_sap_acceptance_dialog_text,
-                mRemoteName, mRemoteName));
+        messageView.setText(getString(R.string.bluetooth_sim_card_access_dialog_content,
+                mRemoteName, mRemoteName, tm.getLine1Number()));
         return mView;
     }
 
diff --git a/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java b/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java
index de957a7..791ade4 100644
--- a/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java
+++ b/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java
@@ -144,13 +144,17 @@
                                 R.string.bluetooth_message_access_notification_content);
                         break;
                     case BluetoothDevice.REQUEST_TYPE_SIM_ACCESS:
-                        title = context.getString(R.string.bluetooth_sap_request);
-                        message = context.getString(R.string.bluetooth_sap_acceptance_dialog_text,
+                        title = context.getString(
+                                R.string.bluetooth_sim_card_access_notification_title);
+                        message = context.getString(
+                                R.string.bluetooth_sim_card_access_notification_content,
                                 deviceAlias, deviceAlias);
                         break;
                     default:
-                        title = context.getString(R.string.bluetooth_connection_permission_request);
-                        message = context.getString(R.string.bluetooth_connection_dialog_text,
+                        title = context.getString(
+                                R.string.bluetooth_connect_access_notification_title);
+                        message = context.getString(
+                                R.string.bluetooth_connect_access_notification_content,
                                 deviceAlias, deviceAlias);
                         break;
                 }
diff --git a/src/com/android/settings/bluetooth/OWNERS b/src/com/android/settings/bluetooth/OWNERS
index 5e716e1..52017a8 100644
--- a/src/com/android/settings/bluetooth/OWNERS
+++ b/src/com/android/settings/bluetooth/OWNERS
@@ -2,5 +2,6 @@
 hughchen@google.com
 timhypeng@google.com
 siyuanh@google.com
+robertluo@google.com
 
 # Emergency approvers in case the above are not available
diff --git a/src/com/android/settings/connecteddevice/OWNERS b/src/com/android/settings/connecteddevice/OWNERS
new file mode 100644
index 0000000..a5fe957
--- /dev/null
+++ b/src/com/android/settings/connecteddevice/OWNERS
@@ -0,0 +1,6 @@
+# Default reviewers for this and subdirectories.
+hughchen@google.com
+timhypeng@google.com
+robertluo@google.com
+
+# Emergency approvers in case the above are not available
diff --git a/src/com/android/settings/connecteddevice/usb/OWNERS b/src/com/android/settings/connecteddevice/usb/OWNERS
index add985c..66bf468 100644
--- a/src/com/android/settings/connecteddevice/usb/OWNERS
+++ b/src/com/android/settings/connecteddevice/usb/OWNERS
@@ -1,3 +1,6 @@
 # Default reviewers for this and subdirectories.
 zhangjerry@google.com
 badhri@google.com
+hughchen@google.com
+timhypeng@google.com
+robertluo@google.com
diff --git a/src/com/android/settings/network/EraseEuiccDataController.java b/src/com/android/settings/network/EraseEuiccDataController.java
index 7d71096..b1f964b 100644
--- a/src/com/android/settings/network/EraseEuiccDataController.java
+++ b/src/com/android/settings/network/EraseEuiccDataController.java
@@ -17,6 +17,7 @@
 package com.android.settings.network;
 
 import android.content.Context;
+import android.content.pm.PackageManager;
 import android.text.TextUtils;
 
 import androidx.preference.Preference;
@@ -50,6 +51,8 @@
 
     @Override
     public int getAvailabilityStatus() {
-        return AVAILABLE_UNSEARCHABLE;
+        return mContext.getPackageManager().hasSystemFeature(
+                PackageManager.FEATURE_TELEPHONY_EUICC) ? AVAILABLE_UNSEARCHABLE
+                : UNSUPPORTED_ON_DEVICE;
     }
 }
diff --git a/src/com/android/settings/nfc/PaymentBackend.java b/src/com/android/settings/nfc/PaymentBackend.java
index a87855e..aec7343 100644
--- a/src/com/android/settings/nfc/PaymentBackend.java
+++ b/src/com/android/settings/nfc/PaymentBackend.java
@@ -28,6 +28,7 @@
 import android.os.Looper;
 import android.os.Message;
 import android.os.UserHandle;
+import android.os.UserManager;
 import android.provider.Settings;
 import android.provider.Settings.SettingNotFoundException;
 
@@ -141,21 +142,21 @@
 
     boolean isForegroundMode() {
         try {
-            return Settings.Secure.getInt(mContext.getContentResolver(),
-                    Settings.Secure.NFC_PAYMENT_FOREGROUND) != 0;
+            return Settings.Secure.getIntForUser(mContext.getContentResolver(),
+                    Settings.Secure.NFC_PAYMENT_FOREGROUND, UserHandle.myUserId()) != 0;
         } catch (SettingNotFoundException e) {
             return false;
         }
     }
 
     void setForegroundMode(boolean foreground) {
-        Settings.Secure.putInt(mContext.getContentResolver(),
-                Settings.Secure.NFC_PAYMENT_FOREGROUND, foreground ? 1 : 0);
+        Settings.Secure.putIntForUser(mContext.getContentResolver(),
+                Settings.Secure.NFC_PAYMENT_FOREGROUND, foreground ? 1 : 0, UserHandle.myUserId());
     }
 
     ComponentName getDefaultPaymentApp() {
-        String componentString = Settings.Secure.getString(mContext.getContentResolver(),
-                Settings.Secure.NFC_PAYMENT_DEFAULT_COMPONENT);
+        String componentString = Settings.Secure.getStringForUser(mContext.getContentResolver(),
+                Settings.Secure.NFC_PAYMENT_DEFAULT_COMPONENT, UserHandle.myUserId());
         if (componentString != null) {
             return ComponentName.unflattenFromString(componentString);
         } else {
@@ -164,9 +165,9 @@
     }
 
     public void setDefaultPaymentApp(ComponentName app) {
-        Settings.Secure.putString(mContext.getContentResolver(),
+        Settings.Secure.putStringForUser(mContext.getContentResolver(),
                 Settings.Secure.NFC_PAYMENT_DEFAULT_COMPONENT,
-                app != null ? app.flattenToString() : null);
+                app != null ? app.flattenToString() : null, UserHandle.myUserId());
         refresh();
     }
 
diff --git a/src/com/android/settings/password/OWNERS b/src/com/android/settings/password/OWNERS
index cac6e3f..636800f 100644
--- a/src/com/android/settings/password/OWNERS
+++ b/src/com/android/settings/password/OWNERS
@@ -1,5 +1,9 @@
 # Default reviewers for this and subdirectories.
+curtislb@google.com
+ilyamaty@google.com
 jaggies@google.com
+jbolinger@google.com
+joshmccloskey@google.com
 kchyn@google.com
 paulcrowley@google.com
 rubinxu@google.com
diff --git a/tests/unit/src/com/android/settings/biometrics/OWNERS b/tests/unit/src/com/android/settings/biometrics/OWNERS
new file mode 100644
index 0000000..a257ed8
--- /dev/null
+++ b/tests/unit/src/com/android/settings/biometrics/OWNERS
@@ -0,0 +1 @@
+include /src/com/android/settings/biometrics/OWNERS
diff --git a/tests/unit/src/com/android/settings/network/EraseEuiccDataControllerTest.java b/tests/unit/src/com/android/settings/network/EraseEuiccDataControllerTest.java
index 879b9f7..e3fea83 100644
--- a/tests/unit/src/com/android/settings/network/EraseEuiccDataControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/EraseEuiccDataControllerTest.java
@@ -26,6 +26,7 @@
 import com.android.settings.core.BasePreferenceController;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -42,6 +43,7 @@
         mController = new EraseEuiccDataController(context, ERASE_EUICC_DATA_PREFERENCE_KEY);
     }
 
+    @Ignore("Will not work on devices without FEATURE_TELEPHONY_EUICC")
     @Test
     public void getAvailabilityStatus_returnAVAILABLE_UNSEARCHABLE() {
         assertThat(mController.getAvailabilityStatus())