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

Commit a07aa3c4 authored by Jason Simmons's avatar Jason Simmons Committed by Mike Lockwood
Browse files

Add an option that disables the AUDIO_BECOMING_NOISY intent send when a headset is hotplugged.

HDMI audio hotplug is treated as a "headset" in the audio services.  When a headset is unplugged,
WiredAccessoryObserver sends an AUDIO_BECOMING_NOISY broadcast so that applications can take
appropriate action (e.g. pausing audio if headphones were unplugged).

However, on Tungsten, when you unplug HDMI audio, the Music2 service was getting the NOISY intent
and pausing the transmitter media player.  We could add Tungsten-specific code to Music2 to
disable this behavior, but it's probably better to disable this broadcast entirely because
applications on Tungsten probably shouldn't treat HDMI hotplug in the same way they treat
headphone hotplug on phones.
parent 3194ea94
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -65,6 +65,10 @@
         master volume stream and nothing else . -->
    <bool name="config_useMasterVolume">false</bool>

    <!-- Flag indicating whether the AUDIO_BECOMING_NOISY notification should
         be sent during an change to the audio output device. -->
    <bool name="config_sendAudioBecomingNoisy">true</bool>

    <!-- The duration (in milliseconds) of a short animation. -->
    <integer name="config_shortAnimTime">200</integer>

+1 −0
Original line number Diff line number Diff line
@@ -236,6 +236,7 @@
  <java-symbol type="bool" name="split_action_bar_is_narrow" />
  <java-symbol type="bool" name="config_useMasterVolume" />
  <java-symbol type="bool" name="config_enableWallpaperService" />
  <java-symbol type="bool" name="config_sendAudioBecomingNoisy" />

  <java-symbol type="integer" name="config_cursorWindowSize" />
  <java-symbol type="integer" name="config_longPressOnPowerBehavior" />
+6 −2
Original line number Diff line number Diff line
@@ -191,8 +191,12 @@ class WiredAccessoryObserver extends UEventObserver {
        mHeadsetState = headsetState;

        if (headsetState == 0) {
            if (mContext.getResources().getBoolean(
                    com.android.internal.R.bool.config_sendAudioBecomingNoisy)) {
                Intent intent = new Intent(AudioManager.ACTION_AUDIO_BECOMING_NOISY);
                mContext.sendBroadcast(intent);
            }

            // It can take hundreds of ms flush the audio pipeline after
            // apps pause audio playback, but audio route changes are
            // immediate, so delay the route change by 1000ms.