Merge "Prevent create bond for null MAC address"
This commit is contained in:
@@ -1035,6 +1035,8 @@ public final class BluetoothDevice implements Parcelable {
|
|||||||
/** Address is either resolvable, non-resolvable or static. */
|
/** Address is either resolvable, non-resolvable or static. */
|
||||||
public static final int ADDRESS_TYPE_RANDOM = 1;
|
public static final int ADDRESS_TYPE_RANDOM = 1;
|
||||||
|
|
||||||
|
private static final String NULL_MAC_ADDRESS = "00:00:00:00:00:00";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lazy initialization. Guaranteed final after first object constructed, or
|
* Lazy initialization. Guaranteed final after first object constructed, or
|
||||||
* getService() called.
|
* getService() called.
|
||||||
@@ -1371,6 +1373,10 @@ public final class BluetoothDevice implements Parcelable {
|
|||||||
Log.w(TAG, "BT not enabled, createBondOutOfBand failed");
|
Log.w(TAG, "BT not enabled, createBondOutOfBand failed");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (NULL_MAC_ADDRESS.equals(mAddress)) {
|
||||||
|
Log.e(TAG, "Unable to create bond, invalid address " + mAddress);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
return service.createBond(this, transport, remoteP192Data, remoteP256Data);
|
return service.createBond(this, transport, remoteP192Data, remoteP256Data);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user