Loading src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdater.java +5 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,11 @@ public class AvailableMediaBluetoothDeviceUpdater extends BluetoothDeviceUpdater if (DBG) { Log.d(TAG, "isFilterMatched() current audio profile : " + currentAudioProfile); } // If device is Hearing Aid, it is compatible with HFP and A2DP. // It would show in Available Devices group. if (cachedDevice.isConnectedHearingAidDevice()) { return true; } // According to the current audio profile type, // this page will show the bluetooth device that have corresponding profile. // For example: Loading src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdater.java +5 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,11 @@ public class ConnectedBluetoothDeviceUpdater extends BluetoothDeviceUpdater { if (DBG) { Log.d(TAG, "isFilterMatched() current audio profile : " + currentAudioProfile); } // If device is Hearing Aid, it is compatible with HFP and A2DP. // It would not show in Connected Devices group. if (cachedDevice.isConnectedHearingAidDevice()) { return false; } // According to the current audio profile type, // this page will show the bluetooth device that doesn't have corresponding profile. // For example: Loading tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java +27 −0 Original line number Diff line number Diff line Loading @@ -203,6 +203,33 @@ public class AvailableMediaBluetoothDeviceUpdaterTest { verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice); } @Test public void onProfileConnectionStateChanged_hearingAidDeviceConnected_notInCall_addPreference() { mShadowAudioManager.setMode(AudioManager.MODE_NORMAL); when(mBluetoothDeviceUpdater. isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); when(mCachedBluetoothDevice.isConnectedHearingAidDevice()).thenReturn(true); mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, BluetoothProfile.STATE_CONNECTED, BluetoothProfile.HEARING_AID); verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice); } @Test public void onProfileConnectionStateChanged_hearingAidDeviceConnected_inCall_addPreference() { mShadowAudioManager.setMode(AudioManager.MODE_IN_CALL); when(mBluetoothDeviceUpdater. isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); when(mCachedBluetoothDevice.isConnectedHearingAidDevice()).thenReturn(true); mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, BluetoothProfile.STATE_CONNECTED, BluetoothProfile.HEARING_AID); verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice); } @Test public void onProfileConnectionStateChanged_deviceDisconnected_removePreference() { mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, Loading tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java +28 −0 Original line number Diff line number Diff line Loading @@ -204,6 +204,34 @@ public class ConnectedBluetoothDeviceUpdaterTest { verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice); } @Test public void onProfileConnectionStateChanged_hearingAidDeviceConnected_inCall_removePreference() { mShadowAudioManager.setMode(AudioManager.MODE_IN_CALL); when(mBluetoothDeviceUpdater. isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); when(mCachedBluetoothDevice.isConnectedHearingAidDevice()).thenReturn(true); mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, BluetoothProfile.STATE_CONNECTED, BluetoothProfile.HEARING_AID); verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice); } @Test public void onProfileConnectionStateChanged_hearingAidDeviceConnected_notInCall_removePreference () { mShadowAudioManager.setMode(AudioManager.MODE_NORMAL); when(mBluetoothDeviceUpdater. isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); when(mCachedBluetoothDevice.isConnectedHearingAidDevice()).thenReturn(true); mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, BluetoothProfile.STATE_CONNECTED, BluetoothProfile.HEARING_AID); verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice); } @Test public void onProfileConnectionStateChanged_deviceDisconnected_removePreference() { mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, Loading Loading
src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdater.java +5 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,11 @@ public class AvailableMediaBluetoothDeviceUpdater extends BluetoothDeviceUpdater if (DBG) { Log.d(TAG, "isFilterMatched() current audio profile : " + currentAudioProfile); } // If device is Hearing Aid, it is compatible with HFP and A2DP. // It would show in Available Devices group. if (cachedDevice.isConnectedHearingAidDevice()) { return true; } // According to the current audio profile type, // this page will show the bluetooth device that have corresponding profile. // For example: Loading
src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdater.java +5 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,11 @@ public class ConnectedBluetoothDeviceUpdater extends BluetoothDeviceUpdater { if (DBG) { Log.d(TAG, "isFilterMatched() current audio profile : " + currentAudioProfile); } // If device is Hearing Aid, it is compatible with HFP and A2DP. // It would not show in Connected Devices group. if (cachedDevice.isConnectedHearingAidDevice()) { return false; } // According to the current audio profile type, // this page will show the bluetooth device that doesn't have corresponding profile. // For example: Loading
tests/robotests/src/com/android/settings/bluetooth/AvailableMediaBluetoothDeviceUpdaterTest.java +27 −0 Original line number Diff line number Diff line Loading @@ -203,6 +203,33 @@ public class AvailableMediaBluetoothDeviceUpdaterTest { verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice); } @Test public void onProfileConnectionStateChanged_hearingAidDeviceConnected_notInCall_addPreference() { mShadowAudioManager.setMode(AudioManager.MODE_NORMAL); when(mBluetoothDeviceUpdater. isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); when(mCachedBluetoothDevice.isConnectedHearingAidDevice()).thenReturn(true); mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, BluetoothProfile.STATE_CONNECTED, BluetoothProfile.HEARING_AID); verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice); } @Test public void onProfileConnectionStateChanged_hearingAidDeviceConnected_inCall_addPreference() { mShadowAudioManager.setMode(AudioManager.MODE_IN_CALL); when(mBluetoothDeviceUpdater. isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); when(mCachedBluetoothDevice.isConnectedHearingAidDevice()).thenReturn(true); mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, BluetoothProfile.STATE_CONNECTED, BluetoothProfile.HEARING_AID); verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice); } @Test public void onProfileConnectionStateChanged_deviceDisconnected_removePreference() { mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, Loading
tests/robotests/src/com/android/settings/bluetooth/ConnectedBluetoothDeviceUpdaterTest.java +28 −0 Original line number Diff line number Diff line Loading @@ -204,6 +204,34 @@ public class ConnectedBluetoothDeviceUpdaterTest { verify(mBluetoothDeviceUpdater).addPreference(mCachedBluetoothDevice); } @Test public void onProfileConnectionStateChanged_hearingAidDeviceConnected_inCall_removePreference() { mShadowAudioManager.setMode(AudioManager.MODE_IN_CALL); when(mBluetoothDeviceUpdater. isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); when(mCachedBluetoothDevice.isConnectedHearingAidDevice()).thenReturn(true); mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, BluetoothProfile.STATE_CONNECTED, BluetoothProfile.HEARING_AID); verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice); } @Test public void onProfileConnectionStateChanged_hearingAidDeviceConnected_notInCall_removePreference () { mShadowAudioManager.setMode(AudioManager.MODE_NORMAL); when(mBluetoothDeviceUpdater. isDeviceConnected(any(CachedBluetoothDevice.class))).thenReturn(true); when(mCachedBluetoothDevice.isConnectedHearingAidDevice()).thenReturn(true); mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, BluetoothProfile.STATE_CONNECTED, BluetoothProfile.HEARING_AID); verify(mBluetoothDeviceUpdater).removePreference(mCachedBluetoothDevice); } @Test public void onProfileConnectionStateChanged_deviceDisconnected_removePreference() { mBluetoothDeviceUpdater.onProfileConnectionStateChanged(mCachedBluetoothDevice, Loading