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

Commit 237a6e19 authored by jasonwshsu's avatar jasonwshsu
Browse files

Deprecate isHearingAidDevice to use isHearingDevice

* Don't need to use HearingAidInfo by isHearingAidDevice(), we can use isHearingDevice() to check uuid in BluetoothDevice for profile supported status directly.

Bug: 386121967
Test: atest BluetoothUtilsTest HearingAidAudioRoutingHelperTest HearingDevicesCheckerTest AudioOutputInteractorTest
Flag: EXEMPT refactor
Change-Id: Ib7250cd8f33f99eb67f205c433ddb29094e1d188
parent f80c6c37
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -177,7 +177,7 @@ public class BluetoothUtils {
            }
        }

        if (cachedDevice.isHearingAidDevice()) {
        if (cachedDevice.isHearingDevice()) {
            return new Pair<>(
                    getBluetoothDrawable(
                            context, com.android.internal.R.drawable.ic_bt_hearing_aid),
@@ -193,7 +193,8 @@ public class BluetoothUtils {
                // profiles
                if (profile instanceof HearingAidProfile || profile instanceof HapClientProfile) {
                    return new Pair<>(
                            getBluetoothDrawable(context, profileResId),
                            getBluetoothDrawable(context,
                                    com.android.internal.R.drawable.ic_bt_hearing_aid),
                            context.getString(R.string.bluetooth_talkback_hearing_aids));
                }
                if (resId == 0) {
+1 −1
Original line number Diff line number Diff line
@@ -1246,7 +1246,7 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
        builder.append(", name=").append(getName());
        builder.append(", groupId=").append(mGroupId);
        builder.append(", member=").append(mMemberDevices);
        if (isHearingAidDevice()) {
        if (isHearingDevice()) {
            builder.append(", hearingAidInfo=").append(mHearingAidInfo);
            builder.append(", subDevice=").append(mSubDevice);
        }
+2 −2
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ public class HearingAidAudioRoutingHelper {
    @Nullable
    public AudioDeviceAttributes getMatchedHearingDeviceAttributesForOutput(
            @Nullable CachedBluetoothDevice device) {
        if (device == null || !device.isHearingAidDevice()) {
        if (device == null || !device.isHearingDevice()) {
            return null;
        }

@@ -201,7 +201,7 @@ public class HearingAidAudioRoutingHelper {
    @Nullable
    private AudioDeviceAttributes getMatchedHearingDeviceAttributesInput(
            @Nullable CachedBluetoothDevice device) {
        if (device == null || !device.isHearingAidDevice()) {
        if (device == null || !device.isHearingDevice()) {
            return null;
        }

+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ public class BluetoothMediaDevice extends MediaDevice {

    @Override
    public String getId() {
        if (mCachedDevice.isHearingAidDevice()) {
        if (mCachedDevice.isHearingDevice()) {
            if (mCachedDevice.getHiSyncId() != BluetoothHearingAid.HI_SYNC_ID_INVALID) {
                return Long.toString(mCachedDevice.getHiSyncId());
            }
+1 −1
Original line number Diff line number Diff line
@@ -215,7 +215,7 @@ public class BluetoothUtilsTest {

    @Test
    public void getBtClassDrawableWithDescription_typeHearingAid_returnHearingAidDrawable() {
        when(mCachedBluetoothDevice.isHearingAidDevice()).thenReturn(true);
        when(mCachedBluetoothDevice.isHearingDevice()).thenReturn(true);
        BluetoothUtils.getBtClassDrawableWithDescription(mContext, mCachedBluetoothDevice);

        verify(mContext).getDrawable(com.android.internal.R.drawable.ic_bt_hearing_aid);
Loading