Merge "Update some wordings under the Display page" into qt-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 01015c5..e28aa15 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1590,10 +1590,6 @@
             android:permission="android.permission.MANAGE_FINGERPRINT"
             android:icon="@drawable/ic_suggestion_fingerprint"
             android:theme="@style/GlifTheme.Light">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="com.android.settings.suggested.category.FINGERPRINT_ENROLL" />
-            </intent-filter>
             <meta-data android:name="com.android.settings.require_feature"
                 android:value="android.hardware.fingerprint" />
             <meta-data android:name="com.android.settings.title"
@@ -1602,6 +1598,22 @@
                 android:resource="@string/suggestion_additional_fingerprints_summary" />
         </activity>
 
+        <activity-alias android:name=".SetupFingerprintSuggestionActivity"
+            android:enabled="false"
+            android:exported="true"
+            android:targetActivity=".biometrics.fingerprint.FingerprintSuggestionActivity">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="com.android.settings.suggested.category.FINGERPRINT_ENROLL" />
+            </intent-filter>
+            <meta-data android:name="com.android.settings.require_feature"
+                       android:value="android.hardware.fingerprint" />
+            <meta-data android:name="com.android.settings.title"
+                       android:resource="@string/suggestion_additional_fingerprints" />
+            <meta-data android:name="com.android.settings.summary"
+                       android:resource="@string/suggestion_additional_fingerprints_summary" />
+        </activity-alias>
+
         <!-- Note this must not be exported since it returns the password in the intent -->
         <activity android:name=".password.ConfirmLockPattern$InternalActivity"
             android:exported="false"
diff --git a/res/drawable/settings_panel_background.xml b/res/drawable/settings_panel_background.xml
index 36c58e0..adb4646 100644
--- a/res/drawable/settings_panel_background.xml
+++ b/res/drawable/settings_panel_background.xml
@@ -16,7 +16,7 @@
 
 <inset xmlns:android="http://schemas.android.com/apk/res/android" android:inset="4dp">
     <shape android:shape="rectangle">
-        <corners android:radius="8dp" />
+        <corners android:radius="?android:attr/dialogCornerRadius" />
         <solid android:color="?android:attr/colorBackground" />
     </shape>
 </inset>
\ No newline at end of file
diff --git a/res/layout/settings_homepage_container.xml b/res/layout/settings_homepage_container.xml
index 225e177..c86bccf 100644
--- a/res/layout/settings_homepage_container.xml
+++ b/res/layout/settings_homepage_container.xml
@@ -46,7 +46,8 @@
                 android:id="@+id/main_content"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:animateLayoutChanges="true"/>
+                android:animateLayoutChanges="true"
+                android:background="?android:attr/windowBackground"/>
 
         </LinearLayout>
     </androidx.core.widget.NestedScrollView>
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java
index 3f02b6f..05ee7be 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintEnrollFinish.java
@@ -17,11 +17,15 @@
 package com.android.settings.biometrics.fingerprint;
 
 import android.app.settings.SettingsEnums;
+import android.content.ComponentName;
 import android.content.Intent;
+import android.content.pm.PackageManager;
 import android.hardware.fingerprint.FingerprintManager;
 import android.os.Bundle;
 import android.view.View;
 
+import androidx.annotation.VisibleForTesting;
+
 import com.android.settings.R;
 import com.android.settings.Utils;
 import com.android.settings.biometrics.BiometricEnrollBase;
