Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -1205,4 +1205,12 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> return mProfileManager.getHeadsetProfile().getConnectionStatus(mDevice) == return mProfileManager.getHeadsetProfile().getConnectionStatus(mDevice) == BluetoothProfile.STATE_CONNECTED; BluetoothProfile.STATE_CONNECTED; } } /** * @return {@code true} if {@code cachedBluetoothDevice} is Hearing Aid device */ public boolean isConnectedHearingAidDevice() { return mProfileManager.getHearingAidProfile().getConnectionStatus(mDevice) == BluetoothProfile.STATE_CONNECTED; } } } packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceTest.java +18 −0 Original line number Original line Diff line number Diff line Loading @@ -572,4 +572,22 @@ public class CachedBluetoothDeviceTest { assertThat(mCachedDevice.isHfpDevice()).isFalse(); assertThat(mCachedDevice.isHfpDevice()).isFalse(); } } @Test public void isConnectedHearingAidDevice_connected_returnTrue() { when(mProfileManager.getHearingAidProfile()).thenReturn(mHearingAidProfile); when(mHearingAidProfile.getConnectionStatus(mDevice)). thenReturn(BluetoothProfile.STATE_CONNECTED); assertThat(mCachedDevice.isConnectedHearingAidDevice()).isTrue(); } @Test public void isConnectedHearingAidDevice_disconnected_returnFalse() { when(mProfileManager.getHearingAidProfile()).thenReturn(mHearingAidProfile); when(mHearingAidProfile.getConnectionStatus(mDevice)). thenReturn(BluetoothProfile.STATE_DISCONNECTED); assertThat(mCachedDevice.isConnectedHearingAidDevice()).isFalse(); } } } Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -1205,4 +1205,12 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> return mProfileManager.getHeadsetProfile().getConnectionStatus(mDevice) == return mProfileManager.getHeadsetProfile().getConnectionStatus(mDevice) == BluetoothProfile.STATE_CONNECTED; BluetoothProfile.STATE_CONNECTED; } } /** * @return {@code true} if {@code cachedBluetoothDevice} is Hearing Aid device */ public boolean isConnectedHearingAidDevice() { return mProfileManager.getHearingAidProfile().getConnectionStatus(mDevice) == BluetoothProfile.STATE_CONNECTED; } } }
packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/CachedBluetoothDeviceTest.java +18 −0 Original line number Original line Diff line number Diff line Loading @@ -572,4 +572,22 @@ public class CachedBluetoothDeviceTest { assertThat(mCachedDevice.isHfpDevice()).isFalse(); assertThat(mCachedDevice.isHfpDevice()).isFalse(); } } @Test public void isConnectedHearingAidDevice_connected_returnTrue() { when(mProfileManager.getHearingAidProfile()).thenReturn(mHearingAidProfile); when(mHearingAidProfile.getConnectionStatus(mDevice)). thenReturn(BluetoothProfile.STATE_CONNECTED); assertThat(mCachedDevice.isConnectedHearingAidDevice()).isTrue(); } @Test public void isConnectedHearingAidDevice_disconnected_returnFalse() { when(mProfileManager.getHearingAidProfile()).thenReturn(mHearingAidProfile); when(mHearingAidProfile.getConnectionStatus(mDevice)). thenReturn(BluetoothProfile.STATE_DISCONNECTED); assertThat(mCachedDevice.isConnectedHearingAidDevice()).isFalse(); } } }