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

Commit c14c66db authored by Jean-Michel Trivi's avatar Jean-Michel Trivi
Browse files

AudioService: log reason for shouldNotificationSoundPlay false

Always log reasons for why shouldNotificationSoundPlay returns
false, indicating why a notification shouldn't play.

Bug: 337199618
Test: atest android.media.audio.cts.AudioFocusTest#testAudioFocusExclusive
Change-Id: Ia3dcea82bfcb89930cbea635e9d1adeb53f33901
parent 540ec19e
Loading
Loading
Loading
Loading
+4 −7
Original line number Original line Diff line number Diff line
@@ -13911,9 +13911,8 @@ public class AudioService extends IAudioService.Stub
        final int stream = AudioAttributes.toLegacyStreamType(aa);
        final int stream = AudioAttributes.toLegacyStreamType(aa);
        final boolean mutingFromVolume = getStreamVolume(stream) == 0;
        final boolean mutingFromVolume = getStreamVolume(stream) == 0;
        if (mutingFromVolume) {
        if (mutingFromVolume) {
            if (DEBUG_VOL) {
            Slog.i(TAG, "shouldNotificationSoundPlay false: muted stream:" + stream
                Slog.d(TAG, "notification should not play due to muted stream " + stream);
                    + " attr:" + aa);
            }
            return false;
            return false;
        }
        }
@@ -13926,10 +13925,8 @@ public class AudioService extends IAudioService.Stub
        // is the owner of GAIN_TRANSIENT_EXCLUSIVE focus also recording?
        // is the owner of GAIN_TRANSIENT_EXCLUSIVE focus also recording?
        final boolean mutingFromFocusAndRecording = mRecordMonitor.isRecordingActiveForUid(uid);
        final boolean mutingFromFocusAndRecording = mRecordMonitor.isRecordingActiveForUid(uid);
        if (mutingFromFocusAndRecording) {
        if (mutingFromFocusAndRecording) {
            if (DEBUG_VOL) {
            Slog.i(TAG, "shouldNotificationSoundPlay false: exclusive focus owner recording "
                Slog.d(TAG, "notification should not play due to exclusive focus owner recording "
                        + " uid:" + uid + " attr:" + aa);
                        + " uid:" + uid);
            }
            return false;
            return false;
        }
        }
        return true;
        return true;