84 lines
3.0 KiB
Java
84 lines
3.0 KiB
Java
package c.f.j.p;
|
|
|
|
import android.content.ContentResolver;
|
|
import android.database.Cursor;
|
|
import android.net.Uri;
|
|
import android.provider.ContactsContract;
|
|
import c.f.d.g.g;
|
|
import c.f.d.l.b;
|
|
import c.f.j.j.e;
|
|
import com.facebook.imagepipeline.request.ImageRequest;
|
|
import java.io.File;
|
|
import java.io.FileInputStream;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.util.concurrent.Executor;
|
|
/* compiled from: LocalContentUriFetchProducer */
|
|
public class e0 extends g0 {
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public static final String[] f480c = {"_id", "_data"};
|
|
public final ContentResolver d;
|
|
|
|
public e0(Executor executor, g gVar, ContentResolver contentResolver) {
|
|
super(executor, gVar);
|
|
this.d = contentResolver;
|
|
}
|
|
|
|
@Override // c.f.j.p.g0
|
|
public e d(ImageRequest imageRequest) throws IOException {
|
|
InputStream inputStream;
|
|
Uri uri = imageRequest.f2261c;
|
|
Uri uri2 = b.a;
|
|
boolean z2 = false;
|
|
if (uri.getPath() != null && b.c(uri) && "com.android.contacts".equals(uri.getAuthority()) && !uri.getPath().startsWith(b.a.getPath())) {
|
|
z2 = true;
|
|
}
|
|
if (z2) {
|
|
if (uri.toString().endsWith("/photo")) {
|
|
inputStream = this.d.openInputStream(uri);
|
|
} else if (uri.toString().endsWith("/display_photo")) {
|
|
try {
|
|
inputStream = this.d.openAssetFileDescriptor(uri, "r").createInputStream();
|
|
} catch (IOException unused) {
|
|
throw new IOException("Contact photo does not exist: " + uri);
|
|
}
|
|
} else {
|
|
InputStream openContactPhotoInputStream = ContactsContract.Contacts.openContactPhotoInputStream(this.d, uri);
|
|
if (openContactPhotoInputStream != null) {
|
|
inputStream = openContactPhotoInputStream;
|
|
} else {
|
|
throw new IOException("Contact photo does not exist: " + uri);
|
|
}
|
|
}
|
|
return c(inputStream, -1);
|
|
}
|
|
if (b.b(uri)) {
|
|
Cursor query = this.d.query(uri, f480c, null, null, null);
|
|
e eVar = null;
|
|
if (query != null) {
|
|
try {
|
|
if (query.getCount() != 0) {
|
|
query.moveToFirst();
|
|
String string = query.getString(query.getColumnIndex("_data"));
|
|
if (string != null) {
|
|
eVar = c(new FileInputStream(this.d.openFileDescriptor(uri, "r").getFileDescriptor()), (int) new File(string).length());
|
|
}
|
|
}
|
|
} finally {
|
|
query.close();
|
|
}
|
|
}
|
|
if (eVar != null) {
|
|
return eVar;
|
|
}
|
|
}
|
|
return c(this.d.openInputStream(uri), -1);
|
|
}
|
|
|
|
@Override // c.f.j.p.g0
|
|
public String e() {
|
|
return "LocalContentUriFetchProducer";
|
|
}
|
|
}
|