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

Commit cb1e8b12 authored by Evan Chen's avatar Evan Chen Committed by Android (Google) Code Review
Browse files

Merge "Fix NullPointerException when fetching uuid from BluetoothDevice" into main

parents 0252af2e d8a67a64
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -368,8 +368,10 @@ public class CompanionDeviceManagerService extends SystemService {

        if (blueToothDevices != null) {
            for (BluetoothDevice bluetoothDevice : blueToothDevices) {
                final List<ParcelUuid> deviceUuids = bluetoothDevice.getUuids() == null
                        ? Collections.emptyList() : Arrays.asList(bluetoothDevice.getUuids());
                final ParcelUuid[] bluetoothDeviceUuids = bluetoothDevice.getUuids();

                final List<ParcelUuid> deviceUuids = ArrayUtils.isEmpty(bluetoothDeviceUuids)
                        ? Collections.emptyList() : Arrays.asList(bluetoothDeviceUuids);

                for (AssociationInfo ai:
                        mAssociationStore.getAssociationsByAddress(bluetoothDevice.getAddress())) {
+5 −2
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import android.util.Slog;
import android.util.SparseArray;

import com.android.internal.annotations.GuardedBy;
import com.android.internal.util.ArrayUtils;
import com.android.server.companion.AssociationStore;
import com.android.server.companion.ObservableUuid;
import com.android.server.companion.ObservableUuidStore;
@@ -172,8 +173,10 @@ public class BluetoothCompanionDeviceConnectionListener
                mAssociationStore.getAssociationsByAddress(device.getAddress());
        final List<ObservableUuid> observableUuids =
                mObservableUuidStore.getObservableUuidsForUser(userId);
        final List<ParcelUuid> deviceUuids = device.getUuids() == null
                ? Collections.emptyList() : Arrays.asList(device.getUuids());
        final ParcelUuid[] bluetoothDeviceUuids = device.getUuids();

        final List<ParcelUuid> deviceUuids = ArrayUtils.isEmpty(bluetoothDeviceUuids)
                ? Collections.emptyList() : Arrays.asList(bluetoothDeviceUuids);

        if (DEBUG) {
            Log.d(TAG, "onDevice_ConnectivityChanged() " + btDeviceToString(device)