From fd7f71ca5e3b2e44a1c8c945ed57baad30a332c1 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 Merged-In: Idd03d7777c8257986b03dd1ba19aac5514f4f18d (cherry picked from commit a393bf9d25a5480a5b11d04a5ca7cca2ffab939f) --- .../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 ddee433d39973..233e798c8578f 100644 --- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java +++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java @@ -499,6 +499,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