summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d
diff options
context:
space:
mode:
authorzhuw <zhuw@codeaurora.org>2016-08-03 10:05:00 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2016-08-02 19:44:46 -0700
commit48efd7d136d5c42717849a6805a7aa6a4fb18243 (patch)
treeb6b4cb6a23aa5126cc788bc218a8054483b3285f /src/com/android/gallery3d
parent7ed375d6829e18a0d342d31c3217d6263b9a5c33 (diff)
downloadandroid_packages_apps_Gallery2-48efd7d136d5c42717849a6805a7aa6a4fb18243.tar.gz
android_packages_apps_Gallery2-48efd7d136d5c42717849a6805a7aa6a4fb18243.tar.bz2
android_packages_apps_Gallery2-48efd7d136d5c42717849a6805a7aa6a4fb18243.zip
Gallery: Fix crash after rename or delete photo out of gallery
1. Fix Null Pointer Exception in ProcessingService and FilterShowActivity. 2. Modify PhotoPage to finish itself when receive null data from FilterShowActivity. Change-Id: I8e6e101ea3e98c1bdd87ab7b5499d63c7f348f2b CRs-Fixed: 1042815
Diffstat (limited to 'src/com/android/gallery3d')
-rwxr-xr-xsrc/com/android/gallery3d/app/PhotoPage.java6
-rw-r--r--src/com/android/gallery3d/filtershow/FilterShowActivity.java5
-rw-r--r--src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java2
3 files changed, 10 insertions, 3 deletions
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index 0c82944d8..5d4e439a5 100755
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -1434,7 +1434,11 @@ public abstract class PhotoPage extends ActivityState implements
mRecenterCameraOnResume = false;
switch (requestCode) {
case REQUEST_EDIT:
- setCurrentPhotoByIntent(data);
+ if (data.getData() == null) {
+ onUpPressed();
+ } else {
+ setCurrentPhotoByIntent(data);
+ }
break;
/*case REQUEST_CROP:
if (resultCode == Activity.RESULT_OK) {
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
index cfce7c54a..a8564e727 100644
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -134,6 +134,8 @@ import com.android.gallery3d.util.GalleryUtils;
import com.android.photos.data.GalleryBitmapPool;
import com.thundersoft.hz.selfportrait.makeup.engine.MakeupEngine;
+import static android.app.Activity.RESULT_OK;
+
public class FilterShowActivity extends FragmentActivity implements OnItemClickListener,
OnShareTargetSelectedListener, DialogInterface.OnShowListener,
DialogInterface.OnDismissListener, PopupMenu.OnDismissListener{
@@ -249,7 +251,8 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
long requestId = bundle.getLong(ProcessingService.KEY_REQUEST_ID);
//only handle own request
if (requestId == mRequestId) {
- Uri saveUri = Uri.parse(bundle.getString(ProcessingService.KEY_URL));
+ String url = bundle.getString(ProcessingService.KEY_URL);
+ Uri saveUri = url == null ? null : Uri.parse(url);
boolean releaseDualCam = bundle.getBoolean(ProcessingService.KEY_DUALCAM);
completeSaveImage(saveUri, releaseDualCam);
}
diff --git a/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java b/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java
index 86d4c92c1..b5e9609e2 100644
--- a/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java
+++ b/src/com/android/gallery3d/filtershow/pipeline/ProcessingService.java
@@ -285,7 +285,7 @@ public class ProcessingService extends Service {
if (exit) {
// terminate now
Bundle bundle = new Bundle();
- bundle.putString(KEY_URL, result.toString());
+ bundle.putString(KEY_URL, result == null ? null : result.toString());
bundle.putLong(KEY_REQUEST_ID, requestId);
bundle.putBoolean(KEY_DUALCAM, releaseDualCam);
broadcastState(SAVE_IMAGE_COMPLETE_ACTION, bundle);