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

Commit 91d7b18c authored by jasonwshsu's avatar jasonwshsu Committed by Jason Hsu
Browse files

Change to formal call for getDeviceSide() and getDeviceMode()

Bug: 264478242
Test: atest HearingAidProfileTest
Change-Id: I17a8850e7fe81ed67b7dfa443c1ddc8737da2303
parent 7a64585e
Loading
Loading
Loading
Loading
+2 −23
Original line number Diff line number Diff line
@@ -37,8 +37,6 @@ import com.android.settingslib.Utils;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

@@ -287,16 +285,7 @@ public class HearingAidProfile implements LocalBluetoothProfile {
            return defaultValue;
        }

        try {
            Method method = mService.getClass().getDeclaredMethod("getDeviceSideInternal",
                    BluetoothDevice.class);
            method.setAccessible(true);
            return (int) method.invoke(mService, device);
        } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
            Log.e(TAG, "fail to get getDeviceSideInternal\n" + e.toString() + "\n"
                    + Log.getStackTraceString(new Throwable()));
            return defaultValue;
        }
        return mService.getDeviceSide(device);
    }

    /**
@@ -313,17 +302,7 @@ public class HearingAidProfile implements LocalBluetoothProfile {
            return defaultValue;
        }

        try {
            Method method = mService.getClass().getDeclaredMethod("getDeviceModeInternal",
                    BluetoothDevice.class);
            method.setAccessible(true);
            return (int) method.invoke(mService, device);
        } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
            Log.e(TAG, "fail to get getDeviceModeInternal\n" + e.toString() + "\n"
                    + Log.getStackTraceString(new Throwable()));

            return defaultValue;
        }
        return mService.getDeviceMode(device);
    }

    public String toString() {