summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui
diff options
context:
space:
mode:
authorxianming wang <mingwax@codeaurora.org>2018-12-07 16:21:50 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2018-12-14 00:23:49 -0800
commit0f08a06d6d4167f3d034bff685ee3da296760baa (patch)
tree700e3216cb63154ae19839bfcd08f97ec075fdd2 /src/com/android/camera/ui
parent07d7d91f8e6afca1cda50c6f0d63120518a26a57 (diff)
downloadandroid_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/com/android/camera/ui')
-rwxr-xr-xsrc/com/android/camera/ui/CountDownView.java22
1 files changed, 7 insertions, 15 deletions
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) {