diff options
author | Jean-Michel Trivi <jmtrivi@google.com> | 2019-02-28 12:35:21 -0800 |
---|---|---|
committer | Michael Bestas <mkbestas@lineageos.org> | 2019-11-09 22:47:37 +0200 |
commit | 496d5e0052fcb85f3c1053fb585b52fa10fdee88 (patch) | |
tree | c713bc7679ead930028a2b433827211a8f8e6fc6 /src/com/android/camera/ui | |
parent | feb3d9fdd62e08b27be4e0c578c90c0f33712947 (diff) | |
download | android_packages_apps_Snap-496d5e0052fcb85f3c1053fb585b52fa10fdee88.tar.gz android_packages_apps_Snap-496d5e0052fcb85f3c1053fb585b52fa10fdee88.tar.bz2 android_packages_apps_Snap-496d5e0052fcb85f3c1053fb585b52fa10fdee88.zip |
Fix use of deprecated SoundPool API in Snap
Don't use stream types for operations other than volume control
[Chippa_a]: Extended for Snap
Bug: 122901916
Test: verify logcat doesn't show warnings, see bug
Change-Id: Id5b4f3b3c56c61a2f00172a470410e0670ce81b4
Signed-off-by: Chippa-a <vusal1372@gmail.com>
Diffstat (limited to 'src/com/android/camera/ui')
-rwxr-xr-x | src/com/android/camera/ui/CountDownView.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/com/android/camera/ui/CountDownView.java b/src/com/android/camera/ui/CountDownView.java index 0e1acc080..069d0b3d8 100755 --- a/src/com/android/camera/ui/CountDownView.java +++ b/src/com/android/camera/ui/CountDownView.java @@ -20,6 +20,7 @@ import java.util.Locale; import android.content.Context; import android.content.res.Configuration; +import android.media.AudioAttributes; import android.media.AudioManager; import android.media.SoundPool; import android.os.Handler; @@ -62,9 +63,22 @@ public class CountDownView extends FrameLayout { if (mSoundPool == null) { // Load the beeps if (mContext.getResources().getBoolean(R.bool.force_count_down_sound)) { - mSoundPool = new SoundPool(1, AudioManager.STREAM_SYSTEM_ENFORCED, 0); + mSoundPool = new SoundPool.Builder() + .setMaxStreams(1) + .setAudioAttributes(new AudioAttributes.Builder() + .setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION) + .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION) + .setFlags(AudioAttributes.FLAG_AUDIBILITY_ENFORCED) + .build()) + .build(); } else { - mSoundPool = new SoundPool(1, AudioManager.STREAM_NOTIFICATION, 0); + mSoundPool = new SoundPool.Builder() + .setMaxStreams(1) + .setAudioAttributes(new AudioAttributes.Builder() + .setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION) + .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION) + .build()) + .build(); } mBeepOnce = mSoundPool.load(mContext, R.raw.beep_once, 1); mBeepTwice = mSoundPool.load(mContext, R.raw.beep_twice, 1); |