From 156d52e14fc1cac97d381b6ab450a933480899e3 Mon Sep 17 00:00:00 2001 From: timhypeng Date: Mon, 20 Aug 2018 15:53:37 +0800 Subject: [PATCH] Update the method name from isA2dpDevice() to isConnectedA2dpDevice() Bug: 110072747 Test: make -j50 RunSettingsRoboTests Change-Id: Id3ceb3a62b888a2bde82a1372edf26454e525ea1 --- .../AvailableMediaBluetoothDeviceUpdater.java | 2 +- .../bluetooth/ConnectedBluetoothDeviceUpdater.java | 2 +- .../AvailableMediaBluetoothDeviceUpdaterTest.java | 10 ++++------ .../bluetooth/ConnectedBluetoothDeviceUpdaterTest.java | 8 ++++---- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdater.java b/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdater.java index c2e6f2f8d89..45d3c33bd3d 100644 --- a/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdater.java +++ b/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdater.java @@ -81,7 +81,7 @@ public class AvailableMediaBluetoothDeviceUpdater extends BluetoothDeviceUpdater // show the bluetooth device that have headset profile. switch (currentAudioProfile) { case BluetoothProfile.A2DP: - isFilterMatched = cachedDevice.isA2dpDevice(); + isFilterMatched = cachedDevice.isConnectedA2dpDevice(); break; case BluetoothProfile.HEADSET: isFilterMatched = cachedDevice.isHfpDevice(); diff --git a/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdater.java b/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdater.java index b66b286b0fd..c66693af019 100644 --- a/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdater.java +++ b/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdater.java @@ -82,7 +82,7 @@ public class ConnectedBluetoothDeviceUpdater extends BluetoothDeviceUpdater { // show the bluetooth device that doesn't have headset profile. switch (currentAudioProfile) { case BluetoothProfile.A2DP: - isFilterMatched = !cachedDevice.isA2dpDevice(); + isFilterMatched = !cachedDevice.isConnectedA2dpDevice(); break; case BluetoothProfile.HEADSET: isFilterMatched = !cachedDevice.isHfpDevice(); diff --git a/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java index 14d9ca79d01..ee9c1fe95d4 100644 --- a/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java +++ b/tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java @@ -35,8 +35,6 @@ import com.android.settings.testutils.shadow.ShadowAudioManager; import com.android.settings.testutils.shadow.ShadowBluetoothAdapter; import com.android.settings.testutils.shadow.ShadowCachedBluetoothDeviceManager; import com.android.settingslib.bluetooth.CachedBluetoothDevice; -import com.android.settingslib.bluetooth.HeadsetProfile; -import com.android.settingslib.bluetooth.LocalBluetoothProfileManager; import org.junit.Before; import org.junit.Test; @@ -127,7 +125,7 @@ public class AvailableMediaBluetoothDeviceUpdaterTest { mShadowAudioManager.setMode(AudioManager.MODE_IN_CALL); when(mBluetoothDeviceUpdater. isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); - when(mCachedBluetoothDevice.isA2dpDevice()).thenReturn(true); + when(mCachedBluetoothDevice.isConnectedA2dpDevice()).thenReturn(true); mCachedDevices.add(mCachedBluetoothDevice); mBluetoothDeviceUpdater.onAudioModeChanged(); @@ -140,7 +138,7 @@ public class AvailableMediaBluetoothDeviceUpdaterTest { mShadowAudioManager.setMode(AudioManager.MODE_NORMAL); when(mBluetoothDeviceUpdater. isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); - when(mCachedBluetoothDevice.isA2dpDevice()).thenReturn(true); + when(mCachedBluetoothDevice.isConnectedA2dpDevice()).thenReturn(true); mCachedDevices.add(mCachedBluetoothDevice); mBluetoothDeviceUpdater.onAudioModeChanged(); @@ -153,7 +151,7 @@ public class AvailableMediaBluetoothDeviceUpdaterTest { mShadowAudioManager.setMode(AudioManager.MODE_NORMAL); when(mBluetoothDeviceUpdater. isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); - when(mCachedBluetoothDevice.isA2dpDevice()).thenReturn(true); + when(mCachedBluetoothDevice.isConnectedA2dpDevice()).thenReturn(true); mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, BluetoothProfile.STATE_CONNECTED, BluetoothProfile.A2DP); @@ -166,7 +164,7 @@ public class AvailableMediaBluetoothDeviceUpdaterTest { mShadowAudioManager.setMode(AudioManager.MODE_IN_CALL); when(mBluetoothDeviceUpdater. isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); - when(mCachedBluetoothDevice.isA2dpDevice()).thenReturn(true); + when(mCachedBluetoothDevice.isConnectedA2dpDevice()).thenReturn(true); mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, BluetoothProfile.STATE_CONNECTED, BluetoothProfile.A2DP); diff --git a/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java index 6faea9a2334..e3ebabec4da 100644 --- a/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java +++ b/tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java @@ -123,7 +123,7 @@ public class ConnectedBluetoothDeviceUpdaterTest { mShadowAudioManager.setMode(AudioManager.MODE_NORMAL); when(mBluetoothDeviceUpdater. isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); - when(mCachedBluetoothDevice.isA2dpDevice()).thenReturn(true); + when(mCachedBluetoothDevice.isConnectedA2dpDevice()).thenReturn(true); mCachedDevices.add(mCachedBluetoothDevice); mBluetoothDeviceUpdater.onAudioModeChanged(); @@ -136,7 +136,7 @@ public class ConnectedBluetoothDeviceUpdaterTest { mShadowAudioManager.setMode(AudioManager.MODE_IN_CALL); when(mBluetoothDeviceUpdater. isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); - when(mCachedBluetoothDevice.isA2dpDevice()).thenReturn(true); + when(mCachedBluetoothDevice.isConnectedA2dpDevice()).thenReturn(true); mCachedDevices.add(mCachedBluetoothDevice); mBluetoothDeviceUpdater.onAudioModeChanged(); @@ -149,7 +149,7 @@ public class ConnectedBluetoothDeviceUpdaterTest { mShadowAudioManager.setMode(AudioManager.MODE_IN_CALL); when(mBluetoothDeviceUpdater. isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); - when(mCachedBluetoothDevice.isA2dpDevice()).thenReturn(true); + when(mCachedBluetoothDevice.isConnectedA2dpDevice()).thenReturn(true); mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, BluetoothProfile.STATE_CONNECTED, BluetoothProfile.A2DP); @@ -162,7 +162,7 @@ public class ConnectedBluetoothDeviceUpdaterTest { mShadowAudioManager.setMode(AudioManager.MODE_NORMAL); when(mBluetoothDeviceUpdater. isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); - when(mCachedBluetoothDevice.isA2dpDevice()).thenReturn(true); + when(mCachedBluetoothDevice.isConnectedA2dpDevice()).thenReturn(true); mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, BluetoothProfile.STATE_CONNECTED, BluetoothProfile.A2DP);