@@ -34,7 +38,11 @@
  */
 public class FingerprintEnrollFinish extends BiometricEnrollBase {
 
-    private static final int REQUEST_ADD_ANOTHER = 1;
+    @VisibleForTesting
+    static final int REQUEST_ADD_ANOTHER = 1;
+    @VisibleForTesting
+    static final String FINGERPRINT_SUGGESTION_ACTIVITY =
+            "com.android.settings.SetupFingerprintSuggestionActivity";
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -85,16 +93,37 @@
 
     @Override
     protected void onNextButtonClick(View view) {
+        setFingerprintSuggestionEnabled();
         setResult(RESULT_FINISHED);
         finish();
     }
 
+    private void setFingerprintSuggestionEnabled() {
+        final FingerprintManager fpm = Utils.getFingerprintManagerOrNull(this);
+        if (fpm != null) {
+            int enrolled = fpm.getEnrolledFingerprints(mUserId).size();
+
+            // Only show "Add another fingerprint" if the user already enrolled one.
+            // "Add fingerprint" will be shown in the main flow if the user hasn't enrolled any
+            // fingerprints. If the user already added more than one fingerprint, they already know
+            // to add multiple fingerprints so we don't show the suggestion.
+            int flag = (enrolled == 1) ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
+                    : PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
+
+            ComponentName componentName = new ComponentName(getApplicationContext(),
+                    FINGERPRINT_SUGGESTION_ACTIVITY);
+            getPackageManager().setComponentEnabledSetting(
+                    componentName, flag, PackageManager.DONT_KILL_APP);
+        }
+    }
+
     private void onAddAnotherButtonClick(View view) {
         startActivityForResult(getFingerprintEnrollingIntent(), REQUEST_ADD_ANOTHER);
     }
 
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        setFingerprintSuggestionEnabled();
         if (requestCode == REQUEST_ADD_ANOTHER && resultCode != RESULT_CANCELED) {
             setResult(resultCode, data);
             finish();
diff --git a/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java b/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
index 9a651d2..d6a668e 100644
--- a/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
+++ b/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderController.java
@@ -39,6 +39,7 @@
 import com.android.settings.R;
 import com.android.settings.core.BasePreferenceController;
 import com.android.settings.fuelgauge.BatteryMeterView;
+import com.android.settingslib.bluetooth.BluetoothUtils;
 import com.android.settingslib.bluetooth.CachedBluetoothDevice;
 import com.android.settingslib.core.lifecycle.LifecycleObserver;
 import com.android.settingslib.core.lifecycle.events.OnDestroy;
@@ -69,13 +70,12 @@
     @VisibleForTesting
     Handler mHandler = new Handler(Looper.getMainLooper());
     @VisibleForTesting
-    final BluetoothAdapter.MetadataListener mMetadataListener =
-            new BluetoothAdapter.MetadataListener() {
+    final BluetoothAdapter.OnMetadataChangedListener mMetadataListener =
+            new BluetoothAdapter.OnMetadataChangedListener() {
                 @Override
-                public void onMetadataChanged(BluetoothDevice device, int key, String value) {
-                    super.onMetadataChanged(device, key, value);
+                public void onMetadataChanged(BluetoothDevice device, int key, byte[] value) {
                     Log.i(TAG, String.format("Metadata updated in Device %s: %d = %s.", device, key,
-                            value));
+                            value == null ? null : new String(value)));
                     refresh();
                 }
             };
@@ -88,9 +88,9 @@
 
     @Override
     public int getAvailabilityStatus() {
-        final boolean unthetheredHeadset = Utils.getBooleanMetaData(mCachedDevice.getDevice(),
-                BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET);
-        return unthetheredHeadset ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
+        final boolean untetheredHeadset = BluetoothUtils.getBooleanMetaData(
+                mCachedDevice.getDevice(), BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET);
+        return untetheredHeadset ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
     }
 
     @Override
@@ -108,8 +108,8 @@
             return;
         }
         mCachedDevice.registerCallback(this::onDeviceAttributesChanged);
-        mBluetoothAdapter.registerMetadataListener(mCachedDevice.getDevice(), mMetadataListener,
-                mHandler);
+        mBluetoothAdapter.addOnMetadataChangedListener(mCachedDevice.getDevice(),
+                mContext.getMainExecutor(), mMetadataListener);
     }
 
     @Override
@@ -118,7 +118,8 @@
             return;
         }
         mCachedDevice.unregisterCallback(this::onDeviceAttributesChanged);
-        mBluetoothAdapter.unregisterMetadataListener(mCachedDevice.getDevice());
+        mBluetoothAdapter.removeOnMetadataChangedListener(mCachedDevice.getDevice(),
+                mMetadataListener);
     }
 
     @Override
