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

Commit eaf4b5bc authored by Angela Wang's avatar Angela Wang Committed by Android (Google) Code Review
Browse files

Merge "Fix ASHA devices in the same pair name not sync issue" into main

parents bb8198e8 0f756c61
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -649,6 +649,9 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
        for (CachedBluetoothDevice cbd : mMemberDevices) {
            cbd.setName(name);
        }
        if (mSubDevice != null) {
            mSubDevice.setName(name);
        }
    }

    /**
+1 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ public class HearingAidDeviceManager {
            // device.
            if (hearingAidDevice != null) {
                hearingAidDevice.setSubDevice(newDevice);
                newDevice.setName(hearingAidDevice.getName());
                return true;
            }
        }
+24 −0
Original line number Diff line number Diff line
@@ -1702,6 +1702,30 @@ public class CachedBluetoothDeviceTest {
        verify(mDevice, never()).setAlias(any());
    }

    @Test
    public void setName_memberDeviceNameIsSet() {
        when(mDevice.getAlias()).thenReturn(DEVICE_NAME);
        when(mSubDevice.getAlias()).thenReturn(DEVICE_NAME);

        mCachedDevice.addMemberDevice(mSubCachedDevice);
        mCachedDevice.setName(DEVICE_ALIAS);

        verify(mDevice).setAlias(DEVICE_ALIAS);
        verify(mSubDevice).setAlias(DEVICE_ALIAS);
    }

    @Test
    public void setName_subDeviceNameIsSet() {
        when(mDevice.getAlias()).thenReturn(DEVICE_NAME);
        when(mSubDevice.getAlias()).thenReturn(DEVICE_NAME);

        mCachedDevice.setSubDevice(mSubCachedDevice);
        mCachedDevice.setName(DEVICE_ALIAS);

        verify(mDevice).setAlias(DEVICE_ALIAS);
        verify(mSubDevice).setAlias(DEVICE_ALIAS);
    }

    @Test
    public void getProfileConnectionState_nullProfile_returnDisconnected() {
        assertThat(mCachedDevice.getProfileConnectionState(null)).isEqualTo(
+1 −0
Original line number Diff line number Diff line
@@ -299,6 +299,7 @@ public class HearingAidDeviceManagerTest {
        mHearingAidDeviceManager.setSubDeviceIfNeeded(mCachedDevice2);

        assertThat(mCachedDevice1.getSubDevice()).isEqualTo(mCachedDevice2);
        verify(mDevice2).setAlias(DEVICE_ALIAS_1);
    }

    /**