Loading framework/java/android/bluetooth/BluetoothVolumeControl.java +73 −84 Original line number Diff line number Diff line Loading @@ -476,9 +476,11 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose throw new IllegalArgumentException("This callback has already been registered"); } try { final IBluetoothVolumeControl service = getService(); if (service != null) { if (service == null) { return; } try { final SynchronousResultReceiver<Integer> recv = SynchronousResultReceiver.get(); /* If the callback map is empty, we register the service-to-app callback. Loading @@ -495,12 +497,9 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose new IBluetoothVolumeControlCallback.Stub() { @Override public void onVolumeOffsetChanged( BluetoothDevice device, int instanceId, int volumeOffset) BluetoothDevice device, int instanceId, int volumeOffset) throws RemoteException { Attributable.setAttributionSource( device, mAttributionSource); Attributable.setAttributionSource(device, mAttributionSource); // The old API operates on the first instance only if (instanceId == 1) { Loading @@ -518,9 +517,7 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose executor.execute( () -> callback.onVolumeOffsetChanged( device, instanceId, volumeOffset)); device, instanceId, volumeOffset)); } } Loading @@ -533,11 +530,8 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose device, mAttributionSource); executor.execute( () -> callback .onVolumeOffsetAudioLocationChanged( device, instanceId, location)); callback.onVolumeOffsetAudioLocationChanged( device, instanceId, location)); } } Loading @@ -562,21 +556,16 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose @Override public void onDeviceVolumeChanged( BluetoothDevice device, int volume) throws RemoteException { Attributable.setAttributionSource( device, mAttributionSource); BluetoothDevice device, int volume) throws RemoteException { Attributable.setAttributionSource(device, mAttributionSource); executor.execute( () -> callback.onDeviceVolumeChanged( device, volume)); () -> callback.onDeviceVolumeChanged(device, volume)); } }, mAttributionSource, recv); } recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } } catch (RemoteException e) { mCallbackExecutorMap.remove(callback); Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); Loading Loading
framework/java/android/bluetooth/BluetoothVolumeControl.java +73 −84 Original line number Diff line number Diff line Loading @@ -476,9 +476,11 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose throw new IllegalArgumentException("This callback has already been registered"); } try { final IBluetoothVolumeControl service = getService(); if (service != null) { if (service == null) { return; } try { final SynchronousResultReceiver<Integer> recv = SynchronousResultReceiver.get(); /* If the callback map is empty, we register the service-to-app callback. Loading @@ -495,12 +497,9 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose new IBluetoothVolumeControlCallback.Stub() { @Override public void onVolumeOffsetChanged( BluetoothDevice device, int instanceId, int volumeOffset) BluetoothDevice device, int instanceId, int volumeOffset) throws RemoteException { Attributable.setAttributionSource( device, mAttributionSource); Attributable.setAttributionSource(device, mAttributionSource); // The old API operates on the first instance only if (instanceId == 1) { Loading @@ -518,9 +517,7 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose executor.execute( () -> callback.onVolumeOffsetChanged( device, instanceId, volumeOffset)); device, instanceId, volumeOffset)); } } Loading @@ -533,11 +530,8 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose device, mAttributionSource); executor.execute( () -> callback .onVolumeOffsetAudioLocationChanged( device, instanceId, location)); callback.onVolumeOffsetAudioLocationChanged( device, instanceId, location)); } } Loading @@ -562,21 +556,16 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose @Override public void onDeviceVolumeChanged( BluetoothDevice device, int volume) throws RemoteException { Attributable.setAttributionSource( device, mAttributionSource); BluetoothDevice device, int volume) throws RemoteException { Attributable.setAttributionSource(device, mAttributionSource); executor.execute( () -> callback.onDeviceVolumeChanged( device, volume)); () -> callback.onDeviceVolumeChanged(device, volume)); } }, mAttributionSource, recv); } recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } } catch (RemoteException e) { mCallbackExecutorMap.remove(callback); Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable())); Loading