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

Commit 36e79438 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Fix NPE in createBond

Bug: 32925925
Test: initiate bonding locally using NFC OOB
Change-Id: I9aadea84e9e2e57cf75c02affa618eb37a33a767
parent df38dddd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1627,7 +1627,7 @@ public class AdapterService extends Service {
            return false;
        }

        deviceProp.setBondingInitiatedLocally(true);
        mRemoteDevices.setBondingInitiatedLocally(Utils.getByteAddress(device));

        // Pairing is unreliable while scanning, so cancel discovery
        // Note, remove this when native stack improves
+17 −2
Original line number Diff line number Diff line
@@ -24,9 +24,7 @@ import android.os.Handler;
import android.os.Message;
import android.os.ParcelUuid;
import android.util.Log;

import com.android.bluetooth.Utils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
@@ -271,6 +269,23 @@ final class RemoteDevices {
        mSdpTracker.remove(device);
    }

  /**
   * When bonding is initiated to remote device that we have never seen, i.e Out Of Band pairing, we
   * must add device first before setting it's properties. This is a helper method for doing that.
   */
  void setBondingInitiatedLocally(byte[] address) {
        DeviceProperties properties;

        BluetoothDevice device = getDevice(address);
        if (device == null) {
            properties = addDeviceProperties(address);
        } else {
            properties = getDeviceProperties(device);
        }

        properties.setBondingInitiatedLocally(true);
    }


    void devicePropertyChangedCallback(byte[] address, int[] types, byte[][] values) {
        Intent intent;