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

Commit 5176db8a authored by Angela Wang's avatar Angela Wang Committed by Automerger Merge Worker
Browse files

Merge "Make Hearing devices preference always visible" into udc-qpr-dev am: 7df08d69

parents 4a1651b7 7df08d69
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -56,7 +56,8 @@ public class HearingAidHelper {
     * @return a list of hearing aids {@link BluetoothDevice} objects
     */
    public List<BluetoothDevice> getConnectedHearingAidDeviceList() {
        if (!isHearingAidSupported()) {
        if (mBluetoothAdapter == null || !mBluetoothAdapter.isEnabled()
                || !isHearingAidSupported()) {
            return new ArrayList<>();
        }
        final List<BluetoothDevice> deviceList = new ArrayList<>();
@@ -88,9 +89,6 @@ public class HearingAidHelper {
     * supported.
     */
    public boolean isHearingAidSupported() {
        if (mBluetoothAdapter == null || !mBluetoothAdapter.isEnabled()) {
            return false;
        }
        final List<Integer> supportedList = mBluetoothAdapter.getSupportedProfiles();
        return supportedList.contains(BluetoothProfile.HEARING_AID)
                || supportedList.contains(BluetoothProfile.HAP_CLIENT);
+10 −6
Original line number Diff line number Diff line
@@ -95,8 +95,7 @@ public class HearingAidHelperTest {
    }

    @Test
    public void isHearingAidSupported_supported_returnTrue() {
        mBluetoothAdapter.enable();
    public void isHearingAidSupported_ashaSupported_returnTrue() {
        mShadowBluetoothAdapter.clearSupportedProfiles();
        mShadowBluetoothAdapter.addSupportedProfiles(BluetoothProfile.HEARING_AID);

@@ -104,14 +103,19 @@ public class HearingAidHelperTest {
    }

    @Test
    public void isHearingAidSupported_bluetoothOff_returnFalse() {
    public void isHearingAidSupported_hapSupported_returnTrue() {
        mShadowBluetoothAdapter.clearSupportedProfiles();
        mShadowBluetoothAdapter.addSupportedProfiles(BluetoothProfile.HEARING_AID);
        mBluetoothAdapter.disable();
        mShadowBluetoothAdapter.addSupportedProfiles(BluetoothProfile.HAP_CLIENT);

        assertThat(mHelper.isHearingAidSupported()).isFalse();
        assertThat(mHelper.isHearingAidSupported()).isTrue();
    }

    @Test
    public void isHearingAidSupported_unsupported_returnFalse() {
        mShadowBluetoothAdapter.clearSupportedProfiles();

        assertThat(mHelper.isHearingAidSupported()).isFalse();
    }

    @Test
    public void isAllHearingAidRelatedProfilesReady_allReady_returnTrue() {