Loading services/core/java/com/android/server/audio/AudioDeviceBroker.java +4 −0 Original line number Diff line number Diff line Loading @@ -406,6 +406,10 @@ import java.util.ArrayList; mAudioService.checkVolumeCecOnHdmiConnection(state, caller); } /*package*/ boolean hasAudioFocusUsers() { return mAudioService.hasAudioFocusUsers(); } //--------------------------------------------------------------------- // Message handling on behalf of helper classes /*package*/ void postBroadcastScoConnectionState(int state) { Loading services/core/java/com/android/server/audio/AudioDeviceInventory.java +3 −2 Original line number Diff line number Diff line Loading @@ -819,11 +819,12 @@ public final class AudioDeviceInventory { if (((device == musicDevice) || mDeviceBroker.isInCommunication()) && (device == devices) && !mDeviceBroker.hasMediaDynamicPolicy() && ((musicDevice & AudioSystem.DEVICE_OUT_REMOTE_SUBMIX) == 0)) { if (!AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC, 0 /*not looking in past*/)) { if (!AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC, 0 /*not looking in past*/) && !mDeviceBroker.hasAudioFocusUsers()) { // no media playback, not a "becoming noisy" situation, otherwise it could cause // the pausing of some apps that are playing remotely AudioService.sDeviceLogger.log((new AudioEventLogger.StringEvent( "dropping ACTION_AUDIO_BECOMING_NOISY, no media playback")).printLog(TAG)); "dropping ACTION_AUDIO_BECOMING_NOISY")).printLog(TAG)); return 0; } mDeviceBroker.postBroadcastBecomingNoisy(); Loading services/core/java/com/android/server/audio/AudioService.java +4 −0 Original line number Diff line number Diff line Loading @@ -5580,6 +5580,10 @@ public class AudioService extends IAudioService.Stub return mMediaFocusControl.getFocusRampTimeMs(focusGain, attr); } /*package*/ boolean hasAudioFocusUsers() { return mMediaFocusControl.hasAudioFocusUsers(); } //========================================================================================== private boolean readCameraSoundForced() { return SystemProperties.getBoolean("audio.camerasound.force", false) || Loading services/core/java/com/android/server/audio/MediaFocusControl.java +6 −0 Original line number Diff line number Diff line Loading @@ -162,6 +162,12 @@ public class MediaFocusControl implements PlayerFocusEnforcer { } } /*package*/ boolean hasAudioFocusUsers() { synchronized (mAudioFocusLock) { return !mFocusStack.empty(); } } /** * Discard the current audio focus owner. * Notify top of audio focus stack that it lost focus (regardless of possibility to reassign Loading Loading
services/core/java/com/android/server/audio/AudioDeviceBroker.java +4 −0 Original line number Diff line number Diff line Loading @@ -406,6 +406,10 @@ import java.util.ArrayList; mAudioService.checkVolumeCecOnHdmiConnection(state, caller); } /*package*/ boolean hasAudioFocusUsers() { return mAudioService.hasAudioFocusUsers(); } //--------------------------------------------------------------------- // Message handling on behalf of helper classes /*package*/ void postBroadcastScoConnectionState(int state) { Loading
services/core/java/com/android/server/audio/AudioDeviceInventory.java +3 −2 Original line number Diff line number Diff line Loading @@ -819,11 +819,12 @@ public final class AudioDeviceInventory { if (((device == musicDevice) || mDeviceBroker.isInCommunication()) && (device == devices) && !mDeviceBroker.hasMediaDynamicPolicy() && ((musicDevice & AudioSystem.DEVICE_OUT_REMOTE_SUBMIX) == 0)) { if (!AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC, 0 /*not looking in past*/)) { if (!AudioSystem.isStreamActive(AudioSystem.STREAM_MUSIC, 0 /*not looking in past*/) && !mDeviceBroker.hasAudioFocusUsers()) { // no media playback, not a "becoming noisy" situation, otherwise it could cause // the pausing of some apps that are playing remotely AudioService.sDeviceLogger.log((new AudioEventLogger.StringEvent( "dropping ACTION_AUDIO_BECOMING_NOISY, no media playback")).printLog(TAG)); "dropping ACTION_AUDIO_BECOMING_NOISY")).printLog(TAG)); return 0; } mDeviceBroker.postBroadcastBecomingNoisy(); Loading
services/core/java/com/android/server/audio/AudioService.java +4 −0 Original line number Diff line number Diff line Loading @@ -5580,6 +5580,10 @@ public class AudioService extends IAudioService.Stub return mMediaFocusControl.getFocusRampTimeMs(focusGain, attr); } /*package*/ boolean hasAudioFocusUsers() { return mMediaFocusControl.hasAudioFocusUsers(); } //========================================================================================== private boolean readCameraSoundForced() { return SystemProperties.getBoolean("audio.camerasound.force", false) || Loading
services/core/java/com/android/server/audio/MediaFocusControl.java +6 −0 Original line number Diff line number Diff line Loading @@ -162,6 +162,12 @@ public class MediaFocusControl implements PlayerFocusEnforcer { } } /*package*/ boolean hasAudioFocusUsers() { synchronized (mAudioFocusLock) { return !mFocusStack.empty(); } } /** * Discard the current audio focus owner. * Notify top of audio focus stack that it lost focus (regardless of possibility to reassign Loading