summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/PhotoModule.java
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/PhotoModule.java
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/PhotoModule.java')
-rw-r--r--src/com/android/camera/PhotoModule.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index d9087a281..d9c468b88 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -519,9 +519,6 @@ public class PhotoModule
brightnessProgressBar.setVisibility(View.INVISIBLE);
Storage.setSaveSDCard(
mPreferences.getString(CameraSettings.KEY_CAMERA_SAVEPATH, "0").equals("1"));
-
- mSoundPool = new SoundPool(1, AudioManager.STREAM_NOTIFICATION, 0);
- mRefocusSound = mSoundPool.load(mActivity, R.raw.camera_click_x5, 1);
}
private void initializeControlByIntent() {
@@ -2243,6 +2240,12 @@ public class PhotoModule
Log.v(TAG, "On resume.");
onResumeTasks();
}
+
+ if (mSoundPool == null) {
+ mSoundPool = new SoundPool(1, AudioManager.STREAM_NOTIFICATION, 0);
+ mRefocusSound = mSoundPool.load(mActivity, R.raw.camera_click_x5, 1);
+ }
+
mHandler.post(new Runnable(){
@Override
public void run(){
@@ -2320,6 +2323,11 @@ public class PhotoModule
mSensorManager.unregisterListener(this, msensor);
}
+ if (mSoundPool != null) {
+ mSoundPool.release();
+ mSoundPool = null;
+ }
+
Log.d(TAG, "remove idle handleer in onPause");
removeIdleHandler();
}