summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui
diff options
context:
space:
mode:
authorJay Wang <jaywang@codeaurora.org>2015-11-12 18:19:12 -0800
committerJay Wang <jaywang@codeaurora.org>2015-11-13 14:26:17 -0800
commit9876bd89124c3222214e0a16a0a92291ac51cc7d (patch)
tree4322d3a60ee1ed2f10a1f4576d1d73d527afc7c4 /src/com/android/camera/ui
parenta147f0379f75535529a27a5da0974f57aba5a358 (diff)
downloadandroid_packages_apps_Snap-9876bd89124c3222214e0a16a0a92291ac51cc7d.tar.gz
android_packages_apps_Snap-9876bd89124c3222214e0a16a0a92291ac51cc7d.tar.bz2
android_packages_apps_Snap-9876bd89124c3222214e0a16a0a92291ac51cc7d.zip
SnapdragonCamera: Fix the issue SoundPoolThread is not released
Two SoundPool objects are created during onCreate. However, the SoundPool is not released or re-used, properly and app continuously creating the new one. Fixing the issue for shutter button SoundPool by adding the releasing call and changing the call flow so it gets created and released during onPause and onResume. For count down SoundPool, we just re-use the existing SoundPool object instead of creating the new one. CRs-Fixed: 939366 Change-Id: I8ff1d62ce7b0e217df29ded92c9a07b02bf0ffbb
Diffstat (limited to 'src/com/android/camera/ui')
-rw-r--r--src/com/android/camera/ui/CountDownView.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/com/android/camera/ui/CountDownView.java b/src/com/android/camera/ui/CountDownView.java
index c8d7174b1..6420fd2c3 100644
--- a/src/com/android/camera/ui/CountDownView.java
+++ b/src/com/android/camera/ui/CountDownView.java
@@ -44,9 +44,9 @@ public class CountDownView extends FrameLayout {
private int mRemainingSecs = 0;
private OnCountDownFinishedListener mListener;
private Animation mCountDownAnim;
- private SoundPool mSoundPool;
- private int mBeepTwice;
- private int mBeepOnce;
+ private static SoundPool mSoundPool;
+ private static int mBeepTwice;
+ private static int mBeepOnce;
private boolean mPlaySound;
private final Handler mHandler = new MainHandler();
@@ -54,14 +54,17 @@ public class CountDownView extends FrameLayout {
super(context, attrs);
mContext = context;
mCountDownAnim = AnimationUtils.loadAnimation(context, R.anim.count_down_exit);
- // Load the beeps
- if (context.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);
+
+ if (mSoundPool == null) {
+ // Load the beeps
+ if (context.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(context, R.raw.beep_once, 1);
- mBeepTwice = mSoundPool.load(context, R.raw.beep_twice, 1);
}
public boolean isCountingDown() {