From 0616db4746f16a3102b39ef9df57e06fb859daef Mon Sep 17 00:00:00 2001 From: Jean-Michel Trivi Date: Mon, 28 Jan 2019 10:57:21 -0800 Subject: [PATCH] Fix use of deprecated SoundPool API in Keyguard Don't use stream types for operations other than volume control. Bug: 122901916 Test: verify logcat doesn't show warnings, see bug Change-Id: I46143e53978226f6f660c92e85e7b0b1b0a37622 --- .../systemui/keyguard/KeyguardViewMediator.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index f14495bb959d4..4527f73ab118d 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -40,6 +40,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.pm.UserInfo; import android.hardware.biometrics.BiometricSourceType; +import android.media.AudioAttributes; import android.media.AudioManager; import android.media.SoundPool; import android.os.Bundle; @@ -750,7 +751,14 @@ public class KeyguardViewMediator extends SystemUI { mDeviceInteractive = mPM.isInteractive(); - mLockSounds = new SoundPool(1, AudioManager.STREAM_SYSTEM, 0); + mLockSounds = new SoundPool.Builder() + .setMaxStreams(1) + .setAudioAttributes( + new AudioAttributes.Builder() + .setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION) + .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION) + .build()) + .build(); String soundPath = Settings.Global.getString(cr, Settings.Global.LOCK_SOUND); if (soundPath != null) { mLockSoundId = mLockSounds.load(soundPath, 1);