package ඓ.ῲ.K.ᕣ.㿎;

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;
import ඓ.K.K.K.C1293;

/* renamed from: ඓ.ῲ.K.ᕣ.㿎.㗗  reason: contains not printable characters */
/* compiled from: StreamLocalUriFetcher */
public class C1139 extends AbstractC1138<InputStream> {

    /* renamed from: ඓ  reason: contains not printable characters */
    public static final UriMatcher f4617 = new UriMatcher(-1);

    static {
        f4617.addURI("com.android.contacts", "contacts/lookup/*/#", 1);
        f4617.addURI("com.android.contacts", "contacts/lookup/*", 1);
        f4617.addURI("com.android.contacts", "contacts/#/photo", 2);
        f4617.addURI("com.android.contacts", "contacts/#", 3);
        f4617.addURI("com.android.contacts", "contacts/#/display_photo", 4);
        f4617.addURI("com.android.contacts", "phone_lookup/*", 5);
    }

    public C1139(ContentResolver contentResolver, Uri uri) {
        super(contentResolver, uri);
    }

    /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
    @Override // ඓ.ῲ.K.ᕣ.㿎.AbstractC1138
    /* renamed from: K  reason: contains not printable characters */
    public void m3051(InputStream inputStream) throws IOException {
        inputStream.close();
    }

    /* Return type fixed from 'java.lang.Object' to match base method */
    /* JADX WARNING: Removed duplicated region for block: B:12:0x0025 A[RETURN] */
    /* JADX WARNING: Removed duplicated region for block: B:13:0x0026  */
    @Override // ඓ.ῲ.K.ᕣ.㿎.AbstractC1138
    /* renamed from: K  reason: contains not printable characters */
    public InputStream m3050(Uri uri, ContentResolver contentResolver) throws FileNotFoundException {
        InputStream inputStream;
        int match = f4617.match(uri);
        if (match != 1) {
            if (match == 3) {
                inputStream = m3048(contentResolver, uri);
            } else if (match != 5) {
                inputStream = contentResolver.openInputStream(uri);
            }
            if (inputStream == null) {
                return inputStream;
            }
            throw new FileNotFoundException(C1293.m3410("InputStream is null for ", uri));
        }
        Uri lookupContact = ContactsContract.Contacts.lookupContact(contentResolver, uri);
        if (lookupContact != null) {
            inputStream = m3048(contentResolver, lookupContact);
            if (inputStream == null) {
            }
        } else {
            throw new FileNotFoundException("Contact cannot be found");
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public final InputStream m3048(ContentResolver contentResolver, Uri uri) {
        return ContactsContract.Contacts.openContactPhotoInputStream(contentResolver, uri, true);
    }

    @Override // ඓ.ῲ.K.ᕣ.㿎.AbstractC1146
    /* renamed from: K  reason: contains not printable characters */
    public Class<InputStream> m3049() {
        return InputStream.class;
    }
}