@@ -154,21 +155,21 @@
             }
 
             updateSubLayout(mLayoutPreference.findViewById(R.id.layout_left),
-                    BluetoothDevice.METADATA_UNTHETHERED_LEFT_ICON,
-                    BluetoothDevice.METADATA_UNTHETHERED_LEFT_BATTERY,
-                    BluetoothDevice.METADATA_UNTHETHERED_LEFT_CHARGING,
+                    BluetoothDevice.METADATA_UNTETHERED_LEFT_ICON,
+                    BluetoothDevice.METADATA_UNTETHERED_LEFT_BATTERY,
+                    BluetoothDevice.METADATA_UNTETHERED_LEFT_CHARGING,
                     R.string.bluetooth_left_name);
 
             updateSubLayout(mLayoutPreference.findViewById(R.id.layout_middle),
-                    BluetoothDevice.METADATA_UNTHETHERED_CASE_ICON,
-                    BluetoothDevice.METADATA_UNTHETHERED_CASE_BATTERY,
-                    BluetoothDevice.METADATA_UNTHETHERED_CASE_CHARGING,
+                    BluetoothDevice.METADATA_UNTETHERED_CASE_ICON,
+                    BluetoothDevice.METADATA_UNTETHERED_CASE_BATTERY,
+                    BluetoothDevice.METADATA_UNTETHERED_CASE_CHARGING,
                     R.string.bluetooth_middle_name);
 
             updateSubLayout(mLayoutPreference.findViewById(R.id.layout_right),
-                    BluetoothDevice.METADATA_UNTHETHERED_RIGHT_ICON,
-                    BluetoothDevice.METADATA_UNTHETHERED_RIGHT_BATTERY,
-                    BluetoothDevice.METADATA_UNTHETHERED_RIGHT_CHARGING,
+                    BluetoothDevice.METADATA_UNTETHERED_RIGHT_ICON,
+                    BluetoothDevice.METADATA_UNTETHERED_RIGHT_BATTERY,
+                    BluetoothDevice.METADATA_UNTETHERED_RIGHT_CHARGING,
                     R.string.bluetooth_right_name);
         }
     }
@@ -194,15 +195,15 @@
             return;
         }
         final BluetoothDevice bluetoothDevice = mCachedDevice.getDevice();
-        final String iconUri = Utils.getStringMetaData(bluetoothDevice, iconMetaKey);
+        final String iconUri = BluetoothUtils.getStringMetaData(bluetoothDevice, iconMetaKey);
         if (iconUri != null) {
             final ImageView imageView = linearLayout.findViewById(R.id.header_icon);
             updateIcon(imageView, iconUri);
         }
 
