summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers
diff options
context:
space:
mode:
authorhuiyan <huiyan@codeaurora.org>2016-05-30 17:30:25 +0800
committerSteve Kondik <steve@cyngn.com>2016-08-13 01:58:17 -0700
commitd38f5fea062b7481d8603742010def178f0ee41a (patch)
tree4f8fadc82d1ef8b7d99a362075ad4dd21e14edab /src/com/android/providers
parentdaf412842670ed15217d9ed897a2601f629998a4 (diff)
downloadandroid_packages_providers_MediaProvider-d38f5fea062b7481d8603742010def178f0ee41a.tar.gz
android_packages_providers_MediaProvider-d38f5fea062b7481d8603742010def178f0ee41a.tar.bz2
android_packages_providers_MediaProvider-d38f5fea062b7481d8603742010def178f0ee41a.zip
MediaProvider: Fix failure in android.provider.cts.MediaStore_FilesTest
openFileDescriptor or openOutputStream will call openFile in MediaProvider. And the parent dir of the caller's url is created by openFile. But MediaStore_FilesTest expect that the dir does not exists. So the test case fail. Remove the function of creating the dir to make MediaStore_FilesTest successfully in openFile. And create the dir in the request function. Change-Id: Id497e3ed70f41ca0a3a83a496ff82a5b3d33ca77 CRs-Fixed: 1020200
Diffstat (limited to 'src/com/android/providers')
-rwxr-xr-xsrc/com/android/providers/media/MediaProvider.java8
-rw-r--r--src/com/android/providers/media/MediaThumbRequest.java3
2 files changed, 2 insertions, 9 deletions
diff --git a/src/com/android/providers/media/MediaProvider.java b/src/com/android/providers/media/MediaProvider.java
index 11a2da67..fb5551fc 100755
--- a/src/com/android/providers/media/MediaProvider.java
+++ b/src/com/android/providers/media/MediaProvider.java
@@ -4688,14 +4688,6 @@ 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);
diff --git a/src/com/android/providers/media/MediaThumbRequest.java b/src/com/android/providers/media/MediaThumbRequest.java
index 3d7cc83f..0358040c 100644
--- a/src/com/android/providers/media/MediaThumbRequest.java
+++ b/src/com/android/providers/media/MediaThumbRequest.java
@@ -142,8 +142,9 @@ class MediaThumbRequest {
void execute() throws IOException {
MiniThumbFile miniThumbFile = MiniThumbFile.instance(mUri);
long magic = mMagic;
+ //to create the .thumbnail dir
+ long fileMagic = miniThumbFile.getMagic(mOrigId);
if (magic != 0) {
- long fileMagic = miniThumbFile.getMagic(mOrigId);
if (fileMagic == magic) {
Cursor c = null;
ParcelFileDescriptor pfd = null;