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

Commit 13821952 authored by wumin3's avatar wumin3 Committed by Eric Laurent
Browse files

AudioService: fix audio mode not reset to MODE_NORMAL



when a app call setMode to set mode to non MODE_NORMAL modes many times with different audio managers in the same process, in this case the "pid" parameters are the same and the "cb" parameters are not the same, then the parameter "cb" registered and the "mCb" in hdlr are not the same, then NoSuchElementException will happen, and when the app was cleared in recent tasks the audio mode will not be reseted to MODE_NORMAL by expected flow.

Bug: 153649105
Test: AudioManagerTest#testAccessMode, CallDetailsTest#testSetVoipAudioMode
Test: manual cell and voip call
Signed-off-by: default avatarwumin3 <wumin3@xiaomi.com>
Change-Id: Ifb8c66372a8e994edcea628cad7dc2a7ee4763a6
Merged-In: Ifb8c66372a8e994edcea628cad7dc2a7ee4763a6
parent 1fdf62b7
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -3622,7 +3622,15 @@ public class AudioService extends IAudioService.Stub
                hdlr = h;
                // Remove from client list so that it is re-inserted at top of list
                iter.remove();
                try {
                    hdlr.getBinder().unlinkToDeath(hdlr, 0);
                    if (cb != hdlr.getBinder()) {
                        hdlr = null;
                    }
                } catch (NoSuchElementException e) {
                    hdlr = null;
                    Log.w(TAG, "link does not exist ...");
                }
                break;
            }
        }