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)
This commit is contained in:
Jakub Pawlowski
2016-12-02 20:14:00 +00:00
committed by Android (Google) Code Review
2 changed files with 46 additions and 8 deletions

View File

@@ -30,7 +30,23 @@ import android.util.Log;
* @hide * @hide
*/ */
public class OobData implements Parcelable { public class OobData implements Parcelable {
private byte[] leBluetoothDeviceAddress;
private byte[] securityManagerTk; 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() { public byte[] getSecurityManagerTk() {
return securityManagerTk; return securityManagerTk;
@@ -45,10 +61,29 @@ public class OobData implements Parcelable {
this.securityManagerTk = securityManagerTk; 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() { } public OobData() { }
private OobData(Parcel in) { private OobData(Parcel in) {
leBluetoothDeviceAddress = in.createByteArray();
securityManagerTk = in.createByteArray(); securityManagerTk = in.createByteArray();
leSecureConnectionsConfirmation = in.createByteArray();
leSecureConnectionsRandom = in.createByteArray();
} }
public int describeContents() { public int describeContents() {
@@ -57,7 +92,10 @@ public class OobData implements Parcelable {
@Override @Override
public void writeToParcel(Parcel out, int flags) { public void writeToParcel(Parcel out, int flags) {
out.writeByteArray(leBluetoothDeviceAddress);
out.writeByteArray(securityManagerTk); out.writeByteArray(securityManagerTk);
out.writeByteArray(leSecureConnectionsConfirmation);
out.writeByteArray(leSecureConnectionsRandom);
} }
public static final Parcelable.Creator<OobData> CREATOR public static final Parcelable.Creator<OobData> CREATOR

View File

@@ -268,16 +268,16 @@ public final class BluetoothEventManager {
if (cachedDevice == null) { if (cachedDevice == null) {
Log.w(TAG, "CachedBluetoothDevice for device " + device + Log.w(TAG, "CachedBluetoothDevice for device " + device +
" not found, calling readPairedDevices()."); " not found, calling readPairedDevices().");
if (!readPairedDevices()) { if (readPairedDevices()) {
Log.e(TAG, "Got bonding state changed for " + device + cachedDevice = mDeviceManager.findDevice(device);
", but we have no record of that device.");
return;
} }
cachedDevice = mDeviceManager.findDevice(device);
if (cachedDevice == null) { if (cachedDevice == null) {
Log.e(TAG, "Got bonding state changed for " + device + Log.w(TAG, "Got bonding state changed for " + device +
", but device not added in cache."); ", but we have no record of that device.");
return;
cachedDevice = mDeviceManager.addDevice(mLocalAdapter, mProfileManager, device);
dispatchDeviceAdded(cachedDevice);
} }
} }