From ef67156ab814526f18c2aaac306ff6f09110f8b6 Mon Sep 17 00:00:00 2001 From: William Escande Date: Fri, 15 Apr 2022 16:07:25 -0700 Subject: Restore devices volume after bluetooth restart At AvrcpVolumeManager startup, we tried to read the sharedPref and to save it in the memory. A clean is performed on this list to remove non-bonded devices. The issue here is that the getBondState was returning BOND_NONE for all devices due to check perform on the adapter State. We don't know why the adapter is not reported as STATE_ON at this point but this check was added on all method to sanitize the shutdown process. Because this is a cached value there is no risk from a crash at shutdown Fix: 228415780 Ignore-AOSP-First: No caching done on AOSP Test: Manual testing Change-Id: I52362c3b511054abcb88e0cb83df95ba74c62ef4 --- framework/java/android/bluetooth/BluetoothDevice.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'framework/java/android/bluetooth/BluetoothDevice.java') diff --git a/framework/java/android/bluetooth/BluetoothDevice.java b/framework/java/android/bluetooth/BluetoothDevice.java index 222df3286a..d1e33c4454 100644 --- a/framework/java/android/bluetooth/BluetoothDevice.java +++ b/framework/java/android/bluetooth/BluetoothDevice.java @@ -1914,7 +1914,7 @@ public final class BluetoothDevice implements Parcelable, Attributable { if (DBG) log("getBondState() uncached"); final IBluetooth service = sService; final int defaultValue = BOND_NONE; - if (service == null || !isBluetoothEnabled()) { + if (service == null) { Log.e(TAG, "BT not enabled. Cannot get bond state"); if (DBG) log(Log.getStackTraceString(new Throwable())); } else { -- cgit v1.2.3