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

Commit 4ced7193 authored by Yasuhiro Matsuda's avatar Yasuhiro Matsuda
Browse files

Do not broadcast ACTION_AUDIO_BECOMING_NOISY on first boot.

This is for improving boot time by avoiding launch of
unnecessary processes (e.g com.google.android.apps.magazines)
during boot time.
Boot time is reduced by 100~200 ms on Nexus 9.

BUG: 22163689
Change-Id: Iaf373f6a5458c266100a5298b7096bbbd4ff42c2
parent 39ed6e76
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -477,6 +477,8 @@ public class AudioService extends IAudioService.Stub {

    // true if boot sequence has been completed
    private boolean mSystemReady;
    // true if Intent.ACTION_USER_SWITCHED has ever been received
    private boolean mUserSwitchedReceived;
    // listener for SoundPool sample load completion indication
    private SoundPoolCallback mSoundPoolCallBack;
    // thread for SoundPool listener
@@ -5059,7 +5061,9 @@ public class AudioService extends IAudioService.Stub {
            } else if (action.equals(Intent.ACTION_CONFIGURATION_CHANGED)) {
                handleConfigurationChanged(context);
            } else if (action.equals(Intent.ACTION_USER_SWITCHED)) {
                // attempt to stop music playback for background user
                if (mUserSwitchedReceived) {
                    // attempt to stop music playback for background user except on first user
                    // switch (i.e. first boot)
                    sendMsg(mAudioHandler,
                            MSG_BROADCAST_AUDIO_BECOMING_NOISY,
                            SENDMSG_REPLACE,
@@ -5067,6 +5071,8 @@ public class AudioService extends IAudioService.Stub {
                            0,
                            null,
                            0);
                }
                mUserSwitchedReceived = true;
                // the current audio focus owner is no longer valid
                mMediaFocusControl.discardAudioFocusOwner();