diff options
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothAdapter.java')
| -rw-r--r-- | framework/java/android/bluetooth/BluetoothAdapter.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/framework/java/android/bluetooth/BluetoothAdapter.java b/framework/java/android/bluetooth/BluetoothAdapter.java index ff22c7614a..3cabde5e38 100644 --- a/framework/java/android/bluetooth/BluetoothAdapter.java +++ b/framework/java/android/bluetooth/BluetoothAdapter.java @@ -30,6 +30,7 @@ import android.annotation.SdkConstant.SdkConstantType; import android.annotation.SuppressLint; import android.annotation.SystemApi; //import android.app.PropertyInvalidatedCache; import android.app.PendingIntent; +import android.bluetooth.BluetoothDevice.AddressType; import android.bluetooth.BluetoothDevice.Transport; import android.bluetooth.BluetoothProfile.ConnectionPolicy; import android.bluetooth.annotations.RequiresBluetoothAdvertisePermission; @@ -864,6 +865,28 @@ 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). |
