diff options
author | Rob Seymour <rseymour@google.com> | 2022-04-02 03:52:13 +0000 |
---|---|---|
committer | Rob Seymour <rseymour@google.com> | 2022-04-02 04:01:22 +0000 |
commit | 4c7dc59bef24cc991251f9a7924ceada90c6bd63 (patch) | |
tree | a90550aa3ce1bc5e002ab6444c96954deca81af0 /framework/java/android/bluetooth/BluetoothVolumeControl.java | |
parent | 6fa2bea006b362a285f744f65f15b5902e55797a (diff) | |
parent | dd4d23c4e1de011f8cd4eb132422172d5e283a73 (diff) |
Merge TP1A.220328.001
Change-Id: I5f07094ba2fb3991da03673f97d2957b1f68018b
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothVolumeControl.java')
-rw-r--r-- | framework/java/android/bluetooth/BluetoothVolumeControl.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/framework/java/android/bluetooth/BluetoothVolumeControl.java b/framework/java/android/bluetooth/BluetoothVolumeControl.java index a359c91206..080b9a6d64 100644 --- a/framework/java/android/bluetooth/BluetoothVolumeControl.java +++ b/framework/java/android/bluetooth/BluetoothVolumeControl.java @@ -344,6 +344,13 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose synchronized (mCallbackExecutorMap) { // If the callback map is empty, we register the service-to-app callback if (mCallbackExecutorMap.isEmpty()) { + if (!mAdapter.isEnabled()) { + /* If Bluetooth is off, just store callback and it will be registered + * when Bluetooth is on + */ + mCallbackExecutorMap.put(callback, executor); + return; + } try { final IBluetoothVolumeControl service = getService(); if (service != null) { @@ -355,7 +362,7 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose } catch (RemoteException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); throw e.rethrowFromSystemServer(); - } catch (IllegalStateException | TimeoutException e) { + } catch (TimeoutException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } } |