Skip to content

Commit 46ee92d

Browse files
wumin3PMS22
authored andcommitted
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. Signed-off-by: wumin3 <wumin3@xiaomi.com> Change-Id: Ifb8c66372a8e994edcea628cad7dc2a7ee4763a6
1 parent 1f199ce commit 46ee92d

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

services/core/java/com/android/server/audio/AudioService.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3392,7 +3392,15 @@ private int setModeInt(int mode, IBinder cb, int pid, String caller) {
33923392
hdlr = h;
33933393
// Remove from client list so that it is re-inserted at top of list
33943394
iter.remove();
3395-
hdlr.getBinder().unlinkToDeath(hdlr, 0);
3395+
try {
3396+
hdlr.getBinder().unlinkToDeath(hdlr, 0);
3397+
if (cb != hdlr.getBinder()){
3398+
hdlr = null;
3399+
}
3400+
} catch (NoSuchElementException e) {
3401+
hdlr = null;
3402+
Log.w(TAG, "link does not exist ...");
3403+
}
33963404
break;
33973405
}
33983406
}

0 commit comments

Comments
 (0)