Merge "Convert ProfileSelectDialog to androidx verison"
diff --git a/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java b/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
index dece0cc..84cab40 100644
--- a/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
+++ b/src/com/android/settings/bluetooth/BluetoothDeviceUpdater.java
@@ -128,9 +128,6 @@
     }
 
     @Override
-    public void onScanningStateChanged(boolean started) {}
-
-    @Override
     public void onDeviceAdded(CachedBluetoothDevice cachedDevice) {
         update(cachedDevice);
     }
@@ -149,17 +146,6 @@
     }
 
     @Override
-    public void onConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state) {}
-
-    @Override
-    public void onActiveDeviceChanged(CachedBluetoothDevice activeDevice, int bluetoothProfile) {
-    }
-
-    @Override
-    public void onAudioModeChanged() {
-    }
-
-    @Override
     public void onProfileConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state,
             int bluetoothProfile) {
         if (DBG) {
diff --git a/src/com/android/settings/bluetooth/BluetoothSummaryUpdater.java b/src/com/android/settings/bluetooth/BluetoothSummaryUpdater.java
index 03fffa4..d577b0a 100644
--- a/src/com/android/settings/bluetooth/BluetoothSummaryUpdater.java
+++ b/src/com/android/settings/bluetooth/BluetoothSummaryUpdater.java
@@ -59,30 +59,6 @@
     }
 
     @Override
-    public void onScanningStateChanged(boolean started) {
-    }
-
-    @Override
-    public void onDeviceAdded(CachedBluetoothDevice cachedDevice) {
-    }
-
-    @Override
-    public void onDeviceDeleted(CachedBluetoothDevice cachedDevice) {
-    }
-
-    @Override
-    public void onDeviceBondStateChanged(CachedBluetoothDevice cachedDevice, int bondState) {
-    }
-
-    @Override
-    public void onActiveDeviceChanged(CachedBluetoothDevice activeDevice, int bluetoothProfile) {
-    }
-
-    @Override
-    public void onAudioModeChanged() {
-    }
-
-    @Override
     public void register(boolean listening) {
         if (mBluetoothAdapter == null) {
             return;
diff --git a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
index 7c4224e..46d649a 100644
--- a/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
+++ b/src/com/android/settings/bluetooth/DeviceListPreferenceFragment.java
@@ -244,9 +244,6 @@
         }
     }
 
-    @Override
-    public void onBluetoothStateChanged(int bluetoothState) {}
-
     /**
      * Add bluetooth device preferences to {@code preferenceGroup} which satisfy the {@code filter}
      *
@@ -270,14 +267,6 @@
         removeCachedPrefs(preferenceGroup);
     }
 
-    public void onConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state) { }
-
-    @Override
-    public void onActiveDeviceChanged(CachedBluetoothDevice activeDevice, int bluetoothProfile) { }
-
-    @Override
-    public void onAudioModeChanged() { }
-
     /**
      * Return the key of the {@link PreferenceGroup} that contains the bluetooth devices
      */
diff --git a/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupController.java b/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupController.java
index 5959414..183ed3f 100644
--- a/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupController.java
+++ b/src/com/android/settings/connecteddevice/AvailableMediaDeviceGroupController.java
@@ -28,7 +28,6 @@
 import com.android.settings.core.BasePreferenceController;
 import com.android.settings.dashboard.DashboardFragment;
 import com.android.settingslib.bluetooth.BluetoothCallback;
-import com.android.settingslib.bluetooth.CachedBluetoothDevice;
 import com.android.settingslib.bluetooth.LocalBluetoothManager;
 import com.android.settingslib.core.lifecycle.LifecycleObserver;
 import com.android.settingslib.core.lifecycle.events.OnStart;
@@ -132,41 +131,6 @@
     }
 
     @Override
-    public void onBluetoothStateChanged(int bluetoothState) {
-        // do nothing
-    }
-
-    @Override
-    public void onScanningStateChanged(boolean started) {
-        // do nothing
-    }
-
-    @Override
-    public void onDeviceAdded(CachedBluetoothDevice cachedDevice) {
-        // do nothing
-    }
-
-    @Override
-    public void onDeviceDeleted(CachedBluetoothDevice cachedDevice) {
-        // do nothing
-    }
-
-    @Override
-    public void onDeviceBondStateChanged(CachedBluetoothDevice cachedDevice, int bondState) {
-        // do nothing
-    }
-
-    @Override
-    public void onConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state) {
-        // do nothing
-    }
-
-    @Override
-    public void onActiveDeviceChanged(CachedBluetoothDevice activeDevice, int bluetoothProfile) {
-        // do nothing
-    }
-
-    @Override
     public void onAudioModeChanged() {
         updateTitle();
     }
