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

Commit c6d52967 authored by Jakub Tyszkowski's avatar Jakub Tyszkowski
Browse files

Csip: Add method for checking group lock status

Bug: 150670922
Bug: 230559809
Tag: #feature
Sponsor: jpawlowski@
Test: atest BluetoothInstrumentationTests
Change-Id: I64de4bb5bf0fe423aa477f419b0be27205616e7c
parent d79e82df
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -553,6 +553,17 @@ public class CsipSetCoordinatorService extends ProfileService {
        }
    }

    /**
     * Check whether a given group is currently locked.
     * @param groupId unique group identifier
     * @return true if group is currently locked, otherwise false.
     *
     * @hide
     */
    public boolean isGroupLocked(int groupId) {
        return mLocks.containsKey(groupId);
    }

    /**
     * Get collection of group IDs for a given UUID
     * @param uuid
+5 −0
Original line number Diff line number Diff line
@@ -259,10 +259,12 @@ public class CsipSetCoordinatorServiceTest {
                        anyLong());
        mCsipSetCoordinatorNativeInterface.onDeviceAvailable(
                getByteAddress(mTestDevice), group_id, group_size, 1, uuidLsb, uuidMsb);
        Assert.assertFalse(mService.isGroupLocked(group_id));

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

        doCallRealMethod()
                .when(mCsipSetCoordinatorNativeInterface)
@@ -283,6 +285,7 @@ public class CsipSetCoordinatorServiceTest {

        mCsipSetCoordinatorNativeInterface.onGroupLockChanged(
                group_id, false, IBluetoothCsipSetCoordinator.CSIS_GROUP_LOCK_SUCCESS);
        Assert.assertFalse(mService.isGroupLocked(group_id));

        try {
            verify(mCsipSetCoordinatorLockCallback, times(1))
@@ -311,10 +314,12 @@ public class CsipSetCoordinatorServiceTest {
                        anyLong());
        mCsipSetCoordinatorNativeInterface.onDeviceAvailable(
                getByteAddress(mTestDevice), group_id, group_size, 1, uuidLsb, uuidMsb);
        Assert.assertFalse(mService.isGroupLocked(group_id));

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

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