N-GMS build gallery编辑图片后保存出现crash

Issue:
"

Actual Results: Crash observed when edit pictures of SD card and click save icon.

Expected Results: Crash should not occur when edit pictures of SD card and click save icon.

Reproduction Steps:

  1. Launch Camera app and select 'SD Card' item from camera storage.
  2. Capture some pictures.
  3. Launch Gallery app and select several pictures to edit.
  4. By clicking pen icon in the bottom left corner to edit the pictures and click save in the top left corner after finish editing.
  5. Crash can be seen once click save icon.

"
Solution:
"#Solution: Update save path"

现象如下:

 

platform/packages/apps/Gallery2/src/com/android/gallery3d/filtershow/tools/SaveImage.java

public static File getFinalSaveDirectory(Context context, Uri sourceUri) {
        File saveDirectory = SaveImage.getSaveDirectory(context, sourceUri);
        if ((saveDirectory == null) || !saveDirectory.canWrite() ||
                (ZebraUtils.isZebra().orElse(false) &&
                        !saveDirectory.getPath().contains(Environment.getExternalStorageDirectory().getPath()))) {
            saveDirectory = new File(Environment.getExternalStorageDirectory(),
                    SaveImage.DEFAULT_SAVE_DIRECTORY);
        }
        // Create the directory if it doesn't exist
        if (!saveDirectory.exists())
            saveDirectory.mkdirs();
        return saveDirectory;
    }

你可能感兴趣的:(android)