Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7881d20 authored by Angela Wang's avatar Angela Wang
Browse files

BluetoothVolumeControl: Fix ClassCastException in registerCallback()

Bug: 320960358
Test: m Bluetooth
Test: call registerCallback() without exception
Tag: #feature
Flag: EXEMPT simple bug fix and the interface definition already flagged
Change-Id: I4b6b4a6033c058683eb6a6e5405add7f9e2753b7
parent 29ff541d
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -390,7 +390,31 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose
                        service.registerCallback(mCallback, mAttributionSource, recv);
                    } else {
                        service.notifyNewRegisteredCallback(
                                (IBluetoothVolumeControlCallback) (callback),
                                new IBluetoothVolumeControlCallback.Stub() {
                                    @Override
                                    public void onVolumeOffsetChanged(
                                            BluetoothDevice device, int volumeOffset)
                                            throws RemoteException {
                                        Attributable.setAttributionSource(
                                                device, mAttributionSource);
                                        executor.execute(
                                                () ->
                                                        callback.onVolumeOffsetChanged(
                                                                device, volumeOffset));
                                    }

                                    @Override
                                    public void onDeviceVolumeChanged(
                                            BluetoothDevice device, int volume)
                                            throws RemoteException {
                                        Attributable.setAttributionSource(
                                                device, mAttributionSource);
                                        executor.execute(
                                                () ->
                                                        callback.onDeviceVolumeChanged(
                                                                device, volume));
                                    }
                                },
                                mAttributionSource,
                                recv);
                    }