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

Commit c5e51afc authored by William Escande's avatar William Escande
Browse files

Prefer local getIdentityAddress call vs Framework

By Staying within the bondaries of the app we avoid the binder call, the
permission checks and all related issues

Bug: 331948250
Test: m com.android.btservices
Flag: Exempt, no-op change
Change-Id: Ic8071cf66439bb5bc720bdf081d81c4591c23a56
parent 6d4a18be
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -236,11 +236,10 @@ public final class Utils {
     * @return either identity address or device address in String format
     */
    public static String getBrEdrAddress(BluetoothDevice device) {
        String address = device.getIdentityAddress();
        if (address == null) {
            address = device.getAddress();
        }
        return address;
        final AdapterService service = AdapterService.getAdapterService();
        final String address = device.getAddress();
        String identity = service != null ? service.getIdentityAddress(address) : null;
        return identity != null ? identity : address;
    }

    /**
+4 −4
Original line number Diff line number Diff line
@@ -4819,17 +4819,17 @@ public class AdapterService extends Service {
    }

    int getConnectionState(BluetoothDevice device) {
        final String address = device.getAddress();
        if (Flags.apiGetConnectionStateUsingIdentityAddress()) {
            int connectionState =
                    mNativeInterface.getConnectionState(getBytesFromAddress(device.getAddress()));
            final String identityAddress = device.getIdentityAddress();
            int connectionState = mNativeInterface.getConnectionState(getBytesFromAddress(address));
            final String identityAddress = getIdentityAddress(address);
            if (identityAddress != null) {
                connectionState |=
                        mNativeInterface.getConnectionState(getBytesFromAddress(identityAddress));
            }
            return connectionState;
        }
        return mNativeInterface.getConnectionState(getBytesFromAddress(device.getAddress()));
        return mNativeInterface.getConnectionState(getBytesFromAddress(address));
    }

    int getConnectionHandle(BluetoothDevice device, int transport) {