diff options
author | junjiez <junjiez@codeaurora.org> | 2018-11-27 16:18:14 +0800 |
---|---|---|
committer | junjiez <junjiez@codeaurora.org> | 2018-11-27 16:18:14 +0800 |
commit | ff0e747b7a76f221ed7a1062d58a8498a02bd7cb (patch) | |
tree | c1a9e0f8f203de20357b792eb70575bc408bedf6 /src/com/android/camera/ui | |
parent | 78b730055695188e43819ddf108b63021c9d7d7c (diff) | |
download | android_packages_apps_Snap-ff0e747b7a76f221ed7a1062d58a8498a02bd7cb.tar.gz android_packages_apps_Snap-ff0e747b7a76f221ed7a1062d58a8498a02bd7cb.tar.bz2 android_packages_apps_Snap-ff0e747b7a76f221ed7a1062d58a8498a02bd7cb.zip |
SnapdraongCamera:Fix CountDown sound
Recreate the sound pool when it's null
to avoid error.
Change-Id: Iefb89c7fe910bdf0fbaa44317c17a74b88350d75
CRs-Fixed: 2356413
Diffstat (limited to 'src/com/android/camera/ui')
-rwxr-xr-x | src/com/android/camera/ui/CountDownView.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/com/android/camera/ui/CountDownView.java b/src/com/android/camera/ui/CountDownView.java index d9d0244e5..f62c99958 100755 --- a/src/com/android/camera/ui/CountDownView.java +++ b/src/com/android/camera/ui/CountDownView.java @@ -99,8 +99,19 @@ public class CountDownView extends FrameLayout { mRemainingSecondsView.clearAnimation(); mRemainingSecondsView.startAnimation(mCountDownAnim); + 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); + } else { + mSoundPool = new SoundPool(1, AudioManager.STREAM_NOTIFICATION, 0); + } + mBeepOnce = mSoundPool.load(mContext, R.raw.beep_once, 1); + mBeepTwice = mSoundPool.load(mContext, R.raw.beep_twice, 1); + } + // Play sound effect for the last 3 seconds of the countdown - if (mPlaySound) { + if (mPlaySound && mSoundPool != null) { if (newVal == 1) { mSoundPool.play(mBeepTwice, 1.0f, 1.0f, 0, 0, 1.0f); } else if (newVal <= 3) { |