summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLikai Ding <likaid@codeaurora.org>2015-05-11 15:42:02 +0800
committerSteve Kondik <steve@cyngn.com>2016-07-30 05:05:25 -0700
commit118b54cf80eedcc31b1d296b403e0f774a45f677 (patch)
tree8e2eecb131b902f1c7b9378c70485f7a05bdd5da
parenteb60e2efbbae8d132ef610741c1160dd238bb1ac (diff)
downloadandroid_packages_apps_Snap-118b54cf80eedcc31b1d296b403e0f774a45f677.zip
android_packages_apps_Snap-118b54cf80eedcc31b1d296b403e0f774a45f677.tar.gz
android_packages_apps_Snap-118b54cf80eedcc31b1d296b403e0f774a45f677.tar.bz2
SnapdragonCamera: fix crash after photo deletion
In FilmStripView.reload(), camera view is unintentionally removed, which causes unnecessary surface creation and deletion, eventually leads to crash. Fix the check in FilmStripView and set mCameraView correctly. Change-Id: I11efbe52b7639a98798ff16e9281b8799cc5e788
-rw-r--r--src/com/android/camera/ui/FilmStripView.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/com/android/camera/ui/FilmStripView.java b/src/com/android/camera/ui/FilmStripView.java
index 3edb23d..01469ba 100644
--- a/src/com/android/camera/ui/FilmStripView.java
+++ b/src/com/android/camera/ui/FilmStripView.java
@@ -2036,17 +2036,18 @@ public class FilmStripView extends ViewGroup implements BottomControlsListener {
}
// Remove all views from the mViewItem buffer, except the camera view.
- for (int i = 0; i < mViewItem.length; i++) {
- if (mViewItem[i] == null) {
- continue;
- }
- View v = mViewItem[i].getView();
- if (v != mCameraView) {
- removeView(v);
- }
- ImageData imageData = mDataAdapter.getImageData(mViewItem[i].getId());
- if (imageData != null) {
- imageData.recycle();
+ for (final ViewItem item : mViewItem) {
+ if (item != null) {
+ ImageData imageData = mDataAdapter.getImageData(item.getId());
+ if (imageData != null) {
+ imageData.recycle();
+ View v = item.getView();
+ if (imageData.getViewType() != ImageData.VIEW_TYPE_STICKY) {
+ removeView(v);
+ } else {
+ mCameraView = v;
+ }
+ }
}
}