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

Commit a288bec9 authored by BK Choi's avatar BK Choi Committed by Android (Google) Code Review
Browse files

Merge "Fix incorrect MediaMetric UID in setMicrophoneMuteNoCallerCheck." into main

parents 1685ac79 41583c7f
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -5464,19 +5464,19 @@ public class AudioService extends IAudioService.Stub
    /** @see AudioManager#setMicrophoneMuteFromSwitch(boolean) */
    public void setMicrophoneMuteFromSwitch(boolean on) {
        int userId = Binder.getCallingUid();
        if (userId != android.os.Process.SYSTEM_UID) {
        int callingUid = Binder.getCallingUid();
        if (callingUid != android.os.Process.SYSTEM_UID) {
            Log.e(TAG, "setMicrophoneMuteFromSwitch() called from non system user!");
            return;
        }
        mMicMuteFromSwitch = on;
        new MediaMetrics.Item(MediaMetrics.Name.AUDIO_MIC)
                .setUid(userId)
                .setUid(callingUid)
                .set(MediaMetrics.Property.EVENT, "setMicrophoneMuteFromSwitch")
                .set(MediaMetrics.Property.REQUEST, on
                        ? MediaMetrics.Value.MUTE : MediaMetrics.Value.UNMUTE)
                .record();
        setMicrophoneMuteNoCallerCheck(userId);
        setMicrophoneMuteNoCallerCheck(UserHandle.getCallingUserId());
    }
    private void setMicMuteFromSwitchInput() {
@@ -5507,9 +5507,10 @@ public class AudioService extends IAudioService.Stub
        if (DEBUG_VOL) {
            Log.d(TAG, String.format("Mic mute %b, user=%d", muted, userId));
        }
        // only mute for the current user
        if (getCurrentUserId() == userId || userId == android.os.Process.SYSTEM_UID) {
        // only mute for the current user or for the system user.
        if (getCurrentUserId() == userId || userId == UserHandle.USER_SYSTEM) {
            final boolean currentMute = mAudioSystem.isMicrophoneMuted();
            int callingUid = Binder.getCallingUid();
            final long identity = Binder.clearCallingIdentity();
            try {
                final int ret = mAudioSystem.muteMicrophone(muted);
@@ -5522,7 +5523,7 @@ public class AudioService extends IAudioService.Stub
                }
                new MediaMetrics.Item(MediaMetrics.Name.AUDIO_MIC)
                        .setUid(userId)
                        .setUid(callingUid)
                        .set(MediaMetrics.Property.EVENT, "setMicrophoneMuteNoCallerCheck")
                        .set(MediaMetrics.Property.MUTE, mMicMuteFromSystemCached
                                ? MediaMetrics.Value.ON : MediaMetrics.Value.OFF)