diff options
| -rw-r--r-- | api/current.txt | 1 | ||||
| -rw-r--r-- | api/system-current.txt | 1 | ||||
| -rw-r--r-- | api/test-current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/bluetooth/BluetoothAdapter.java | 19 | ||||
| -rw-r--r-- | core/java/android/bluetooth/IBluetooth.aidl | 1 |
5 files changed, 23 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt index f9cfc68ba433..74953c234c5d 100644 --- a/api/current.txt +++ b/api/current.txt @@ -7122,6 +7122,7 @@ package android.bluetooth { method public android.bluetooth.le.BluetoothLeScanner getBluetoothLeScanner(); method public java.util.Set<android.bluetooth.BluetoothDevice> getBondedDevices(); method public static synchronized android.bluetooth.BluetoothAdapter getDefaultAdapter(); + method public int getLeMaximumAdvertisingDataLength(); method public java.lang.String getName(); method public android.bluetooth.le.PeriodicAdvertisingManager getPeriodicAdvertisingManager(); method public int getProfileConnectionState(int); diff --git a/api/system-current.txt b/api/system-current.txt index 839bde3aa28c..7fc18d06df46 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -7591,6 +7591,7 @@ package android.bluetooth { method public android.bluetooth.le.BluetoothLeScanner getBluetoothLeScanner(); method public java.util.Set<android.bluetooth.BluetoothDevice> getBondedDevices(); method public static synchronized android.bluetooth.BluetoothAdapter getDefaultAdapter(); + method public int getLeMaximumAdvertisingDataLength(); method public java.lang.String getName(); method public android.bluetooth.le.PeriodicAdvertisingManager getPeriodicAdvertisingManager(); method public int getProfileConnectionState(int); diff --git a/api/test-current.txt b/api/test-current.txt index 6bfdafec283d..670217029ddb 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -7149,6 +7149,7 @@ package android.bluetooth { method public android.bluetooth.le.BluetoothLeScanner getBluetoothLeScanner(); method public java.util.Set<android.bluetooth.BluetoothDevice> getBondedDevices(); method public static synchronized android.bluetooth.BluetoothAdapter getDefaultAdapter(); + method public int getLeMaximumAdvertisingDataLength(); method public java.lang.String getName(); method public android.bluetooth.le.PeriodicAdvertisingManager getPeriodicAdvertisingManager(); method public int getProfileConnectionState(int); diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java index 488511b49b88..4e1e42da4fe7 100644 --- a/core/java/android/bluetooth/BluetoothAdapter.java +++ b/core/java/android/bluetooth/BluetoothAdapter.java @@ -1483,6 +1483,25 @@ public final class BluetoothAdapter { } /** + * Return the maximum LE advertising data length, + * if LE Extended Advertising feature is supported. + * + * @return the maximum LE advertising data length. + */ + public int getLeMaximumAdvertisingDataLength() { + if (!getLeAccess()) return 0; + try { + mServiceLock.readLock().lock(); + if (mService != null) return mService.getLeMaximumAdvertisingDataLength(); + } catch (RemoteException e) { + Log.e(TAG, "failed to get getLeMaximumAdvertisingDataLength, error: ", e); + } finally { + mServiceLock.readLock().unlock(); + } + return 0; + } + + /** * Return true if hardware has entries available for matching beacons * * @return true if there are hw entries available for matching beacons diff --git a/core/java/android/bluetooth/IBluetooth.aidl b/core/java/android/bluetooth/IBluetooth.aidl index 76ca554e5984..b33781729b62 100644 --- a/core/java/android/bluetooth/IBluetooth.aidl +++ b/core/java/android/bluetooth/IBluetooth.aidl @@ -108,6 +108,7 @@ interface IBluetooth boolean isLeCodedPhySupported(); boolean isLeExtendedAdvertisingSupported(); boolean isLePeriodicAdvertisingSupported(); + int getLeMaximumAdvertisingDataLength(); BluetoothActivityEnergyInfo reportActivityInfo(); /** |