summaryrefslogtreecommitdiff
path: root/framework/java
diff options
context:
space:
mode:
author Himanshu Rohilla <rohillah@google.com> 2025-02-26 09:11:40 -0800
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2025-02-26 09:11:40 -0800
commit8ce7a52661c0b81ed24bc29b3209baef091ff46e (patch)
treed85a0a04891d04aa5736b7711fb3fde6c17fd7c7 /framework/java
parent15d4ffe9104a20ff8423ba3c663c00f9ee933cda (diff)
parent8ab236ce4b98bd1757a28578dd81ba15121d8baa (diff)
Merge changes Ic24bc34a,I6ec8c492 into main
* changes: Update bond loss count as per bond state Add metadata to save ACTION_KEY_MISSING intent count
Diffstat (limited to 'framework/java')
-rw-r--r--framework/java/android/bluetooth/BluetoothDevice.java32
1 files changed, 28 insertions, 4 deletions
diff --git a/framework/java/android/bluetooth/BluetoothDevice.java b/framework/java/android/bluetooth/BluetoothDevice.java
index 0c3f4288e6..8c053201e9 100644
--- a/framework/java/android/bluetooth/BluetoothDevice.java
+++ b/framework/java/android/bluetooth/BluetoothDevice.java
@@ -896,8 +896,7 @@ public final class BluetoothDevice implements Parcelable, Attributable {
*
* @hide
*/
- @SystemApi
- public static final int METADATA_EXCLUSIVE_MANAGER = 29;
+ @SystemApi public static final int METADATA_EXCLUSIVE_MANAGER = 29;
private static final int METADATA_MAX_KEY = METADATA_EXCLUSIVE_MANAGER;
@@ -1727,8 +1726,8 @@ public final class BluetoothDevice implements Parcelable, Attributable {
/**
* Returns the identity address and identity address type of this BluetoothDevice. An identity
- * address is a public or static random Bluetooth LE device address that serves as a
- * unique identifier.
+ * address is a public or static random Bluetooth LE device address that serves as a unique
+ * identifier.
*
* @return a {@link BluetoothAddress} containing identity address and identity address type. If
* Bluetooth is not enabled or identity address type is not available, it will return a
@@ -3791,6 +3790,31 @@ public final class BluetoothDevice implements Parcelable, Attributable {
return true;
}
+ /**
+ * Get the number of times {@link ACTION_KEY_MISSING} intent is thrown for this device since
+ * last successful encrypted connection
+ *
+ * @return number of times {@link ACTION_KEY_MISSING} intent is thrown for this device since
+ * last successful encrypted connection
+ *
+ * @hide
+ */
+ @RequiresPermission(BLUETOOTH_CONNECT)
+ public int getKeyMissingCount() {
+ final IBluetooth service = getService();
+ if (service == null || !isBluetoothEnabled()) {
+ Log.e(TAG, "Bluetooth is not enabled. Cannot get key missing counter.");
+ if (DBG) log(Log.getStackTraceString(new Throwable()));
+ } else {
+ try {
+ return service.getKeyMissingCount(this, mAttributionSource);
+ } catch (RemoteException e) {
+ Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
+ }
+ }
+ return -1;
+ }
+
private static void log(String msg) {
Log.d(TAG, msg);
}