-        final int batteryLevel = Utils.getIntMetaData(bluetoothDevice, batteryMetaKey);
-        final boolean charging = Utils.getBooleanMetaData(bluetoothDevice, chargeMetaKey);
-        if (batteryLevel != Utils.META_INT_ERROR) {
+        final int batteryLevel = BluetoothUtils.getIntMetaData(bluetoothDevice, batteryMetaKey);
+        final boolean charging = BluetoothUtils.getBooleanMetaData(bluetoothDevice, chargeMetaKey);
+        if (batteryLevel != BluetoothUtils.META_INT_ERROR) {
             linearLayout.setVisibility(View.VISIBLE);
             final ImageView imageView = linearLayout.findViewById(R.id.bt_battery_icon);
             imageView.setImageDrawable(createBtBatteryIcon(mContext, batteryLevel, charging));
@@ -233,7 +234,7 @@
 
         // Only show bluetooth icon
         final BluetoothDevice bluetoothDevice = mCachedDevice.getDevice();
-        final String iconUri = Utils.getStringMetaData(bluetoothDevice,
+        final String iconUri = BluetoothUtils.getStringMetaData(bluetoothDevice,
                 BluetoothDevice.METADATA_MAIN_ICON);
         if (iconUri != null) {
             final ImageView imageView = linearLayout.findViewById(R.id.header_icon);
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java b/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java
index 47d56bc..ee63045 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsHeaderController.java
@@ -53,8 +53,8 @@
 
     @Override
     public boolean isAvailable() {
-        return !Utils.getBooleanMetaData(mCachedDevice.getDevice(),
-                BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET);
+        return !BluetoothUtils.getBooleanMetaData(mCachedDevice.getDevice(),
+                BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET);
     }
 
     @Override
diff --git a/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java b/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java
index e486b68..cd75951 100644
--- a/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java
+++ b/src/com/android/settings/bluetooth/BluetoothFeatureProviderImpl.java
@@ -33,8 +33,8 @@
 
     @Override
     public Uri getBluetoothDeviceSettingsUri(BluetoothDevice bluetoothDevice) {
-        final String uriString = bluetoothDevice.getMetadata(
+        final byte[] uriByte = bluetoothDevice.getMetadata(
                 BluetoothDevice.METADATA_ENHANCED_SETTINGS_UI_URI);
-        return uriString != null ? Uri.parse(uriString) : null;
+        return uriByte == null ? null : Uri.parse(new String(uriByte));
     }
 }
diff --git a/src/com/android/settings/bluetooth/Utils.java b/src/com/android/settings/bluetooth/Utils.java
index a86e1d5..d6e395e 100755
--- a/src/com/android/settings/bluetooth/Utils.java
+++ b/src/com/android/settings/bluetooth/Utils.java
@@ -47,8 +47,6 @@
     static final boolean V = BluetoothUtils.V; // verbose logging
     static final boolean D =  BluetoothUtils.D;  // regular logging
 
-    public static final int META_INT_ERROR = -1;
-
     private Utils() {
     }
 
@@ -154,30 +152,4 @@
         return Settings.Global.getInt(context.getContentResolver(),
                 Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE, 0) == 1;
     }
-
-    public static boolean getBooleanMetaData(BluetoothDevice bluetoothDevice, int key) {
-        if (bluetoothDevice == null) {
-            return false;
-        }
-
-        return Boolean.parseBoolean(bluetoothDevice.getMetadata(key));
-    }
-
-    public static String getStringMetaData(BluetoothDevice bluetoothDevice, int key) {
-        if (bluetoothDevice == null) {
-            return null;
-        }
-        return bluetoothDevice.getMetadata(key);
-    }
-
-    public static int getIntMetaData(BluetoothDevice bluetoothDevice, int key) {
-        if (bluetoothDevice == null) {
-            return META_INT_ERROR;
-        }
-        try {
-            return Integer.parseInt(bluetoothDevice.getMetadata(key));
-        } catch (NumberFormatException e) {
-            return META_INT_ERROR;
-        }
-    }
 }
diff --git a/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java b/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java
index 488f930..7a131d7 100644
--- a/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java
+++ b/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java
@@ -99,7 +99,8 @@
                             mSubId);
                     String newName = mNameView.getText().toString();
                     if (currentInfo != null && !currentInfo.getDisplayName().equals(newName)) {
-                        mSubscriptionManager.setDisplayName(newName, mSubId);
+                        mSubscriptionManager.setDisplayName(newName, mSubId,
+                                SubscriptionManager.NAME_SOURCE_USER_INPUT);
                     }
                 })
                 .setNegativeButton(android.R.string.cancel, null);
diff --git a/src/com/android/settings/nfc/OWNERS b/src/com/android/settings/nfc/OWNERS
index f11f74f..2017826 100644
--- a/src/com/android/settings/nfc/OWNERS
+++ b/src/com/android/settings/nfc/OWNERS
@@ -1,5 +1,5 @@
 # Default reviewers for this and subdirectories.
-eisenbach@google.com
-kandoiruchi@google.com
+rmojumder@google.com
 
