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

Commit 42927c4e authored by Shibin George's avatar Shibin George Committed by android-build-merger
Browse files

Merge \"Fix deadlock b/w ActivityManagerService and MediaSessionService\"

am: 4eea3a7f

Change-Id: I499c69fd3890ada652213c0510df3b884223a5df
parents 51f620d9 4eea3a7f
Loading
Loading
Loading
Loading
+18 −7
Original line number Diff line number Diff line
@@ -890,6 +890,15 @@ public class MediaSessionService extends SystemService implements Monitor {
                    }
                    return;
                }

                // Execute mAudioService.adjustSuggestedStreamVolume() on
                // handler thread of MediaSessionService.
                // This will release the MediaSessionService.mLock sooner and avoid
                // a potential deadlock between MediaSessionService.mLock and
                // ActivityManagerService lock.
                mHandler.post(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            String packageName = getContext().getOpPackageName();
                            mAudioService.adjustSuggestedStreamVolume(direction, suggestedStream,
@@ -897,6 +906,8 @@ public class MediaSessionService extends SystemService implements Monitor {
                        } catch (RemoteException e) {
                            Log.e(TAG, "Error adjusting default volume.", e);
                        }
                    }
                });
            } else {
                session.adjustVolume(direction, flags, getContext().getPackageName(),
                        UserHandle.myUserId(), true);