71 lines
2.6 KiB
Java
71 lines
2.6 KiB
Java
package com.bumptech.glide.load.data;
|
|
|
|
import android.content.ContentResolver;
|
|
import android.content.UriMatcher;
|
|
import android.net.Uri;
|
|
import android.provider.ContactsContract;
|
|
import java.io.FileNotFoundException;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class StreamLocalUriFetcher extends LocalUriFetcher<InputStream> {
|
|
private static final UriMatcher d = new UriMatcher(-1);
|
|
|
|
static {
|
|
d.addURI("com.android.contacts", "contacts/lookup/*/#", 1);
|
|
d.addURI("com.android.contacts", "contacts/lookup/*", 1);
|
|
d.addURI("com.android.contacts", "contacts/#/photo", 2);
|
|
d.addURI("com.android.contacts", "contacts/#", 3);
|
|
d.addURI("com.android.contacts", "contacts/#/display_photo", 4);
|
|
d.addURI("com.android.contacts", "phone_lookup/*", 5);
|
|
}
|
|
|
|
public StreamLocalUriFetcher(ContentResolver contentResolver, Uri uri) {
|
|
super(contentResolver, uri);
|
|
}
|
|
|
|
private InputStream b(Uri uri, ContentResolver contentResolver) throws FileNotFoundException {
|
|
int match = d.match(uri);
|
|
if (match != 1) {
|
|
if (match == 3) {
|
|
return a(contentResolver, uri);
|
|
}
|
|
if (match != 5) {
|
|
return contentResolver.openInputStream(uri);
|
|
}
|
|
}
|
|
Uri lookupContact = ContactsContract.Contacts.lookupContact(contentResolver, uri);
|
|
if (lookupContact != null) {
|
|
return a(contentResolver, lookupContact);
|
|
}
|
|
throw new FileNotFoundException("Contact cannot be found");
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // com.bumptech.glide.load.data.LocalUriFetcher
|
|
public InputStream a(Uri uri, ContentResolver contentResolver) throws FileNotFoundException {
|
|
InputStream b = b(uri, contentResolver);
|
|
if (b != null) {
|
|
return b;
|
|
}
|
|
throw new FileNotFoundException("InputStream is null for " + uri);
|
|
}
|
|
|
|
private InputStream a(ContentResolver contentResolver, Uri uri) {
|
|
return ContactsContract.Contacts.openContactPhotoInputStream(contentResolver, uri, true);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
@Override // com.bumptech.glide.load.data.LocalUriFetcher
|
|
public void a(InputStream inputStream) throws IOException {
|
|
inputStream.close();
|
|
}
|
|
|
|
@Override // com.bumptech.glide.load.data.DataFetcher
|
|
public Class<InputStream> a() {
|
|
return InputStream.class;
|
|
}
|
|
}
|