-# Emergency approvers in case the above are not available
\ No newline at end of file
+# Emergency approvers in case the above are not available
+zachoverflow@google.com
diff --git a/src/com/android/settings/system/SystemUpdatePreferenceController.java b/src/com/android/settings/system/SystemUpdatePreferenceController.java
index dd04409..38a88b9 100644
--- a/src/com/android/settings/system/SystemUpdatePreferenceController.java
+++ b/src/com/android/settings/system/SystemUpdatePreferenceController.java
@@ -139,7 +139,8 @@
             }
             Log.d(TAG, "ciActionOnSysUpdate: broadcasting intent " + intentStr +
                     " with extra " + extra + ", " + extraVal);
+            intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
             mContext.getApplicationContext().sendBroadcast(intent);
         }
     }
-}
\ No newline at end of file
+}
diff --git a/tests/robotests/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollFinishTest.java b/tests/robotests/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollFinishTest.java
new file mode 100644
index 0000000..74b35c9
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollFinishTest.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2019 Google Inc.
+ *
+ * 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.biometrics.fingerprint;
+
+import static com.android.settings.biometrics.fingerprint.FingerprintEnrollFinish.FINGERPRINT_SUGGESTION_ACTIVITY;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.robolectric.RuntimeEnvironment.application;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.hardware.fingerprint.FingerprintManager;
+
+import com.android.settings.R;
+import com.android.settings.testutils.shadow.ShadowFingerprintManager;
+
+import com.google.android.setupcompat.PartnerCustomizationLayout;
+import com.google.android.setupcompat.template.FooterBarMixin;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.Robolectric;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.Shadows;
+import org.robolectric.annotation.Config;
+import org.robolectric.shadows.ShadowActivity;
+
+@RunWith(RobolectricTestRunner.class)
+@Config(shadows = {ShadowFingerprintManager.class})
+public class SetupFingerprintEnrollFinishTest {
+
+    private FingerprintEnrollFinish mActivity;
+    private ComponentName mComponentName;
+    private PartnerCustomizationLayout mLayout;
+    private FingerprintManager mFingerprintManager;
+
+    @Before
+    public void setUp() {
+        mActivity = Robolectric.buildActivity(FingerprintEnrollFinish.class).setup().get();
+        mLayout = mActivity.findViewById(R.id.setup_wizard_layout);
+        Shadows.shadowOf(application.getPackageManager())
+                .setSystemFeature(PackageManager.FEATURE_FINGERPRINT, true);
+
+        mFingerprintManager = (FingerprintManager) application.getSystemService(
+                Context.FINGERPRINT_SERVICE);
+        Shadows.shadowOf(mFingerprintManager).setIsHardwareDetected(true);
+
+        mComponentName = new ComponentName(
+                application, FINGERPRINT_SUGGESTION_ACTIVITY);
+    }
+
+    @Test
+    public void clickAddAnother_shouldLaunchEnrolling() {
+        final ComponentName enrollingComponent = new ComponentName(
+                application,
+                FingerprintEnrollEnrolling.class);
+
+        mLayout.getMixin(FooterBarMixin.class).getSecondaryButtonView().performClick();
+
+        ShadowActivity.IntentForResult startedActivity =
+                Shadows.shadowOf(mActivity).getNextStartedActivityForResult();
+        assertThat(startedActivity).named("Next activity").isNotNull();
+        assertThat(startedActivity.intent.getComponent())
+                .isEqualTo(enrollingComponent);
+    }
+
+    @Test
+    public void clickAddAnother_shouldPropagateResults() {
+        final ComponentName enrollingComponent = new ComponentName(
+                application,
+                FingerprintEnrollEnrolling.class);
+
+        mLayout.getMixin(FooterBarMixin.class).getSecondaryButtonView().performClick();
+
+        ShadowActivity.IntentForResult startedActivity =
+                Shadows.shadowOf(mActivity).getNextStartedActivityForResult();
+        assertThat(startedActivity).named("Next activity").isNotNull();
+        assertThat(startedActivity.intent.getComponent())
+                .isEqualTo(enrollingComponent);
+    }
+
+    @Test
+    public void clickNext_shouldFinish() {
+        mLayout.getMixin(FooterBarMixin.class).getPrimaryButtonView().performClick();
+
+        assertThat(mActivity.isFinishing()).isTrue();
+    }
+
+    @Test
+    public void onActivityResult_fingerprintCountIsNotOne_fingerprintSuggestionActivityDisabled() {
+        Shadows.shadowOf((FingerprintManager) mFingerprintManager).setDefaultFingerprints(0);
+
+        mActivity.onActivityResult(0, 0, null);
+
+        assertThat(application.getPackageManager().getComponentEnabledSetting(
+                mComponentName)).isEqualTo(PackageManager.COMPONENT_ENABLED_STATE_DISABLED);
+    }
+
+    @Test
+    public void onActivityResult_fingerprintCountIsOne_fingerprintSuggestionActivityEnabled() {
+        Shadows.shadowOf((FingerprintManager) mFingerprintManager).setDefaultFingerprints(1);
+
+        mActivity.onActivityResult(0, 0, null);
+
+        assertThat(application.getPackageManager().getComponentEnabledSetting(
+                mComponentName)).isEqualTo(PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
+    }
+
+    @Test
+    public void clickNext_fingerprintCountIsNotOne_fingerprintSuggestionActivityDisabled() {
+        Shadows.shadowOf((FingerprintManager) mFingerprintManager).setDefaultFingerprints(2);
+
+        mLayout.getMixin(FooterBarMixin.class).getPrimaryButtonView().performClick();
+
+        assertThat(application.getPackageManager().getComponentEnabledSetting(
+                mComponentName)).isEqualTo(PackageManager.COMPONENT_ENABLED_STATE_DISABLED);
+    }
+
+    @Test
+    public void clickNext_fingerprintCountIsOne_fngerprintSuggestionActivityEnabled() {
+        Shadows.shadowOf((FingerprintManager) mFingerprintManager).setDefaultFingerprints(1);
+
+        mLayout.getMixin(FooterBarMixin.class).getPrimaryButtonView().performClick();
+
+        assertThat(application.getPackageManager().getComponentEnabledSetting(
+                mComponentName)).isEqualTo(PackageManager.COMPONENT_ENABLED_STATE_ENABLED);
+    }
+}
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
index 3532bf8..362b003 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/AdvancedBluetoothDetailsHeaderControllerTest.java
@@ -104,14 +104,14 @@
     @Test
     public void refresh_connected_updateCorrectInfo() {
         when(mBluetoothDevice.getMetadata(
-                BluetoothDevice.METADATA_UNTHETHERED_LEFT_BATTERY)).thenReturn(
-                String.valueOf(BATTERY_LEVEL_LEFT));
+                BluetoothDevice.METADATA_UNTETHERED_LEFT_BATTERY)).thenReturn(
+                String.valueOf(BATTERY_LEVEL_LEFT).getBytes());
         when(mBluetoothDevice.getMetadata(
-                BluetoothDevice.METADATA_UNTHETHERED_RIGHT_BATTERY)).thenReturn(
-                String.valueOf(BATTERY_LEVEL_RIGHT));
+                BluetoothDevice.METADATA_UNTETHERED_RIGHT_BATTERY)).thenReturn(
+                String.valueOf(BATTERY_LEVEL_RIGHT).getBytes());
         when(mBluetoothDevice.getMetadata(
-                BluetoothDevice.METADATA_UNTHETHERED_CASE_BATTERY)).thenReturn(
-                String.valueOf(BATTERY_LEVEL_MAIN));
+                BluetoothDevice.METADATA_UNTETHERED_CASE_BATTERY)).thenReturn(
+                String.valueOf(BATTERY_LEVEL_MAIN).getBytes());
         when(mCachedDevice.isConnected()).thenReturn(true);
         mController.refresh();
 
