summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chienyuan <chienyuanhuang@google.com> 2022-01-27 10:44:18 +0800
committer Chienyuan <chienyuanhuang@google.com> 2022-01-27 10:44:18 +0800
commita393bf9d25a5480a5b11d04a5ca7cca2ffab939f (patch)
treee9c883f3e98c35fdfcfd375eef1facae4a4ea99c
parent49f9c3744b4e20bae09c540e4f077a2d2410ebbc (diff)
SettingsLib: Add API to get identity address
Bug: 197044261 Test: build pass Change-Id: Idd03d7777c8257986b03dd1ba19aac5514f4f18d
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
index 290055ce91a7..1c9d9cf376f1 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
@@ -504,6 +504,17 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
}
/**
+ * Get identity address from remote device
+ * @return {@link BluetoothDevice#getIdentityAddress()} if
+ * {@link BluetoothDevice#getIdentityAddress()} is not null otherwise return
+ * {@link BluetoothDevice#getAddress()}
+ */
+ public String getIdentityAddress() {
+ final String identityAddress = mDevice.getIdentityAddress();
+ return TextUtils.isEmpty(identityAddress) ? getAddress() : identityAddress;
+ }
+
+ /**
* Get name from remote device
* @return {@link BluetoothDevice#getAlias()} if
* {@link BluetoothDevice#getAlias()} is not null otherwise return