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

Commit c977c776 authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Android (Google) Code Review
Browse files

Merge changes from topic 'ble_oob_sc_mr2' into nyc-mr2-dev

* changes:
  BLE OOB Pairing - parse address type (5/5)
  Fix Bluetooth OOB pairing not working for unseen devices
  Add LE Secure Connection data parsing (1/4)
parents 1157adb3 3e737135
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
@@ -30,7 +30,23 @@ import android.util.Log;
 * @hide
 */
public class OobData implements Parcelable {
    private byte[] leBluetoothDeviceAddress;
    private byte[] securityManagerTk;
    private byte[] leSecureConnectionsConfirmation;
    private byte[] leSecureConnectionsRandom;

    public byte[] getLeBluetoothDeviceAddress() {
        return leBluetoothDeviceAddress;
    }

    /**
     * Sets the LE Bluetooth Device Address value to be used during LE pairing.
     * The value shall be 7 bytes. Please see Bluetooth CSSv6, Part A 1.16 for
     * a detailed description.
     */
    public void setLeBluetoothDeviceAddress(byte[] leBluetoothDeviceAddress) {
        this.leBluetoothDeviceAddress = leBluetoothDeviceAddress;
    }

    public byte[] getSecurityManagerTk() {
        return securityManagerTk;
@@ -45,10 +61,29 @@ public class OobData implements Parcelable {
        this.securityManagerTk = securityManagerTk;
    }

    public byte[] getLeSecureConnectionsConfirmation() {
        return leSecureConnectionsConfirmation;
    }

    public void setLeSecureConnectionsConfirmation(byte[] leSecureConnectionsConfirmation) {
        this.leSecureConnectionsConfirmation = leSecureConnectionsConfirmation;
    }

    public byte[] getLeSecureConnectionsRandom() {
        return leSecureConnectionsRandom;
    }

    public void setLeSecureConnectionsRandom(byte[] leSecureConnectionsRandom) {
        this.leSecureConnectionsRandom = leSecureConnectionsRandom;
    }

    public OobData() { }

    private OobData(Parcel in) {
        leBluetoothDeviceAddress = in.createByteArray();
        securityManagerTk = in.createByteArray();
        leSecureConnectionsConfirmation = in.createByteArray();
        leSecureConnectionsRandom = in.createByteArray();
    }

    public int describeContents() {
@@ -57,7 +92,10 @@ public class OobData implements Parcelable {

    @Override
    public void writeToParcel(Parcel out, int flags) {
        out.writeByteArray(leBluetoothDeviceAddress);
        out.writeByteArray(securityManagerTk);
        out.writeByteArray(leSecureConnectionsConfirmation);
        out.writeByteArray(leSecureConnectionsRandom);
    }

    public static final Parcelable.Creator<OobData> CREATOR
+8 −8
Original line number Diff line number Diff line
@@ -268,16 +268,16 @@ public final class BluetoothEventManager {
            if (cachedDevice == null) {
                Log.w(TAG, "CachedBluetoothDevice for device " + device +
                        " not found, calling readPairedDevices().");
                if (!readPairedDevices()) {
                    Log.e(TAG, "Got bonding state changed for " + device +
                            ", but we have no record of that device.");
                    return;
                }
                if (readPairedDevices()) {
                    cachedDevice = mDeviceManager.findDevice(device);
                }

                if (cachedDevice == null) {
                    Log.e(TAG, "Got bonding state changed for " + device +
                            ", but device not added in cache.");
                    return;
                    Log.w(TAG, "Got bonding state changed for " + device +
                            ", but we have no record of that device.");

                    cachedDevice = mDeviceManager.addDevice(mLocalAdapter, mProfileManager, device);
                    dispatchDeviceAdded(cachedDevice);
                }
            }