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

Commit 1bf32d17 authored by Kihong Seong's avatar Kihong Seong
Browse files

Handle null identity address in BluetoothObexTransport

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: Ic22ff9fd5b74b2f5f66d69f8699e6d1c58b82c94
parent b80a1f6e
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package com.android.bluetooth;

import android.bluetooth.BluetoothSocket;

import com.android.bluetooth.flags.Flags;
import com.android.obex.ObexTransport;

import java.io.DataInputStream;
@@ -119,8 +120,12 @@ public class BluetoothObexTransport implements ObexTransport {
        if (mSocket == null) {
            return null;
        }
        String identityAddress =
                Flags.identityAddressNullIfUnknown()
                        ? Utils.getBrEdrAddress(mSocket.getRemoteDevice())
                        : mSocket.getRemoteDevice().getIdentityAddress();
        return mSocket.getConnectionType() == BluetoothSocket.TYPE_RFCOMM
                ? mSocket.getRemoteDevice().getIdentityAddress()
                ? identityAddress
                : mSocket.getRemoteDevice().getAddress();
    }