diff options
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothAdapter.java')
| -rw-r--r-- | framework/java/android/bluetooth/BluetoothAdapter.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/framework/java/android/bluetooth/BluetoothAdapter.java b/framework/java/android/bluetooth/BluetoothAdapter.java index 7b4cba2491..9bd4bdf0d4 100644 --- a/framework/java/android/bluetooth/BluetoothAdapter.java +++ b/framework/java/android/bluetooth/BluetoothAdapter.java @@ -31,6 +31,7 @@ import android.annotation.SuppressLint; import android.annotation.SystemApi; //import android.app.PropertyInvalidatedCache; import android.bluetooth.BluetoothDevice.Transport; import android.bluetooth.BluetoothFrameworkInitializer; +import android.bluetooth.BluetoothDevice.AddressType; import android.bluetooth.BluetoothProfile.ConnectionPolicy; import android.bluetooth.annotations.RequiresBluetoothAdvertisePermission; import android.bluetooth.annotations.RequiresBluetoothConnectPermission; @@ -851,6 +852,27 @@ public final class BluetoothAdapter { /** * Get a {@link BluetoothDevice} object for the given Bluetooth hardware + * address and addressType. + * <p>Valid Bluetooth hardware addresses must be upper case, in a format + * such as "00:11:22:33:AA:BB". The helper {@link #checkBluetoothAddress} is + * available to validate a Bluetooth address. + * <p>A {@link BluetoothDevice} will always be returned for a valid + * hardware address and type, even if this adapter has never seen that device. + * + * @param address valid Bluetooth MAC address + * @param addressType Bluetooth address type + * @throws IllegalArgumentException if address is invalid + */ + @RequiresNoPermission + public @NonNull BluetoothDevice getRemoteLeDevice(@NonNull String address, + @AddressType int addressType) { + final BluetoothDevice res = new BluetoothDevice(address, addressType); + res.setAttributionSource(mAttributionSource); + return res; + } + + /** + * Get a {@link BluetoothDevice} object for the given Bluetooth hardware * address. * <p>Valid Bluetooth hardware addresses must be 6 bytes. This method * expects the address in network byte order (MSB first). |
