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

Commit 4d20586d authored by Alice Kuo's avatar Alice Kuo
Browse files

Do not expose the cordinated set status as LE audio disabled

If the LE audio disabled, the phone would treat the remote LE audio
TWS be a single device. Update the cordinated set that should only
supported as CSIP profile enabled.

Bug: 284410495
Test: atest BluetoothInstrumentationTests
Change-Id: Ibccf52ae4d26715c2d67be308bc6b576550c0512
parent 9738f710
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());