Loading framework/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ package android.bluetooth { method public boolean getProfileProxy(android.content.Context, android.bluetooth.BluetoothProfile.ServiceListener, int); method public android.bluetooth.BluetoothDevice getRemoteDevice(String); method public android.bluetooth.BluetoothDevice getRemoteDevice(byte[]); method @NonNull public android.bluetooth.BluetoothDevice getRemoteLeDevice(@NonNull String, int); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public int getScanMode(); method public int getState(); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public boolean isDiscovering(); Loading framework/java/android/bluetooth/BluetoothAdapter.java +23 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,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; Loading Loading @@ -866,6 +867,28 @@ public final class BluetoothAdapter { return res; } /** * 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. Loading framework/java/android/bluetooth/BluetoothDevice.java +24 −6 Original line number Diff line number Diff line Loading @@ -1201,28 +1201,46 @@ public final class BluetoothDevice implements Parcelable, Attributable { }; /** * Create a new BluetoothDevice * Create a new BluetoothDevice. * Bluetooth MAC address must be upper case, such as "00:11:22:33:AA:BB", * and is validated in this constructor. * * @param address valid Bluetooth MAC address * @param attributionSource attribution for permission-protected calls * @param addressType valid address type * @throws RuntimeException Bluetooth is not available on this platform * @throws IllegalArgumentException address is invalid * @throws IllegalArgumentException address or addressType is invalid * @hide */ @UnsupportedAppUsage /*package*/ BluetoothDevice(String address) { /*package*/ BluetoothDevice(String address, int addressType) { getService(); // ensures sService is initialized if (!BluetoothAdapter.checkBluetoothAddress(address)) { throw new IllegalArgumentException(address + " is not a valid Bluetooth address"); } if (addressType != ADDRESS_TYPE_PUBLIC && addressType != ADDRESS_TYPE_RANDOM) { throw new IllegalArgumentException(addressType + " is not a Bluetooth address type"); } mAddress = address; mAddressType = ADDRESS_TYPE_PUBLIC; mAddressType = addressType; mAttributionSource = AttributionSource.myAttributionSource(); } /** * Create a new BluetoothDevice. * Bluetooth MAC address must be upper case, such as "00:11:22:33:AA:BB", * and is validated in this constructor. * * @param address valid Bluetooth MAC address * @throws RuntimeException Bluetooth is not available on this platform * @throws IllegalArgumentException address is invalid * @hide */ @UnsupportedAppUsage /*package*/ BluetoothDevice(String address) { this(address, ADDRESS_TYPE_PUBLIC); } /** {@hide} */ public void setAttributionSource(@NonNull AttributionSource attributionSource) { mAttributionSource = attributionSource; Loading Loading
framework/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ package android.bluetooth { method public boolean getProfileProxy(android.content.Context, android.bluetooth.BluetoothProfile.ServiceListener, int); method public android.bluetooth.BluetoothDevice getRemoteDevice(String); method public android.bluetooth.BluetoothDevice getRemoteDevice(byte[]); method @NonNull public android.bluetooth.BluetoothDevice getRemoteLeDevice(@NonNull String, int); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public int getScanMode(); method public int getState(); method @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public boolean isDiscovering(); Loading
framework/java/android/bluetooth/BluetoothAdapter.java +23 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,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; Loading Loading @@ -866,6 +867,28 @@ public final class BluetoothAdapter { return res; } /** * 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. Loading
framework/java/android/bluetooth/BluetoothDevice.java +24 −6 Original line number Diff line number Diff line Loading @@ -1201,28 +1201,46 @@ public final class BluetoothDevice implements Parcelable, Attributable { }; /** * Create a new BluetoothDevice * Create a new BluetoothDevice. * Bluetooth MAC address must be upper case, such as "00:11:22:33:AA:BB", * and is validated in this constructor. * * @param address valid Bluetooth MAC address * @param attributionSource attribution for permission-protected calls * @param addressType valid address type * @throws RuntimeException Bluetooth is not available on this platform * @throws IllegalArgumentException address is invalid * @throws IllegalArgumentException address or addressType is invalid * @hide */ @UnsupportedAppUsage /*package*/ BluetoothDevice(String address) { /*package*/ BluetoothDevice(String address, int addressType) { getService(); // ensures sService is initialized if (!BluetoothAdapter.checkBluetoothAddress(address)) { throw new IllegalArgumentException(address + " is not a valid Bluetooth address"); } if (addressType != ADDRESS_TYPE_PUBLIC && addressType != ADDRESS_TYPE_RANDOM) { throw new IllegalArgumentException(addressType + " is not a Bluetooth address type"); } mAddress = address; mAddressType = ADDRESS_TYPE_PUBLIC; mAddressType = addressType; mAttributionSource = AttributionSource.myAttributionSource(); } /** * Create a new BluetoothDevice. * Bluetooth MAC address must be upper case, such as "00:11:22:33:AA:BB", * and is validated in this constructor. * * @param address valid Bluetooth MAC address * @throws RuntimeException Bluetooth is not available on this platform * @throws IllegalArgumentException address is invalid * @hide */ @UnsupportedAppUsage /*package*/ BluetoothDevice(String address) { this(address, ADDRESS_TYPE_PUBLIC); } /** {@hide} */ public void setAttributionSource(@NonNull AttributionSource attributionSource) { mAttributionSource = attributionSource; Loading