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

Commit da42712c authored by Eric Laurent's avatar Eric Laurent
Browse files

AudioService: clear caller identity before broadcasting intent

As setMicrophoneMute API is processed inside a binder call,
the caller identity mnust be cleared before broadcasting intent
ACTION_MICROPHONE_MUTE_CHANGED.

Bug: 144406103
Test: make
Change-Id: I2a573932ebcd92cd76bf734a4c6c8dfd28d9bbb7
parent 2c6c2040
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -2919,12 +2919,15 @@ public class AudioService extends IAudioService.Stub
            final boolean currentMute = AudioSystem.isMicrophoneMuted();
            final long identity = Binder.clearCallingIdentity();
            AudioSystem.muteMicrophone(muted);
            Binder.restoreCallingIdentity(identity);
            try {
                if (muted != currentMute) {
                    mContext.sendBroadcastAsUser(
                        new Intent(AudioManager.ACTION_MICROPHONE_MUTE_CHANGED)
                                .setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY), UserHandle.ALL);
                }
            } finally {
                Binder.restoreCallingIdentity(identity);
            }
        }
    }