Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 40e0d528 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 8474975 from 302ea898 to tm-qpr1-release

Change-Id: Ib34fea629277f54f1e2218bd8b73f1c64bb680f0
parents 7457d27d 302ea898
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ class AdapterProperties {

    private static final String MAX_CONNECTED_AUDIO_DEVICES_PROPERTY =
            "persist.bluetooth.maxconnectedaudiodevices";
    static final int MAX_CONNECTED_AUDIO_DEVICES_LOWER_BOND = 1;
    private static final int MAX_CONNECTED_AUDIO_DEVICES_LOWER_BOUND = 1;
    private static final int MAX_CONNECTED_AUDIO_DEVICES_UPPER_BOUND = 5;
    private static final String A2DP_OFFLOAD_SUPPORTED_PROPERTY =
            "ro.bluetooth.a2dp_offload.supported";
@@ -216,7 +216,7 @@ class AdapterProperties {
                        configDefaultMaxConnectedAudioDevices);
        // Make sure the final value of max connected audio devices is within allowed range
        mMaxConnectedAudioDevices = Math.min(Math.max(propertyOverlayedMaxConnectedAudioDevices,
                MAX_CONNECTED_AUDIO_DEVICES_LOWER_BOND), MAX_CONNECTED_AUDIO_DEVICES_UPPER_BOUND);
                MAX_CONNECTED_AUDIO_DEVICES_LOWER_BOUND), MAX_CONNECTED_AUDIO_DEVICES_UPPER_BOUND);
        Log.i(TAG, "init(), maxConnectedAudioDevices, default="
                + configDefaultMaxConnectedAudioDevices + ", propertyOverlayed="
                + propertyOverlayedMaxConnectedAudioDevices + ", finalValue="
+13 −0
Original line number Diff line number Diff line
@@ -498,6 +498,19 @@ public class CsipSetCoordinatorService extends ProfileService {
            return null;
        }

        synchronized (mGroupIdToUuidMap) {
            if (!mGroupIdToUuidMap.containsKey(groupId)) {
                try {
                    callback.onGroupLockSet(groupId,
                            BluetoothStatusCodes.ERROR_CSIP_INVALID_GROUP_ID,
                            false);
                } catch (RemoteException e) {
                    throw e.rethrowFromSystemServer();
                }
                return null;
            }
        }

        UUID uuid = UUID.randomUUID();
        synchronized (mLocks) {
            if (mLocks.containsKey(groupId)) {
+34 −14
Original line number Diff line number Diff line
@@ -252,35 +252,45 @@ public class CsipSetCoordinatorServiceTest {
     */
    @Test
    public void testGroupLockSetNative() {
        int group = 0x02;
        int group_id = 0x01;
        int group_size = 0x01;
        long uuidLsb = 0x01;
        long uuidMsb = 0x01;
        UUID uuid = new UUID(uuidMsb, uuidLsb);

        doCallRealMethod()
                .when(mCsipSetCoordinatorNativeInterface)
                .onDeviceAvailable(any(byte[].class), anyInt(), anyInt(), anyLong(), anyLong());
        mCsipSetCoordinatorNativeInterface.onDeviceAvailable(
                getByteAddress(mTestDevice), group_id, group_size, uuidLsb, uuidMsb);

        UUID lock_uuid = mService.lockGroup(group, mCsipSetCoordinatorLockCallback);
        UUID lock_uuid = mService.lockGroup(group_id, mCsipSetCoordinatorLockCallback);
        Assert.assertNotNull(lock_uuid);
        verify(mCsipSetCoordinatorNativeInterface, times(1)).groupLockSet(eq(group), eq(true));
        verify(mCsipSetCoordinatorNativeInterface, times(1)).groupLockSet(eq(group_id), eq(true));

        doCallRealMethod()
                .when(mCsipSetCoordinatorNativeInterface)
                .onGroupLockChanged(anyInt(), anyBoolean(), anyInt());
        mCsipSetCoordinatorNativeInterface.onGroupLockChanged(
                group, true, IBluetoothCsipSetCoordinator.CSIS_GROUP_LOCK_SUCCESS);
                group_id, true, IBluetoothCsipSetCoordinator.CSIS_GROUP_LOCK_SUCCESS);

        try {
            verify(mCsipSetCoordinatorLockCallback, times(1))
                    .onGroupLockSet(group, BluetoothStatusCodes.SUCCESS,
                    .onGroupLockSet(group_id, BluetoothStatusCodes.SUCCESS,
                        true);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }

        mService.unlockGroup(lock_uuid);
        verify(mCsipSetCoordinatorNativeInterface, times(1)).groupLockSet(eq(group), eq(false));
        verify(mCsipSetCoordinatorNativeInterface, times(1)).groupLockSet(eq(group_id), eq(false));

        mCsipSetCoordinatorNativeInterface.onGroupLockChanged(
                group, false, IBluetoothCsipSetCoordinator.CSIS_GROUP_LOCK_SUCCESS);
                group_id, false, IBluetoothCsipSetCoordinator.CSIS_GROUP_LOCK_SUCCESS);

        try {
            verify(mCsipSetCoordinatorLockCallback, times(1))
                    .onGroupLockSet(group, BluetoothStatusCodes.SUCCESS,
                    .onGroupLockSet(group_id, BluetoothStatusCodes.SUCCESS,
                        false);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
@@ -293,14 +303,24 @@ public class CsipSetCoordinatorServiceTest {
     */
    @Test
    public void testGroupExclusiveLockSet() {
        int group = 0x02;
        int group_id = 0x01;
        int group_size = 0x01;
        long uuidLsb = 0x01;
        long uuidMsb = 0x01;
        UUID uuid = new UUID(uuidMsb, uuidLsb);

        doCallRealMethod()
                .when(mCsipSetCoordinatorNativeInterface)
                .onDeviceAvailable(any(byte[].class), anyInt(), anyInt(), anyLong(), anyLong());
        mCsipSetCoordinatorNativeInterface.onDeviceAvailable(
                getByteAddress(mTestDevice), group_id, group_size, uuidLsb, uuidMsb);

        UUID lock_uuid = mService.lockGroup(group, mCsipSetCoordinatorLockCallback);
        verify(mCsipSetCoordinatorNativeInterface, times(1)).groupLockSet(eq(group), eq(true));
        UUID lock_uuid = mService.lockGroup(group_id, mCsipSetCoordinatorLockCallback);
        verify(mCsipSetCoordinatorNativeInterface, times(1)).groupLockSet(eq(group_id), eq(true));
        Assert.assertNotNull(lock_uuid);

        lock_uuid = mService.lockGroup(group, mCsipSetCoordinatorLockCallback);
        verify(mCsipSetCoordinatorNativeInterface, times(1)).groupLockSet(eq(group), eq(true));
        lock_uuid = mService.lockGroup(group_id, mCsipSetCoordinatorLockCallback);
        verify(mCsipSetCoordinatorNativeInterface, times(1)).groupLockSet(eq(group_id), eq(true));

        doCallRealMethod()
                .when(mCsipSetCoordinatorNativeInterface)
@@ -308,7 +328,7 @@ public class CsipSetCoordinatorServiceTest {

        try {
            verify(mCsipSetCoordinatorLockCallback, times(1))
                    .onGroupLockSet(group,
                    .onGroupLockSet(group_id,
                    BluetoothStatusCodes.ERROR_CSIP_GROUP_LOCKED_BY_OTHER, true);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
+18 −0
Original line number Diff line number Diff line
@@ -44,6 +44,11 @@ public class ScanRecordTest extends TestCase {
    private static final String RECORD_TLM = "0201060303AAFE1116AAFE20000BF017000008874803FB93540916802069080EFE13551109426C7565436861726D5F313639363835000000000000000000";
    private static final String RECORD_IBEACON = "0201061AFF4C000215426C7565436861726D426561636F6E730EFE1355C509168020691E0EFE13551109426C7565436861726D5F31363936383500000000";

    /**
     * Example Eddystone E2EE-EID beacon from design doc
     */
    private static final String RECORD_E2EE_EID = "0201061816AAFE400000000000000000000000000000000000000000";

    @SmallTest
    public void testMatchesAnyField_Eddystone_Parser() {
        final List<String> found = new ArrayList<>();
@@ -68,6 +73,18 @@ public class ScanRecordTest extends TestCase {
        assertMatchesAnyField(RECORD_URL, matcher);
        assertMatchesAnyField(RECORD_UUID, matcher);
        assertMatchesAnyField(RECORD_TLM, matcher);
        assertMatchesAnyField(RECORD_E2EE_EID, matcher);
        assertNotMatchesAnyField(RECORD_IBEACON, matcher);
    }

    @SmallTest
    public void testMatchesAnyField_Eddystone_ExceptE2eeEid() {
        final BytesMatcher matcher = BytesMatcher
                .decode("⊈0016AAFE40/00FFFFFFFF,⊆0016AAFE/00FFFFFF");
        assertMatchesAnyField(RECORD_URL, matcher);
        assertMatchesAnyField(RECORD_UUID, matcher);
        assertMatchesAnyField(RECORD_TLM, matcher);
        assertNotMatchesAnyField(RECORD_E2EE_EID, matcher);
        assertNotMatchesAnyField(RECORD_IBEACON, matcher);
    }

@@ -94,6 +111,7 @@ public class ScanRecordTest extends TestCase {
        assertNotMatchesAnyField(RECORD_URL, matcher);
        assertNotMatchesAnyField(RECORD_UUID, matcher);
        assertNotMatchesAnyField(RECORD_TLM, matcher);
        assertNotMatchesAnyField(RECORD_E2EE_EID, matcher);
        assertMatchesAnyField(RECORD_IBEACON, matcher);
    }

+8 −6
Original line number Diff line number Diff line
@@ -234,11 +234,12 @@ class PyHal(Closable):
                hci_packets.AddressType.RANDOM_DEVICE_ADDRESS, remote_addr, 1, [phy_scan_params]))
        self.wait_for_status(OpCode.LE_EXTENDED_CREATE_CONNECTION)

    def add_to_connect_list(self, remote_addr):
    def add_to_filter_accept_list(self, remote_addr):
        self.send_hci_command(
            hci_packets.LeAddDeviceToConnectListBuilder(hci_packets.ConnectListAddressType.RANDOM, remote_addr))
            hci_packets.LeAddDeviceToFilterAcceptListBuilder(hci_packets.FilterAcceptListAddressType.RANDOM,
                                                             remote_addr))

    def initiate_le_connection_by_connect_list(self, remote_addr):
    def initiate_le_connection_by_filter_accept_list(self, remote_addr):
        phy_scan_params = hci_packets.LeCreateConnPhyScanParameters()
        phy_scan_params.scan_interval = 0x60
        phy_scan_params.scan_window = 0x30
@@ -249,9 +250,10 @@ class PyHal(Closable):
        phy_scan_params.min_ce_length = 0
        phy_scan_params.max_ce_length = 0
        self.send_hci_command(
            hci_packets.LeExtendedCreateConnectionBuilder(
                hci_packets.InitiatorFilterPolicy.USE_CONNECT_LIST, hci_packets.OwnAddressType.RANDOM_DEVICE_ADDRESS,
                hci_packets.AddressType.RANDOM_DEVICE_ADDRESS, remote_addr, 1, [phy_scan_params]))
            hci_packets.LeExtendedCreateConnectionBuilder(hci_packets.InitiatorFilterPolicy.USE_FILTER_ACCEPT_LIST,
                                                          hci_packets.OwnAddressType.RANDOM_DEVICE_ADDRESS,
                                                          hci_packets.AddressType.RANDOM_DEVICE_ADDRESS, remote_addr, 1,
                                                          [phy_scan_params]))

    def complete_le_connection(self):
        connection_complete = HciCaptures.LeConnectionCompleteCapture()
Loading