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

Commit b9f04eb7 authored by Kihong Seong's avatar Kihong Seong
Browse files

Handle null identity address in BluetoothSocketManagerBinder

Change functions to use a Util method to accommodate the behavior
correction where identity address can be null

Bug: 317120534
Bug: 295907764
Test: m com.android.btservices
Change-Id: I45dc043048267a39550f5f7a749e450a3837df36
parent 8cf69e75
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@ import android.os.ParcelFileDescriptor;
import android.os.ParcelUuid;
import android.os.ParcelUuid;


import com.android.bluetooth.Utils;
import com.android.bluetooth.Utils;
import com.android.bluetooth.flags.Flags;


class BluetoothSocketManagerBinder extends IBluetoothSocketManager.Stub {
class BluetoothSocketManagerBinder extends IBluetoothSocketManager.Stub {
    private static final String TAG = "BluetoothSocketManagerBinder";
    private static final String TAG = "BluetoothSocketManagerBinder";
@@ -51,13 +52,18 @@ class BluetoothSocketManagerBinder extends IBluetoothSocketManager.Stub {
            return null;
            return null;
        }
        }


        String brEdrAddress =
                Flags.identityAddressNullIfUnknown()
                        ? Utils.getBrEdrAddress(device)
                        : mService.getIdentityAddress(device.getAddress());

        return marshalFd(
        return marshalFd(
                mService.getNative()
                mService.getNative()
                        .connectSocket(
                        .connectSocket(
                                Utils.getBytesFromAddress(
                                Utils.getBytesFromAddress(
                                        type == BluetoothSocket.TYPE_L2CAP_LE
                                        type == BluetoothSocket.TYPE_L2CAP_LE
                                                ? device.getAddress()
                                                ? device.getAddress()
                                                : mService.getIdentityAddress(device.getAddress())),
                                                : brEdrAddress),
                                type,
                                type,
                                Utils.uuidToByteArray(uuid),
                                Utils.uuidToByteArray(uuid),
                                port,
                                port,