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

Commit 8f7ad458 authored by Kihong Seong's avatar Kihong Seong Committed by Automerger Merge Worker
Browse files

Merge "Handle null identity address in BluetoothOppTransfer" into main am: 22cb6d42

parents c0bdb078 22cb6d42
Loading
Loading
Loading
Loading
+13 −4
Original line number Original line Diff line number Diff line
@@ -40,6 +40,7 @@ import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothProtoEnums;
import android.bluetooth.BluetoothProtoEnums;
import android.bluetooth.BluetoothSocket;
import android.bluetooth.BluetoothSocket;
import android.bluetooth.BluetoothUtils;
import android.bluetooth.BluetoothUuid;
import android.bluetooth.BluetoothUuid;
import android.bluetooth.SdpOppOpsRecord;
import android.bluetooth.SdpOppOpsRecord;
import android.content.BroadcastReceiver;
import android.content.BroadcastReceiver;
@@ -61,6 +62,7 @@ import com.android.bluetooth.BluetoothObexTransport;
import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.Utils;
import com.android.bluetooth.Utils;
import com.android.bluetooth.content_profiles.ContentProfileErrorReportUtils;
import com.android.bluetooth.content_profiles.ContentProfileErrorReportUtils;
import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
import com.android.obex.ObexTransport;
import com.android.obex.ObexTransport;


@@ -130,7 +132,7 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
                    Log.e(
                    Log.e(
                            TAG,
                            TAG,
                            "device : "
                            "device : "
                                    + device.getIdentityAddress()
                                    + BluetoothUtils.toAnonymizedAddress(getBrEdrAddress(device))
                                    + " mBatch :"
                                    + " mBatch :"
                                    + mBatch
                                    + mBatch
                                    + " mCurrentShare :"
                                    + " mCurrentShare :"
@@ -147,7 +149,7 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
                    Log.v(
                    Log.v(
                            TAG,
                            TAG,
                            "Device :"
                            "Device :"
                                    + device.getIdentityAddress()
                                    + BluetoothUtils.toAnonymizedAddress(getBrEdrAddress(device))
                                    + "- OPP device: "
                                    + "- OPP device: "
                                    + mBatch.mDestination
                                    + mBatch.mDestination
                                    + " \n mCurrentShare.mConfirm == "
                                    + " \n mCurrentShare.mConfirm == "
@@ -190,8 +192,8 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
                                3);
                                3);
                        return;
                        return;
                    }
                    }
                    String deviceIdentityAddress = device.getIdentityAddress();
                    String deviceIdentityAddress = getBrEdrAddress(device);
                    String transferDeviceIdentityAddress = mDevice.getIdentityAddress();
                    String transferDeviceIdentityAddress = getBrEdrAddress(mDevice);
                    if (deviceIdentityAddress == null || transferDeviceIdentityAddress == null
                    if (deviceIdentityAddress == null || transferDeviceIdentityAddress == null
                            || !deviceIdentityAddress.equalsIgnoreCase(
                            || !deviceIdentityAddress.equalsIgnoreCase(
                                    transferDeviceIdentityAddress)) {
                                    transferDeviceIdentityAddress)) {
@@ -1015,4 +1017,11 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
            }
            }
        }
        }
    }
    }

    private String getBrEdrAddress(BluetoothDevice device) {
        if (Flags.identityAddressNullIfUnknown()) {
            return Utils.getBrEdrAddress(device);
        }
        return device.getIdentityAddress();
    }
}
}