Loading framework/java/android/bluetooth/BluetoothHapClient.java +8 −4 Original line number Diff line number Diff line Loading @@ -541,15 +541,19 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable @NonNull Callback callback) { Objects.requireNonNull(executor, "executor cannot be null"); Objects.requireNonNull(callback, "callback cannot be null"); if (!isEnabled()) { throw new IllegalStateException("service not enabled"); } if (DBG) log("registerCallback"); synchronized (mCallbackExecutorMap) { // If the callback map is empty, we register the service-to-app callback if (mCallbackExecutorMap.isEmpty()) { if (!isEnabled()) { /* If Bluetooth is off, just store callback and it will be registered * when Bluetooth is on */ mCallbackExecutorMap.put(callback, executor); return; } try { final IBluetoothHapClient service = getService(); if (service != null) { Loading @@ -558,7 +562,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable service.registerCallback(mCallback, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } } catch (IllegalStateException | TimeoutException e) { } catch (TimeoutException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); Loading framework/java/android/bluetooth/BluetoothLeBroadcast.java +8 −4 Original line number Diff line number Diff line Loading @@ -425,15 +425,19 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi @NonNull Callback callback) { Objects.requireNonNull(executor, "executor cannot be null"); Objects.requireNonNull(callback, "callback cannot be null"); if (!isEnabled()) { throw new IllegalStateException("service not enabled"); } if (DBG) log("registerCallback"); 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 IBluetoothLeAudio service = getService(); if (service != null) { Loading @@ -442,7 +446,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi service.registerLeBroadcastCallback(mCallback, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } } catch (TimeoutException | IllegalStateException e) { } catch (TimeoutException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); Loading framework/java/android/bluetooth/BluetoothVolumeControl.java +8 −1 Original line number Diff line number Diff line Loading @@ -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) { Loading @@ -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())); } } Loading Loading
framework/java/android/bluetooth/BluetoothHapClient.java +8 −4 Original line number Diff line number Diff line Loading @@ -541,15 +541,19 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable @NonNull Callback callback) { Objects.requireNonNull(executor, "executor cannot be null"); Objects.requireNonNull(callback, "callback cannot be null"); if (!isEnabled()) { throw new IllegalStateException("service not enabled"); } if (DBG) log("registerCallback"); synchronized (mCallbackExecutorMap) { // If the callback map is empty, we register the service-to-app callback if (mCallbackExecutorMap.isEmpty()) { if (!isEnabled()) { /* If Bluetooth is off, just store callback and it will be registered * when Bluetooth is on */ mCallbackExecutorMap.put(callback, executor); return; } try { final IBluetoothHapClient service = getService(); if (service != null) { Loading @@ -558,7 +562,7 @@ public final class BluetoothHapClient implements BluetoothProfile, AutoCloseable service.registerCallback(mCallback, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } } catch (IllegalStateException | TimeoutException e) { } catch (TimeoutException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); Loading
framework/java/android/bluetooth/BluetoothLeBroadcast.java +8 −4 Original line number Diff line number Diff line Loading @@ -425,15 +425,19 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi @NonNull Callback callback) { Objects.requireNonNull(executor, "executor cannot be null"); Objects.requireNonNull(callback, "callback cannot be null"); if (!isEnabled()) { throw new IllegalStateException("service not enabled"); } if (DBG) log("registerCallback"); 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 IBluetoothLeAudio service = getService(); if (service != null) { Loading @@ -442,7 +446,7 @@ public final class BluetoothLeBroadcast implements AutoCloseable, BluetoothProfi service.registerLeBroadcastCallback(mCallback, mAttributionSource, recv); recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } } catch (TimeoutException | IllegalStateException e) { } catch (TimeoutException e) { Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); Loading
framework/java/android/bluetooth/BluetoothVolumeControl.java +8 −1 Original line number Diff line number Diff line Loading @@ -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) { Loading @@ -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())); } } Loading