summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjuwei <juwei@codeaurora.org>2016-12-22 09:53:41 +0800
committerArne Coucheron <arco68@gmail.com>2017-06-13 07:16:37 +0200
commit3de435d905d4b94714fe858cdb891f8a5e7e9634 (patch)
tree5a2504001f4fa67895b77a232a33a41052b7bba0
parentf8703933e5f433ed95b5e87c2e6b20e6905205af (diff)
downloadandroid_packages_apps_Snap-3de435d905d4b94714fe858cdb891f8a5e7e9634.zip
android_packages_apps_Snap-3de435d905d4b94714fe858cdb891f8a5e7e9634.tar.gz
android_packages_apps_Snap-3de435d905d4b94714fe858cdb891f8a5e7e9634.tar.bz2
SnapdragonCamera: Fix crash during UI stress test
CaptureModule and CaptureUI have register listeners in SettingsManager, but forget unregiseter when UI destroy. This makes the too many RenderNode objects exist and never GC. At last, the weak reference of RenderNode at native layer exceed the 51200 limitation and crash. Unregister the listener of SettingsManager will fix it. Change-Id: I2aca795c813177fd34ed18e88f5c9b929a749bff CRs-Fixed: 1103907
-rw-r--r--src/com/android/camera/CameraActivity.java3
-rw-r--r--[-rwxr-xr-x]src/com/android/camera/CaptureModule.java5
-rw-r--r--src/com/android/camera/SettingsManager.java4
3 files changed, 12 insertions, 0 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 045e771..acbf048 100644
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -1831,6 +1831,9 @@ public class CameraActivity extends Activity
mCursor.close();
mCursor=null;
}
+ if (mCaptureModule != null){
+ mCaptureModule.unRegisterSettingsListener();
+ }
if (mDataAdapter != null) {
mDataAdapter.stopLoading();
}
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index 041e19b..b6968f6 100755..100644
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -640,6 +640,11 @@ public class CaptureModule extends BaseModule<CaptureUI> implements PhotoControl
}
}
+ public void unRegisterSettingsListener(){
+ mSettingsManager.unregisterListener(this);
+ mSettingsManager.unregisterListener(mUI);
+ }
+
public void startFaceDetection() {
mUI.onStartFaceDetection(mDisplayOrientation,
mSettingsManager.isFacingFront(getMainCameraId()),
diff --git a/src/com/android/camera/SettingsManager.java b/src/com/android/camera/SettingsManager.java
index 263575c..c242224 100644
--- a/src/com/android/camera/SettingsManager.java
+++ b/src/com/android/camera/SettingsManager.java
@@ -379,6 +379,10 @@ public class SettingsManager implements ListMenu.SettingsListener {
mListeners.add(listener);
}
+ public void unregisterListener(Listener listener) {
+ mListeners.remove(listener);
+ }
+
private void notifyListeners(List<SettingState> changes) {
for (Listener listener : mListeners) {
listener.onSettingsChanged(changes);