From de0d9e38080ce5f9ea8637da66b22e0d4fe62d16 Mon Sep 17 00:00:00 2001 From: wumin3 Date: Tue, 28 Jun 2022 19:46:16 +0800 Subject: [PATCH] NotificationPlayer: use AUDIOFOCUS_GAIN_TRANSIENT instead of AUDIOFOCUS_GAIN in looping mode A voip app will usually use notification with FLAG_INSISTENT when a new voip call comes, if the duration hint was AUDIOFOCUS_GAIN the music app will not continue after the voip call end. Signed-off-by: wumin3 Change-Id: I6270bb08181b8fb94c84ec0f69bd226f3a7d0f01 --- .../src/com/android/systemui/media/NotificationPlayer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java b/packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java index a617850ef0ae8..f8f784ff948c5 100644 --- a/packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java +++ b/packages/SystemUI/src/com/android/systemui/media/NotificationPlayer.java @@ -112,7 +112,7 @@ public class NotificationPlayer implements OnCompletionListener, OnErrorListener if (DEBUG) Log.d(mTag, "requesting AudioFocus"); int focusGain = AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK; if (mCmd.looping) { - focusGain = AudioManager.AUDIOFOCUS_GAIN; + focusGain = AudioManager.AUDIOFOCUS_GAIN_TRANSIENT; } mNotificationRampTimeMs = audioManager.getFocusRampTimeMs( focusGain, mCmd.attributes);