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

Commit b9549398 authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Gerrit Code Review
Browse files

Merge "Fix NPE in createBond"

parents 9d5b7964 36e79438
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;