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

Commit 7549c225 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Do not expose the cordinated set status as LE audio disabled"

parents 9df170b5 4d20586d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -639,6 +639,12 @@ final class RemoteDevices {
         * @param isCoordinatedSetMember the mIsCoordinatedSetMember to set
        */
        void setIsCoordinatedSetMember(boolean isCoordinatedSetMember) {
            if ((mAdapterService.getSupportedProfilesBitMask()
                            & (1 << BluetoothProfile.CSIP_SET_COORDINATOR))
                    == 0) {
                debugLog("CSIP is not supported");
                return;
            }
            synchronized (mObject) {
                this.mIsCoordinatedSetMember = isCoordinatedSetMember;
            }
+32 −0
Original line number Diff line number Diff line
@@ -635,6 +635,38 @@ public class RemoteDevicesTest {
                .getHfAudioPolicyForRemoteAg());
    }

    @Test
    public void testIsCoordinatedSetMemberAsLeAudioEnabled() {
        doReturn((long) (1 << BluetoothProfile.CSIP_SET_COORDINATOR))
                .when(mAdapterService)
                .getSupportedProfilesBitMask();

        // Verify that device property is null initially
        Assert.assertNull(mRemoteDevices.getDeviceProperties(mDevice1));
        mRemoteDevices.addDeviceProperties(Utils.getBytesFromAddress(TEST_BT_ADDR_1));

        DeviceProperties deviceProp = mRemoteDevices.getDeviceProperties(mDevice1);
        deviceProp.setIsCoordinatedSetMember(true);

        Assert.assertTrue(deviceProp.isCoordinatedSetMember());
    }

    @Test
    public void testIsCoordinatedSetMemberAsLeAudioDisabled() {
        doReturn((long) (0 << BluetoothProfile.CSIP_SET_COORDINATOR))
                .when(mAdapterService)
                .getSupportedProfilesBitMask();

        // Verify that device property is null initially
        Assert.assertNull(mRemoteDevices.getDeviceProperties(mDevice1));
        mRemoteDevices.addDeviceProperties(Utils.getBytesFromAddress(TEST_BT_ADDR_1));

        DeviceProperties deviceProp = mRemoteDevices.getDeviceProperties(mDevice1);
        deviceProp.setIsCoordinatedSetMember(true);

        Assert.assertFalse(deviceProp.isCoordinatedSetMember());
    }

    private static void verifyBatteryLevelChangedIntent(BluetoothDevice device, int batteryLevel,
            ArgumentCaptor<Intent> intentArgument) {
        verifyBatteryLevelChangedIntent(device, batteryLevel, intentArgument.getValue());