diff --git a/core/java/android/bluetooth/OobData.java b/core/java/android/bluetooth/OobData.java index 8e659e04d7053..9e87230c686e4 100644 --- a/core/java/android/bluetooth/OobData.java +++ b/core/java/android/bluetooth/OobData.java @@ -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 CREATOR diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java index 4bcbea76f134c..a332332131012 100755 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java @@ -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); } - 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); } }