From 1e0110a151d273101cf83c07d8d05e13c15a42e3 Mon Sep 17 00:00:00 2001
From: Paul Masters
Date: Thu, 16 Jul 2020 17:49:45 +0100
Subject: [PATCH 1/3] Use target sdk from FrescoConfig
---
samples/showcase/build.gradle | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/samples/showcase/build.gradle b/samples/showcase/build.gradle
index b95625640e..b2e377cc43 100644
--- a/samples/showcase/build.gradle
+++ b/samples/showcase/build.gradle
@@ -61,7 +61,7 @@ android {
}
instantRunConfig {
dimension "main"
- minSdkVersion 21
+ minSdkVersion FrescoConfig.samplesMinSdkVersion
}
internal {
}
From 9496c639f6da57ce8add15d247616c1234029185 Mon Sep 17 00:00:00 2001
From: Paul Masters
Date: Mon, 10 Aug 2020 14:03:05 +0100
Subject: [PATCH 2/3] Remove file URI access in favour of content URI
---
.../LocalContentUriFetchProducer.java | 37 +------------------
1 file changed, 1 insertion(+), 36 deletions(-)
diff --git a/imagepipeline/src/main/java/com/facebook/imagepipeline/producers/LocalContentUriFetchProducer.java b/imagepipeline/src/main/java/com/facebook/imagepipeline/producers/LocalContentUriFetchProducer.java
index 8d9c92278a..b664ad2de6 100644
--- a/imagepipeline/src/main/java/com/facebook/imagepipeline/producers/LocalContentUriFetchProducer.java
+++ b/imagepipeline/src/main/java/com/facebook/imagepipeline/producers/LocalContentUriFetchProducer.java
@@ -32,7 +32,7 @@ public class LocalContentUriFetchProducer extends LocalFetchProducer {
public static final String PRODUCER_NAME = "LocalContentUriFetchProducer";
private static final String[] PROJECTION =
- new String[] {MediaStore.Images.Media._ID, MediaStore.Images.ImageColumns.DATA};
+ new String[] {MediaStore.Images.Media._ID};
private final ContentResolver mContentResolver;
@@ -67,44 +67,9 @@ protected EncodedImage getEncodedImage(ImageRequest imageRequest) throws IOExcep
// If a Contact URI is provided, use the special helper to open that contact's photo.
return getEncodedImage(inputStream, EncodedImage.UNKNOWN_STREAM_SIZE);
}
-
- if (UriUtil.isLocalCameraUri(uri)) {
- EncodedImage cameraImage = getCameraImage(uri);
- if (cameraImage != null) {
- return cameraImage;
- }
- }
-
return getEncodedImage(mContentResolver.openInputStream(uri), EncodedImage.UNKNOWN_STREAM_SIZE);
}
- private @Nullable EncodedImage getCameraImage(Uri uri) throws IOException {
- Cursor cursor = mContentResolver.query(uri, PROJECTION, null, null, null);
- if (cursor == null) {
- return null;
- }
- try {
- if (cursor.getCount() == 0) {
- return null;
- }
- cursor.moveToFirst();
- final String pathname =
- cursor.getString(cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA));
- if (pathname != null) {
- ParcelFileDescriptor parcelFileDescriptor = mContentResolver.openFileDescriptor(uri, "r");
- FileDescriptor fd = parcelFileDescriptor.getFileDescriptor();
- return getEncodedImage(new FileInputStream(fd), getLength(pathname));
- }
- } finally {
- cursor.close();
- }
- return null;
- }
-
- private static int getLength(String pathname) {
- return pathname == null ? -1 : (int) new File(pathname).length();
- }
-
@Override
protected String getProducerName() {
return PRODUCER_NAME;
From 0a6b3895f66ba3b7014e420883e98b8ce9944ec0 Mon Sep 17 00:00:00 2001
From: Paul Masters
Date: Wed, 12 Aug 2020 10:33:16 +0100
Subject: [PATCH 3/3] Revert "Use target sdk from FrescoConfig"
This reverts commit 1e0110a151d273101cf83c07d8d05e13c15a42e3.
---
samples/showcase/build.gradle | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/samples/showcase/build.gradle b/samples/showcase/build.gradle
index b2e377cc43..b95625640e 100644
--- a/samples/showcase/build.gradle
+++ b/samples/showcase/build.gradle
@@ -61,7 +61,7 @@ android {
}
instantRunConfig {
dimension "main"
- minSdkVersion FrescoConfig.samplesMinSdkVersion
+ minSdkVersion 21
}
internal {
}