summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers
diff options
context:
space:
mode:
authorhuiyan <huiyan@codeaurora.org>2016-04-01 14:52:26 +0800
committerSteve Kondik <steve@cyngn.com>2016-08-13 01:58:08 -0700
commitdaf412842670ed15217d9ed897a2601f629998a4 (patch)
treeeeb10f0d55bf4f27b8f108f293b440437b4b942e /src/com/android/providers
parent97020c44cc3e2c4a203f692d9ff8d660cf037ec6 (diff)
downloadandroid_packages_providers_MediaProvider-daf412842670ed15217d9ed897a2601f629998a4.tar.gz
android_packages_providers_MediaProvider-daf412842670ed15217d9ed897a2601f629998a4.tar.bz2
android_packages_providers_MediaProvider-daf412842670ed15217d9ed897a2601f629998a4.zip
Gallery2: Fix thumbnails of new edit photos display wrongly in Documents.
The photo is edited and save to new file in gallery, the thumbnail of the new photo is generated and saved at the same time. But the directory of thumbnails is not created, and the thumbnail can't save. So the thumbnail displays incorrectly in Documents's Recent list. Check the directory of thumbnails whether create, if not create it at first to make the thumbnails save successfully. Change-Id: I110a7bf568750cc9a0350d99f0a68f6b18c14fbd CRs-Fixed: 994316
Diffstat (limited to 'src/com/android/providers')
-rwxr-xr-xsrc/com/android/providers/media/MediaProvider.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java
index fb5551fc..11a2da67 100755
--- a/src/com/android/providers/media/MediaProvider.java
+++ b/src/com/android/providers/media/MediaProvider.java
@@ -4688,6 +4688,14 @@ public class MediaProvider extends ContentProvider {
if (data == null) {
throw new FileNotFoundException("Null path for " + uri);
}
+ File directory = new File(data).getParentFile();
+ if (!directory.isDirectory()) {
+ if (!directory.mkdirs()) {
+ Log.e(TAG, "Unable to create .thumbnails directory for " + data);
+ throw new FileNotFoundException(
+ "Unable to create .thumbnails directory " + uri);
+ }
+ }
return new File(data);
} else {
throw new FileNotFoundException("Unable to read entry for " + uri);