Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java +4 −2 Original line number Diff line number Diff line Loading @@ -173,8 +173,10 @@ public class A2dpProfile implements LocalBluetoothProfile { } public BluetoothDevice getActiveDevice() { if (mService == null) return null; return mService.getActiveDevice(); if (mBluetoothAdapter == null) return null; final List<BluetoothDevice> activeDevices = mBluetoothAdapter .getActiveDevices(BluetoothProfile.A2DP); return (activeDevices.size() > 0) ? activeDevices.get(0) : null; } @Override Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/HeadsetProfile.java +4 −2 Original line number Diff line number Diff line Loading @@ -132,10 +132,12 @@ public class HeadsetProfile implements LocalBluetoothProfile { } public BluetoothDevice getActiveDevice() { if (mService == null) { if (mBluetoothAdapter == null) { return null; } return mService.getActiveDevice(); final List<BluetoothDevice> activeDevices = mBluetoothAdapter .getActiveDevices(BluetoothProfile.HEADSET); return (activeDevices.size() > 0) ? activeDevices.get(0) : null; } public boolean isAudioOn() { Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidProfile.java +4 −2 Original line number Diff line number Diff line Loading @@ -168,8 +168,10 @@ public class HearingAidProfile implements LocalBluetoothProfile { } public List<BluetoothDevice> getActiveDevices() { if (mService == null) return new ArrayList<>(); return mService.getActiveDevices(); if (mBluetoothAdapter == null) { return new ArrayList<>(); } return mBluetoothAdapter.getActiveDevices(BluetoothProfile.HEARING_AID); } @Override Loading packages/SettingsLib/src/com/android/settingslib/bluetooth/LeAudioProfile.java +3 −3 Original line number Diff line number Diff line Loading @@ -21,12 +21,12 @@ import static android.bluetooth.BluetoothAdapter.ACTIVE_DEVICE_ALL; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_ALLOWED; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; import android.bluetooth.BluetoothLeAudio; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothCodecConfig; import android.bluetooth.BluetoothCodecStatus; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothLeAudio; import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothUuid; import android.content.Context; Loading Loading @@ -177,10 +177,10 @@ public class LeAudioProfile implements LocalBluetoothProfile { } public List<BluetoothDevice> getActiveDevices() { if (mService == null) { if (mBluetoothAdapter == null) { return new ArrayList<>(); } return mService.getActiveDevices(); return mBluetoothAdapter.getActiveDevices(BluetoothProfile.LE_AUDIO); } @Override Loading packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/A2dpProfileTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -60,6 +60,8 @@ public class A2dpProfileTest { private BluetoothDevice mDevice; @Mock private BluetoothA2dp mBluetoothA2dp; @Mock private BluetoothAdapter mBluetoothAdapter; private BluetoothProfile.ServiceListener mServiceListener; private A2dpProfile mProfile; Loading @@ -72,7 +74,8 @@ public class A2dpProfileTest { mProfile = new A2dpProfile(mContext, mDeviceManager, mProfileManager); mServiceListener = mShadowBluetoothAdapter.getServiceListener(); mServiceListener.onServiceConnected(BluetoothProfile.A2DP, mBluetoothA2dp); when(mBluetoothA2dp.getActiveDevice()).thenReturn(mDevice); when(mBluetoothAdapter.getActiveDevices(eq(BluetoothProfile.A2DP))) .thenReturn(Arrays.asList(mDevice)); } @Test Loading Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/A2dpProfile.java +4 −2 Original line number Diff line number Diff line Loading @@ -173,8 +173,10 @@ public class A2dpProfile implements LocalBluetoothProfile { } public BluetoothDevice getActiveDevice() { if (mService == null) return null; return mService.getActiveDevice(); if (mBluetoothAdapter == null) return null; final List<BluetoothDevice> activeDevices = mBluetoothAdapter .getActiveDevices(BluetoothProfile.A2DP); return (activeDevices.size() > 0) ? activeDevices.get(0) : null; } @Override Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/HeadsetProfile.java +4 −2 Original line number Diff line number Diff line Loading @@ -132,10 +132,12 @@ public class HeadsetProfile implements LocalBluetoothProfile { } public BluetoothDevice getActiveDevice() { if (mService == null) { if (mBluetoothAdapter == null) { return null; } return mService.getActiveDevice(); final List<BluetoothDevice> activeDevices = mBluetoothAdapter .getActiveDevices(BluetoothProfile.HEADSET); return (activeDevices.size() > 0) ? activeDevices.get(0) : null; } public boolean isAudioOn() { Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/HearingAidProfile.java +4 −2 Original line number Diff line number Diff line Loading @@ -168,8 +168,10 @@ public class HearingAidProfile implements LocalBluetoothProfile { } public List<BluetoothDevice> getActiveDevices() { if (mService == null) return new ArrayList<>(); return mService.getActiveDevices(); if (mBluetoothAdapter == null) { return new ArrayList<>(); } return mBluetoothAdapter.getActiveDevices(BluetoothProfile.HEARING_AID); } @Override Loading
packages/SettingsLib/src/com/android/settingslib/bluetooth/LeAudioProfile.java +3 −3 Original line number Diff line number Diff line Loading @@ -21,12 +21,12 @@ import static android.bluetooth.BluetoothAdapter.ACTIVE_DEVICE_ALL; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_ALLOWED; import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_FORBIDDEN; import android.bluetooth.BluetoothLeAudio; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothCodecConfig; import android.bluetooth.BluetoothCodecStatus; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothLeAudio; import android.bluetooth.BluetoothProfile; import android.bluetooth.BluetoothUuid; import android.content.Context; Loading Loading @@ -177,10 +177,10 @@ public class LeAudioProfile implements LocalBluetoothProfile { } public List<BluetoothDevice> getActiveDevices() { if (mService == null) { if (mBluetoothAdapter == null) { return new ArrayList<>(); } return mService.getActiveDevices(); return mBluetoothAdapter.getActiveDevices(BluetoothProfile.LE_AUDIO); } @Override Loading
packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/A2dpProfileTest.java +4 −1 Original line number Diff line number Diff line Loading @@ -60,6 +60,8 @@ public class A2dpProfileTest { private BluetoothDevice mDevice; @Mock private BluetoothA2dp mBluetoothA2dp; @Mock private BluetoothAdapter mBluetoothAdapter; private BluetoothProfile.ServiceListener mServiceListener; private A2dpProfile mProfile; Loading @@ -72,7 +74,8 @@ public class A2dpProfileTest { mProfile = new A2dpProfile(mContext, mDeviceManager, mProfileManager); mServiceListener = mShadowBluetoothAdapter.getServiceListener(); mServiceListener.onServiceConnected(BluetoothProfile.A2DP, mBluetoothA2dp); when(mBluetoothA2dp.getActiveDevice()).thenReturn(mDevice); when(mBluetoothAdapter.getActiveDevices(eq(BluetoothProfile.A2DP))) .thenReturn(Arrays.asList(mDevice)); } @Test Loading