From a393bf9d25a5480a5b11d04a5ca7cca2ffab939f Mon Sep 17 00:00:00 2001 From: Chienyuan Date: Thu, 27 Jan 2022 10:44:18 +0800 Subject: [PATCH] SettingsLib: Add API to get identity address Bug: 197044261 Test: build pass Change-Id: Idd03d7777c8257986b03dd1ba19aac5514f4f18d --- .../settingslib/bluetooth/CachedBluetoothDevice.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java index 290055ce91a77..1c9d9cf376f14 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java @@ -503,6 +503,17 @@ public class CachedBluetoothDevice implements Comparable return mDevice.getAddress(); } + /** + * 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