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

Commit ffa845d1 authored by Tyler Gunn's avatar Tyler Gunn Committed by android-build-merger
Browse files

Merge "New intent for microphone mute change notification"

am: d34cd5eb

Change-Id: I6435148922148d340e8a4b8bd7cf431661202d42
parents b70f2a18 d34cd5eb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -21435,6 +21435,7 @@ package android.media {
    field public static final java.lang.String ACTION_AUDIO_BECOMING_NOISY = "android.media.AUDIO_BECOMING_NOISY";
    field public static final java.lang.String ACTION_HDMI_AUDIO_PLUG = "android.media.action.HDMI_AUDIO_PLUG";
    field public static final java.lang.String ACTION_HEADSET_PLUG = "android.intent.action.HEADSET_PLUG";
    field public static final java.lang.String ACTION_MICROPHONE_MUTE_CHANGED = "android.media.action.MICROPHONE_MUTE_CHANGED";
    field public static final deprecated java.lang.String ACTION_SCO_AUDIO_STATE_CHANGED = "android.media.SCO_AUDIO_STATE_CHANGED";
    field public static final java.lang.String ACTION_SCO_AUDIO_STATE_UPDATED = "android.media.ACTION_SCO_AUDIO_STATE_UPDATED";
    field public static final int ADJUST_LOWER = -1; // 0xffffffff
+15 −0
Original line number Diff line number Diff line
@@ -1551,6 +1551,21 @@ public class AudioManager {
        return AudioSystem.isMicrophoneMuted();
    }

    /**
     * Broadcast Action: microphone muting state changed.
     *
     * You <em>cannot</em> receive this through components declared
     * in manifests, only by explicitly registering for it with
     * {@link Context#registerReceiver(BroadcastReceiver, IntentFilter)
     * Context.registerReceiver()}.
     *
     * <p>The intent has no extra values, use {@link #isMicrophoneMute} to check whether the
     * microphone is muted.
     */
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_MICROPHONE_MUTE_CHANGED =
            "android.media.action.MICROPHONE_MUTE_CHANGED";

    /**
     * Sets the audio mode.
     * <p>
+6 −3
Original line number Diff line number Diff line
@@ -2240,12 +2240,15 @@ public class AudioService extends IAudioService.Stub
        if (DEBUG_VOL) {
            Log.d(TAG, String.format("Mic mute %s, user=%d", on, userId));
        }
        // If mute is for current user actually mute, else just persist the setting
        // which will be loaded on user switch.
        // only mute for the current user
        if (getCurrentUserId() == userId) {
            final boolean currentMute = AudioSystem.isMicrophoneMuted();
            AudioSystem.muteMicrophone(on);
            if (on != currentMute) {
                mContext.sendBroadcast(new Intent(AudioManager.ACTION_MICROPHONE_MUTE_CHANGED)
                        .setFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY));
            }
        }
        // Post a persist microphone msg.
    }

    @Override