@@ -141,18 +141,18 @@
     }
 
     @Test
-    public void getAvailabilityStatus_unthetheredHeadset_returnAvailable() {
-        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
-                .thenReturn("true");
+    public void getAvailabilityStatus_untetheredHeadset_returnAvailable() {
+        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET))
+                .thenReturn("true".getBytes());
 
         assertThat(mController.getAvailabilityStatus()).isEqualTo(
                 BasePreferenceController.AVAILABLE);
     }
 
     @Test
-    public void getAvailabilityStatus_notUnthetheredHeadset_returnUnavailable() {
-        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
-                .thenReturn("false");
+    public void getAvailabilityStatus_notUntetheredHeadset_returnUnavailable() {
+        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET))
+                .thenReturn("false".getBytes());
 
         assertThat(mController.getAvailabilityStatus()).isEqualTo(
                 BasePreferenceController.CONDITIONALLY_UNAVAILABLE);
@@ -169,50 +169,52 @@
 
     @Test
     public void onStart_isAvailable_registerCallback() {
-        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
-                .thenReturn("true");
+        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET))
+                .thenReturn("true".getBytes());
 
         mController.onStart();
 
-        verify(mBluetoothAdapter).registerMetadataListener(mBluetoothDevice,
-                mController.mMetadataListener, mController.mHandler);
+        verify(mBluetoothAdapter).addOnMetadataChangedListener(mBluetoothDevice,
+                mContext.getMainExecutor() ,mController.mMetadataListener);
     }
 
     @Test
     public void onStop_isAvailable_unregisterCallback() {
-        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
-                .thenReturn("true");
+        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET))
+                .thenReturn("true".getBytes());
 
         mController.onStop();
 
