diff options
author | Kedi Xu <kedix@codeaurora.org> | 2016-09-14 11:30:29 +0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-09-13 21:45:32 -0700 |
commit | 93a918280a5a186620eb7cbffe9dafdf58116632 (patch) | |
tree | b1fc519601481138e7af775b42126fa78ecad546 /src | |
parent | 3dc4ea8d1b31ac57c198ff7ba6704c84175d9d0e (diff) | |
download | android_packages_apps_Gallery2-93a918280a5a186620eb7cbffe9dafdf58116632.tar.gz android_packages_apps_Gallery2-93a918280a5a186620eb7cbffe9dafdf58116632.tar.bz2 android_packages_apps_Gallery2-93a918280a5a186620eb7cbffe9dafdf58116632.zip |
SnapdragonGallery: Fix OOM when enter from camera delete last picture
When enter from camera and delete the last picture, gallery will OOM.
Change-Id: If468a8e6644a46ad2f06010ef3064ddf0ddf2e79
CRs-Fixed: 1063842
Signed-off-by: Kedi Xu <kedix@codeaurora.org>
Diffstat (limited to 'src')
-rwxr-xr-x | src/com/android/gallery3d/app/PhotoDataAdapter.java | 12 | ||||
-rwxr-xr-x | src/com/android/gallery3d/app/PhotoPage.java | 3 | ||||
-rwxr-xr-x[-rw-r--r--] | src/com/android/gallery3d/data/ClusterAlbumSet.java | 2 |
3 files changed, 3 insertions, 14 deletions
diff --git a/src/com/android/gallery3d/app/PhotoDataAdapter.java b/src/com/android/gallery3d/app/PhotoDataAdapter.java index 36bde4dbd..baece7023 100755 --- a/src/com/android/gallery3d/app/PhotoDataAdapter.java +++ b/src/com/android/gallery3d/app/PhotoDataAdapter.java @@ -162,7 +162,6 @@ public class PhotoDataAdapter implements PhotoPage.Model { private int mCameraIndex; private boolean mIsPanorama; private boolean mIsStaticCamera; - private boolean mIsFromTimelineScreen; private boolean mIsActive; private boolean mNeedFullImage; private int mFocusHintDirection = FOCUS_HINT_NEXT; @@ -188,7 +187,7 @@ public class PhotoDataAdapter implements PhotoPage.Model { // preview. If cameraIndex < 0, there is no camera preview. public PhotoDataAdapter(AbstractGalleryActivity activity, PhotoView view, MediaSet mediaSet, Path itemPath, int indexHint, int cameraIndex, - boolean isPanorama, boolean isStaticCamera, boolean isFromTimelineScreen) { + boolean isPanorama, boolean isStaticCamera) { mActivity = activity; mSource = Utils.checkNotNull(mediaSet); mPhotoView = Utils.checkNotNull(view); @@ -197,7 +196,6 @@ public class PhotoDataAdapter implements PhotoPage.Model { mCameraIndex = cameraIndex; mIsPanorama = isPanorama; mIsStaticCamera = isStaticCamera; - mIsFromTimelineScreen = isFromTimelineScreen; mThreadPool = activity.getThreadPool(); mNeedFullImage = true; @@ -1309,9 +1307,6 @@ public class PhotoDataAdapter implements PhotoPage.Model { } mDirty = false; - if (mIsFromTimelineScreen) { - mSource.setClusterKind(GalleryActivity.CLUSTER_ALBUMSET_NO_TITLE); - } version = mSource.reload(); //if data is not ready, continue to reload if (version == MediaObject.INVALID_DATA_VERSION) { @@ -1439,10 +1434,7 @@ public class PhotoDataAdapter implements PhotoPage.Model { // Don't change index if mSize == 0 if (mSize > 0) { - // Due to the set identification and new photo, photos - // in the last two positions disappear in the temp info.items. - // Don't change index in such a situation. - if (index >= mSize + 2) index = mSize - 1; + if (index >= mSize) index = mSize - 1; } info.indexHint = index; diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index 3000d056b..e8dd13fac 100755 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -501,8 +501,7 @@ public abstract class PhotoPage extends ActivityState implements mActivity, mPhotoView, mMediaSet, itemPath, mCurrentIndex, mAppBridge == null ? -1 : 0, mAppBridge == null ? false : mAppBridge.isPanorama(), - mAppBridge == null ? false : mAppBridge.isStaticCamera(), - mIsFromTimelineScreen); + mAppBridge == null ? false : mAppBridge.isStaticCamera()); mModel = pda; mPhotoView.setModel(mModel); diff --git a/src/com/android/gallery3d/data/ClusterAlbumSet.java b/src/com/android/gallery3d/data/ClusterAlbumSet.java index 7695bd35c..0d7ce3685 100644..100755 --- a/src/com/android/gallery3d/data/ClusterAlbumSet.java +++ b/src/com/android/gallery3d/data/ClusterAlbumSet.java @@ -139,8 +139,6 @@ public class ClusterAlbumSet extends MediaSet implements ContentListener { album = (ClusterAlbum) dataManager.peekMediaObject(childPath); if (album == null) { album = new ClusterAlbum(childPath, dataManager, this, mKind); - } else { - album.setClusterKind(mKind); } } album.setMediaItems(clustering.getCluster(i)); |