Loading android/app/src/com/android/bluetooth/bass_client/BassClientService.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.bluetooth.bass_client; package com.android.bluetooth.bass_client; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static com.android.bluetooth.Utils.enforceBluetoothPrivilegedPermission; import static com.android.bluetooth.Utils.enforceBluetoothPrivilegedPermission; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter; Loading Loading @@ -49,7 +50,6 @@ import com.android.bluetooth.btservice.AdapterService; import com.android.bluetooth.btservice.ProfileService; import com.android.bluetooth.btservice.ProfileService; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.ArrayList; import java.util.Collections; import java.util.Collections; import java.util.HashMap; import java.util.HashMap; Loading Loading @@ -394,8 +394,8 @@ public class BassClientService extends ProfileService { Log.e(TAG, "connect: device is null"); Log.e(TAG, "connect: device is null"); return false; return false; } } if (getConnectionPolicy(device) == BluetoothProfile.CONNECTION_POLICY_UNKNOWN) { if (getConnectionPolicy(device) == BluetoothProfile.CONNECTION_POLICY_FORBIDDEN) { Log.e(TAG, "connect: unknown connection policy"); Log.e(TAG, "connect: connection policy set to forbidden"); return false; return false; } } synchronized (mStateMachines) { synchronized (mStateMachines) { Loading android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceTest.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -181,14 +181,14 @@ public class BassClientServiceTest { } } /** /** * Test connecting to a device when the connection policy is unknown. * Test connecting to a device when the connection policy is forbidden. * - service.connect() should return false. * - service.connect() should return false. */ */ @Test @Test public void testConnect_whenConnectionPolicyIsUnknown() { public void testConnect_whenConnectionPolicyIsForbidden() { when(mDatabaseManager.getProfileConnectionPolicy(any(BluetoothDevice.class), when(mDatabaseManager.getProfileConnectionPolicy(any(BluetoothDevice.class), eq(BluetoothProfile.LE_AUDIO_BROADCAST_ASSISTANT))) eq(BluetoothProfile.LE_AUDIO_BROADCAST_ASSISTANT))) .thenReturn(BluetoothProfile.CONNECTION_POLICY_UNKNOWN); .thenReturn(BluetoothProfile.CONNECTION_POLICY_FORBIDDEN); mCurrentDevice = TestUtils.getTestDevice(mBluetoothAdapter, 0); mCurrentDevice = TestUtils.getTestDevice(mBluetoothAdapter, 0); assertThat(mCurrentDevice).isNotNull(); assertThat(mCurrentDevice).isNotNull(); Loading Loading
android/app/src/com/android/bluetooth/bass_client/BassClientService.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.bluetooth.bass_client; package com.android.bluetooth.bass_client; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static android.Manifest.permission.BLUETOOTH_CONNECT; import static com.android.bluetooth.Utils.enforceBluetoothPrivilegedPermission; import static com.android.bluetooth.Utils.enforceBluetoothPrivilegedPermission; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothAdapter; Loading Loading @@ -49,7 +50,6 @@ import com.android.bluetooth.btservice.AdapterService; import com.android.bluetooth.btservice.ProfileService; import com.android.bluetooth.btservice.ProfileService; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.ArrayList; import java.util.Collections; import java.util.Collections; import java.util.HashMap; import java.util.HashMap; Loading Loading @@ -394,8 +394,8 @@ public class BassClientService extends ProfileService { Log.e(TAG, "connect: device is null"); Log.e(TAG, "connect: device is null"); return false; return false; } } if (getConnectionPolicy(device) == BluetoothProfile.CONNECTION_POLICY_UNKNOWN) { if (getConnectionPolicy(device) == BluetoothProfile.CONNECTION_POLICY_FORBIDDEN) { Log.e(TAG, "connect: unknown connection policy"); Log.e(TAG, "connect: connection policy set to forbidden"); return false; return false; } } synchronized (mStateMachines) { synchronized (mStateMachines) { Loading
android/app/tests/unit/src/com/android/bluetooth/bass_client/BassClientServiceTest.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -181,14 +181,14 @@ public class BassClientServiceTest { } } /** /** * Test connecting to a device when the connection policy is unknown. * Test connecting to a device when the connection policy is forbidden. * - service.connect() should return false. * - service.connect() should return false. */ */ @Test @Test public void testConnect_whenConnectionPolicyIsUnknown() { public void testConnect_whenConnectionPolicyIsForbidden() { when(mDatabaseManager.getProfileConnectionPolicy(any(BluetoothDevice.class), when(mDatabaseManager.getProfileConnectionPolicy(any(BluetoothDevice.class), eq(BluetoothProfile.LE_AUDIO_BROADCAST_ASSISTANT))) eq(BluetoothProfile.LE_AUDIO_BROADCAST_ASSISTANT))) .thenReturn(BluetoothProfile.CONNECTION_POLICY_UNKNOWN); .thenReturn(BluetoothProfile.CONNECTION_POLICY_FORBIDDEN); mCurrentDevice = TestUtils.getTestDevice(mBluetoothAdapter, 0); mCurrentDevice = TestUtils.getTestDevice(mBluetoothAdapter, 0); assertThat(mCurrentDevice).isNotNull(); assertThat(mCurrentDevice).isNotNull(); Loading