-        verify(mBluetoothAdapter).unregisterMetadataListener(mBluetoothDevice);
+        verify(mBluetoothAdapter).removeOnMetadataChangedListener(mBluetoothDevice,
+                mController.mMetadataListener);
     }
 
     @Test
     public void onStart_notAvailable_registerCallback() {
-        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
-                .thenReturn("false");
+        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET))
+                .thenReturn("false".getBytes());
 
         mController.onStart();
 
-        verify(mBluetoothAdapter, never()).registerMetadataListener(mBluetoothDevice,
-                mController.mMetadataListener, mController.mHandler);
+        verify(mBluetoothAdapter, never()).addOnMetadataChangedListener(mBluetoothDevice,
+                mContext.getMainExecutor() ,mController.mMetadataListener);
     }
 
     @Test
     public void onStop_notAvailable_unregisterCallback() {
-        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
-                .thenReturn("false");
+        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET))
+                .thenReturn("false".getBytes());
 
         mController.onStop();
 
-        verify(mBluetoothAdapter, never()).unregisterMetadataListener(mBluetoothDevice);
+        verify(mBluetoothAdapter, never()).removeOnMetadataChangedListener(mBluetoothDevice,
+                mController.mMetadataListener);
     }
 
     @Test
     public void onDestroy_isAvailable_recycleBitmap() {
-        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET))
-                .thenReturn("true");
+        when(mBluetoothDevice.getMetadata(BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET))
+                .thenReturn("true".getBytes());
         mController.mIconCache.put(ICON_URI, mBitmap);
 
         mController.onDestroy();
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java
index cf119ea..1ee1de6 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHeaderControllerTest.java
@@ -123,9 +123,9 @@
     }
 
     @Test
-    public void isAvailable_unthetheredHeadset_returnFalse() {
+    public void isAvailable_untetheredHeadset_returnFalse() {
         when(mBluetoothDevice.getMetadata(
-                BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET)).thenReturn("true");
+                BluetoothDevice.METADATA_IS_UNTETHERED_HEADSET)).thenReturn("true".getBytes());
 
         assertThat(mController.isAvailable()).isFalse();
     }
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothFeatureProviderImplTest.java
index a921215..9ab1d87 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothFeatureProviderImplTest.java
@@ -49,7 +49,8 @@
     @Test
     public void getBluetoothDeviceSettingsUri_containCorrectMacAddress() {
         when(mBluetoothDevice.getMetadata(
-                BluetoothDevice.METADATA_ENHANCED_SETTINGS_UI_URI)).thenReturn(SETTINGS_URI);
+                BluetoothDevice.METADATA_ENHANCED_SETTINGS_UI_URI)).thenReturn(
+                SETTINGS_URI.getBytes());
         final Uri uri = mBluetoothFeatureProvider.getBluetoothDeviceSettingsUri(mBluetoothDevice);
         assertThat(uri.toString()).isEqualTo(SETTINGS_URI);
     }
