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

Commit dde686f7 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi Committed by Android (Google) Code Review
Browse files

Merge "AudioService: fix audio mode restoring" into sc-dev

parents d998c94c 8c62ad38
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -1231,7 +1231,7 @@ public class AudioService extends IAudioService.Stub
        // Restore call state
        synchronized (mDeviceBroker.mSetModeLock) {
            onUpdateAudioMode(AudioSystem.MODE_CURRENT, android.os.Process.myPid(),
                    mContext.getPackageName());
                    mContext.getPackageName(), true /*force*/);
        }
        final int forSys;
        synchronized (mSettingsLock) {
@@ -4614,7 +4614,8 @@ public class AudioService extends IAudioService.Stub
    }

    @GuardedBy("mDeviceBroker.mSetModeLock")
    void onUpdateAudioMode(int requestedMode, int requesterPid, String requesterPackage) {
    void onUpdateAudioMode(int requestedMode, int requesterPid, String requesterPackage,
                           boolean force) {
        if (requestedMode == AudioSystem.MODE_CURRENT) {
            requestedMode = getMode();
        }
@@ -4631,7 +4632,7 @@ public class AudioService extends IAudioService.Stub
            Log.v(TAG, "onUpdateAudioMode() new mode: " + mode + ", current mode: "
                    + mMode.get() + " requested mode: " + requestedMode);
        }
        if (mode != mMode.get()) {
        if (mode != mMode.get() || force) {
            final long identity = Binder.clearCallingIdentity();
            int status = mAudioSystem.setPhoneState(mode, uid);
            Binder.restoreCallingIdentity(identity);
@@ -7402,8 +7403,8 @@ public class AudioService extends IAudioService.Stub
                        h.setPlaybackActive(mPlaybackMonitor.isPlaybackActiveForUid(h.getUid()));
                        h.setRecordingActive(mRecordMonitor.isRecordingActiveForUid(h.getUid()));
                        if (wasActive != h.isActive()) {
                            onUpdateAudioMode(AudioSystem.MODE_CURRENT,
                                    android.os.Process.myPid(), mContext.getPackageName());
                            onUpdateAudioMode(AudioSystem.MODE_CURRENT, android.os.Process.myPid(),
                                    mContext.getPackageName(), false /*force*/);
                        }
                    }
                    break;
@@ -7428,7 +7429,7 @@ public class AudioService extends IAudioService.Stub

                case MSG_UPDATE_AUDIO_MODE:
                    synchronized (mDeviceBroker.mSetModeLock) {
                        onUpdateAudioMode(msg.arg1, msg.arg2, (String) msg.obj);
                        onUpdateAudioMode(msg.arg1, msg.arg2, (String) msg.obj, false /*force*/);
                    }
                    break;
            }