diff --git a/src/com/android/settings/sound/AudioSwitchPreferenceController.java b/src/com/android/settings/sound/AudioSwitchPreferenceController.java
index dcbed15..d5e3aff 100644
--- a/src/com/android/settings/sound/AudioSwitchPreferenceController.java
+++ b/src/com/android/settings/sound/AudioSwitchPreferenceController.java
@@ -184,14 +184,6 @@
         unregister();
     }
 
-    /**
-     * Only concerned about whether the local adapter is connected to any profile of any device and
-     * are not really concerned about which profile.
-     */
-    @Override
-    public void onConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state) {
-    }
-
     @Override
     public void onActiveDeviceChanged(CachedBluetoothDevice activeDevice, int bluetoothProfile) {
         updateState(mPreference);
@@ -208,17 +200,6 @@
         updateState(mPreference);
     }
 
-    @Override
-    public void onBluetoothStateChanged(int bluetoothState) {
-    }
-
-    /**
-     * The local Bluetooth adapter has started the remote device discovery process.
-     */
-    @Override
-    public void onScanningStateChanged(boolean started) {
-    }
-
     /**
      * Indicates a change in the bond state of a remote
      * device. For example, if a device is bonded (paired).
@@ -228,14 +209,6 @@
         updateState(mPreference);
     }
 
-    @Override
-    public void onDeviceDeleted(CachedBluetoothDevice cachedDevice) {
-    }
-
-    @Override
-    public void onDeviceBondStateChanged(CachedBluetoothDevice cachedDevice, int bondState) {
-    }
-
     public void setCallback(AudioSwitchCallback callback) {
         mAudioSwitchPreferenceCallback = callback;
     }
diff --git a/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java
index c9edc00..df3ffbb 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java
@@ -17,6 +17,7 @@
 package com.android.settings.bluetooth;
 
 import static com.google.common.truth.Truth.assertThat;
+
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyString;
 import static org.mockito.Mockito.doReturn;
@@ -29,15 +30,17 @@
 import android.widget.Button;
 import android.widget.EditText;
 
+import androidx.appcompat.app.AlertDialog;
+
 import com.android.settings.R;
 import com.android.settings.testutils.FakeFeatureFactory;
 import com.android.settings.testutils.SettingsRobolectricTestRunner;
 import com.android.settings.testutils.shadow.SettingsShadowResourcesImpl;
+import com.android.settings.testutils.shadow.ShadowDynamicLayout;
 import com.android.settingslib.bluetooth.CachedBluetoothDevice;
 import com.android.settingslib.testutils.FragmentTestUtils;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Answers;
@@ -46,10 +49,8 @@
 import org.robolectric.annotation.Config;
 import org.robolectric.shadows.ShadowDialog;
 
-import androidx.appcompat.app.AlertDialog;
-
 @RunWith(SettingsRobolectricTestRunner.class)
-@Config(shadows = SettingsShadowResourcesImpl.class)
+@Config(shadows = {SettingsShadowResourcesImpl.class, ShadowDynamicLayout.class})
 public class RemoteDeviceNameDialogFragmentTest {
 
     @Mock(answer = Answers.RETURNS_DEEP_STUBS)
@@ -81,7 +82,6 @@
     }
 
     @Test
-    @Ignore
     public void deviceNameDisplayIsCorrect() {
         String deviceName = "ABC Corp Headphones";
         AlertDialog dialog = startDialog(deviceName);
@@ -97,7 +97,6 @@
     }
 
     @Test
-    @Ignore
     public void deviceNameEditSucceeds() {
         String deviceNameInitial = "ABC Corp Headphones";
         String deviceNameModified = "My Headphones";
@@ -120,7 +119,6 @@
     }
 
     @Test
-    @Ignore
     public void deviceNameEditThenCancelDoesntRename() {
         String deviceNameInitial = "ABC Corp Headphones";
         String deviceNameModified = "My Headphones";
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDynamicLayout.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDynamicLayout.java
new file mode 100644
index 0000000..d3741bb
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowDynamicLayout.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * 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.testutils.shadow;
+
+import android.text.DynamicLayout;
+import android.text.Layout.Directions;
+
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+
+@Implements(DynamicLayout.class)
+public class ShadowDynamicLayout {
+
+    @Implementation
+    public int getLineTop(int line) {
+        return 0;
+    }
+
+    @Implementation
+    public int getLineStart(int line) {
+        return 0;
+    }
+
+    @Implementation
+    public final Directions getLineDirections(int line) {
+        return new Directions(new int[]{0, 1});
+    }
+}
\ No newline at end of file