diff --git a/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java b/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java
index ee79d61..1920019 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java
@@ -43,14 +43,8 @@
 @RunWith(RobolectricTestRunner.class)
 public class UtilsTest {
 
-    private static final String STRING_METADATA = "string_metadata";
-    private static final String BOOL_METADATA = "true";
-    private static final String INT_METADATA = "25";
-
     @Mock(answer = Answers.RETURNS_DEEP_STUBS)
     private Context mContext;
-    @Mock
-    private BluetoothDevice mBluetoothDevice;
 
     private MetricsFeatureProvider mMetricsFeatureProvider;
 
@@ -69,41 +63,4 @@
         verify(mMetricsFeatureProvider).visible(eq(mContext), anyInt(),
                 eq(MetricsEvent.ACTION_SETTINGS_BLUETOOTH_CONNECT_ERROR));
     }
-
-    @Test
-    public void getStringMetaData_hasMetaData_getCorrectMetaData() {
-        when(mBluetoothDevice.getMetadata(
-                BluetoothDevice.METADATA_UNTHETHERED_LEFT_ICON)).thenReturn(STRING_METADATA);
-
-        assertThat(Utils.getStringMetaData(mBluetoothDevice,
-                BluetoothDevice.METADATA_UNTHETHERED_LEFT_ICON)).isEqualTo(STRING_METADATA);
-    }
-
-    @Test
-    public void getIntMetaData_hasMetaData_getCorrectMetaData() {
-        when(mBluetoothDevice.getMetadata(
-            BluetoothDevice.METADATA_UNTHETHERED_LEFT_BATTERY)).thenReturn(INT_METADATA);
-
-        assertThat(Utils.getIntMetaData(mBluetoothDevice,
-            BluetoothDevice.METADATA_UNTHETHERED_LEFT_BATTERY))
-            .isEqualTo(Integer.parseInt(INT_METADATA));
-    }
-
-    @Test
-    public void getIntMetaData_invalidMetaData_getErrorCode() {
-        when(mBluetoothDevice.getMetadata(
-                BluetoothDevice.METADATA_UNTHETHERED_LEFT_BATTERY)).thenReturn(STRING_METADATA);
-
-        assertThat(Utils.getIntMetaData(mBluetoothDevice,
-                BluetoothDevice.METADATA_UNTHETHERED_LEFT_ICON)).isEqualTo(Utils.META_INT_ERROR);
-    }
-
-    @Test
-    public void getBooleanMetaData_hasMetaData_getCorrectMetaData() {
-        when(mBluetoothDevice.getMetadata(
-                BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET)).thenReturn(BOOL_METADATA);
-
-        assertThat(Utils.getBooleanMetaData(mBluetoothDevice,
-                BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET)).isEqualTo(true);
-    }
 }
diff --git a/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java b/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java
index df52302..70816ea 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragmentTest.java
@@ -102,7 +102,7 @@
         final Button negativeButton = dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
         negativeButton.performClick();
 
-        verify(mSubscriptionMgr, never()).setDisplayName(anyString(), anyInt());
+        verify(mSubscriptionMgr, never()).setDisplayName(anyString(), anyInt(), anyInt());
     }
 
     @Test
@@ -118,7 +118,8 @@
         positiveButton.performClick();
 
         final ArgumentCaptor<String> captor = ArgumentCaptor.forClass(String.class);
-        verify(mSubscriptionMgr).setDisplayName(captor.capture(), eq(mSubscriptionId));
+        verify(mSubscriptionMgr).setDisplayName(captor.capture(), eq(mSubscriptionId),
+                eq(SubscriptionManager.NAME_SOURCE_USER_INPUT));
         assertThat(captor.getValue()).isEqualTo("test2");
     }