diff options
author | xianming wang <mingwax@codeaurora.org> | 2018-12-07 16:21:50 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-12-14 00:23:49 -0800 |
commit | 0f08a06d6d4167f3d034bff685ee3da296760baa (patch) | |
tree | 700e3216cb63154ae19839bfcd08f97ec075fdd2 /src | |
parent | 07d7d91f8e6afca1cda50c6f0d63120518a26a57 (diff) | |
download | android_packages_apps_Snap-0f08a06d6d4167f3d034bff685ee3da296760baa.tar.gz android_packages_apps_Snap-0f08a06d6d4167f3d034bff685ee3da296760baa.tar.bz2 android_packages_apps_Snap-0f08a06d6d4167f3d034bff685ee3da296760baa.zip |
SnapdragonCamera: Fix mSoundPool is NULL and load resource slowly
Init the SouldPool when the mCountDownView is not NULL and the
SoundPool is NULL.
CRs-Fixed: 2360653
Change-Id: I913bbd0c8b190a2a73d0d0123ffa8753d4ec9f91
Diffstat (limited to 'src')
-rwxr-xr-x | src/com/android/camera/CaptureUI.java | 6 | ||||
-rwxr-xr-x | src/com/android/camera/ui/CountDownView.java | 22 |
2 files changed, 12 insertions, 16 deletions
diff --git a/src/com/android/camera/CaptureUI.java b/src/com/android/camera/CaptureUI.java index 85ac9e293..c5875327d 100755 --- a/src/com/android/camera/CaptureUI.java +++ b/src/com/android/camera/CaptureUI.java @@ -1551,7 +1551,11 @@ public class CaptureUI implements FocusOverlayManager.FocusUI, } public void initCountDownView() { - if (mCountDownView == null) initializeCountDown(); + if (mCountDownView == null) { + initializeCountDown(); + } else { + mCountDownView.initSoundPool(); + } } public void releaseSoundPool() { diff --git a/src/com/android/camera/ui/CountDownView.java b/src/com/android/camera/ui/CountDownView.java index f62c99958..0e1acc080 100755 --- a/src/com/android/camera/ui/CountDownView.java +++ b/src/com/android/camera/ui/CountDownView.java @@ -55,15 +55,19 @@ public class CountDownView extends FrameLayout { mContext = context; mCountDownAnim = AnimationUtils.loadAnimation(context, R.anim.count_down_exit); + initSoundPool(); + } + + public void initSoundPool() { if (mSoundPool == null) { // Load the beeps - if (context.getResources().getBoolean(R.bool.force_count_down_sound)) { + 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(context, R.raw.beep_once, 1); - mBeepTwice = mSoundPool.load(context, R.raw.beep_twice, 1); + mBeepOnce = mSoundPool.load(mContext, R.raw.beep_once, 1); + mBeepTwice = mSoundPool.load(mContext, R.raw.beep_twice, 1); } } @@ -98,18 +102,6 @@ public class CountDownView extends FrameLayout { mCountDownAnim.reset(); 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 && mSoundPool != null) { if (newVal == 1) { |