package ῲ.ᓣ.ῲ;

import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.CancellationSignal;
import androidx.core.os.OperationCanceledException;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.Arrays;
import ῲ.ᓣ.ῲ.C1683;
import ῲ.ᨨ.ඓ.C1725;

/* renamed from: ῲ.ᓣ.ῲ.ῲ  reason: contains not printable characters */
/* compiled from: CursorLoader */
public class C1687 extends AbstractC1688<Cursor> {

    /* renamed from: Ԛ  reason: contains not printable characters */
    public Cursor f5939;

    /* renamed from: ؿ  reason: contains not printable characters */
    public Uri f5940;

    /* renamed from: ݜ  reason: contains not printable characters */
    public String[] f5941;

    /* renamed from: ᓣ  reason: contains not printable characters */
    public String[] f5942;

    /* renamed from: 㗗  reason: contains not printable characters */
    public final C1683<Cursor>.C1686 f5943 = new C1683.C1686();

    /* renamed from: 㗽  reason: contains not printable characters */
    public String f5944;

    /* renamed from: 㶋  reason: contains not printable characters */
    public C1725 f5945;

    /* renamed from: 䀟  reason: contains not printable characters */
    public String f5946;

    public C1687(Context context, Uri uri, String[] strArr, String str, String[] strArr2, String str2) {
        super(context);
        this.f5940 = uri;
        this.f5942 = strArr;
        this.f5944 = str;
        this.f5941 = strArr2;
        this.f5946 = str2;
    }

    @Override // ῲ.ᓣ.ῲ.C1683
    /* renamed from: Ԕ  reason: contains not printable characters */
    public void m4296() {
        super.m4271();
        m4297();
        Cursor cursor = this.f5939;
        if (cursor != null && !cursor.isClosed()) {
            this.f5939.close();
        }
        this.f5939 = null;
    }

    @Override // ῲ.ᓣ.ῲ.C1683
    /* renamed from: ؿ  reason: contains not printable characters */
    public void m4297() {
        m4280();
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m4301(Cursor cursor) {
        if (!m4292()) {
            Cursor cursor2 = this.f5939;
            this.f5939 = cursor;
            if (m4278()) {
                super.m4279((Object) cursor);
            }
            if (cursor2 != null && cursor2 != cursor && !cursor2.isClosed()) {
                cursor2.close();
            }
        } else if (cursor != null) {
            cursor.close();
        }
    }

    @Override // ῲ.ᓣ.ῲ.C1683
    /* renamed from: 㗗  reason: contains not printable characters */
    public void m4304() {
        Cursor cursor = this.f5939;
        if (cursor != null) {
            m4301(cursor);
        }
        if (m4272() || this.f5939 == null) {
            m4275();
        }
    }

    @Override // ῲ.ᓣ.ῲ.AbstractC1688
    /* renamed from: 㶋  reason: contains not printable characters */
    public void m4305() {
        super.m4315();
        synchronized (this) {
            if (this.f5945 != null) {
                this.f5945.m4434();
            }
        }
    }

    @Override // ῲ.ᓣ.ῲ.AbstractC1688
    /* renamed from: ᑓ  reason: contains not printable characters */
    public Cursor m4299() {
        Object obj;
        synchronized (this) {
            if (!m4314()) {
                this.f5945 = new C1725();
            } else {
                throw new OperationCanceledException();
            }
        }
        try {
            ContentResolver contentResolver = m4290().getContentResolver();
            Uri uri = this.f5940;
            String[] strArr = this.f5942;
            String str = this.f5944;
            String[] strArr2 = this.f5941;
            String str2 = this.f5946;
            C1725 k = this.f5945;
            int i = Build.VERSION.SDK_INT;
            if (k != null) {
                try {
                    obj = k.m4433();
                } catch (Exception e) {
                    if (e instanceof android.os.OperationCanceledException) {
                        throw new OperationCanceledException();
                    }
                    throw e;
                }
            } else {
                obj = null;
            }
            Cursor query = contentResolver.query(uri, strArr, str, strArr2, str2, (CancellationSignal) obj);
            if (query != null) {
                try {
                    query.getCount();
                    query.registerContentObserver(this.f5943);
                } catch (RuntimeException e2) {
                    query.close();
                    throw e2;
                }
            }
            synchronized (this) {
                this.f5945 = null;
            }
            return query;
        } catch (Throwable th) {
            synchronized (this) {
                this.f5945 = null;
                throw th;
            }
        }
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public void m4295(Cursor cursor) {
        if (cursor != null && !cursor.isClosed()) {
            cursor.close();
        }
    }

    @Override // ῲ.ᓣ.ῲ.AbstractC1688, ῲ.ᓣ.ῲ.C1683
    @Deprecated
    /* renamed from: K  reason: contains not printable characters */
    public void m4303(String str, FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
        super.m4311(str, fileDescriptor, printWriter, strArr);
        printWriter.print(str);
        printWriter.print("mUri=");
        printWriter.println(this.f5940);
        printWriter.print(str);
        printWriter.print("mProjection=");
        printWriter.println(Arrays.toString(this.f5942));
        printWriter.print(str);
        printWriter.print("mSelection=");
        printWriter.println(this.f5944);
        printWriter.print(str);
        printWriter.print("mSelectionArgs=");
        printWriter.println(Arrays.toString(this.f5941));
        printWriter.print(str);
        printWriter.print("mSortOrder=");
        printWriter.println(this.f5946);
        printWriter.print(str);
        printWriter.print("mCursor=");
        printWriter.println(this.f5939);
        printWriter.print(str);
        printWriter.print("mContentChanged=");
        printWriter.println(this.f5933);
    }
}
