package com.google.android.gms.internal.stable;

import android.content.ContentResolver;
import android.net.Uri;
import android.provider.BaseColumns;
import com.tencent.matrix.trace.core.AppMethodBeat;
import java.util.HashMap;

public class zze$zza implements BaseColumns {
    private static HashMap<Uri, zzh> zzagq = new HashMap();

    static {
        AppMethodBeat.i(90474);
        AppMethodBeat.o(90474);
    }

    private static zzh zza(ContentResolver contentResolver, Uri uri) {
        AppMethodBeat.i(90471);
        zzh zzh = (zzh) zzagq.get(uri);
        if (zzh == null) {
            zzh = new zzh();
            zzagq.put(uri, zzh);
            contentResolver.registerContentObserver(uri, true, new zzf(null, zzh));
        } else if (zzh.zzagu.getAndSet(false)) {
            synchronized (zzh) {
                try {
                    zzh.zzags.clear();
                    zzh.zzagt = new Object();
                } catch (Throwable th) {
                    AppMethodBeat.o(90471);
                }
            }
        }
        AppMethodBeat.o(90471);
        return zzh;
    }

    /* JADX WARNING: Removed duplicated region for block: B:49:0x0097  */
    /* JADX WARNING: Missing block: B:19:?, code skipped:
            r0 = r10;
            r1 = r11;
            r1 = r0.query(r1, new java.lang.String[]{com.google.firebase.analytics.FirebaseAnalytics$b.VALUE}, "name=?", new java.lang.String[]{r12}, null);
     */
    /* JADX WARNING: Missing block: B:20:0x0047, code skipped:
            if (r1 == null) goto L_0x004f;
     */
    /* JADX WARNING: Missing block: B:23:0x004d, code skipped:
            if (r1.moveToFirst() != false) goto L_0x0063;
     */
    /* JADX WARNING: Missing block: B:24:0x004f, code skipped:
            zza(r7, r8, r12, null);
     */
    /* JADX WARNING: Missing block: B:25:0x0053, code skipped:
            if (r1 == null) goto L_0x0058;
     */
    /* JADX WARNING: Missing block: B:26:0x0055, code skipped:
            r1.close();
     */
    /* JADX WARNING: Missing block: B:27:0x0058, code skipped:
            com.tencent.matrix.trace.core.AppMethodBeat.o(90472);
     */
    /* JADX WARNING: Missing block: B:34:?, code skipped:
            r0 = r1.getString(0);
     */
    /* JADX WARNING: Missing block: B:36:?, code skipped:
            zza(r7, r8, r12, r0);
     */
    /* JADX WARNING: Missing block: B:37:0x006b, code skipped:
            if (r1 == null) goto L_0x0070;
     */
    /* JADX WARNING: Missing block: B:38:0x006d, code skipped:
            r1.close();
     */
    /* JADX WARNING: Missing block: B:39:0x0070, code skipped:
            com.tencent.matrix.trace.core.AppMethodBeat.o(90472);
     */
    /* JADX WARNING: Missing block: B:41:0x0075, code skipped:
            r1 = null;
            r0 = null;
     */
    /* JADX WARNING: Missing block: B:43:?, code skipped:
            new java.lang.StringBuilder("Can't get key ").append(r12).append(" from ").append(r11);
     */
    /* JADX WARNING: Missing block: B:44:0x008d, code skipped:
            if (r1 != null) goto L_0x008f;
     */
    /* JADX WARNING: Missing block: B:45:0x008f, code skipped:
            r1.close();
     */
    /* JADX WARNING: Missing block: B:46:0x0093, code skipped:
            r0 = th;
     */
    /* JADX WARNING: Missing block: B:47:0x0094, code skipped:
            r1 = null;
     */
    /* JADX WARNING: Missing block: B:48:0x0095, code skipped:
            if (r1 != null) goto L_0x0097;
     */
    /* JADX WARNING: Missing block: B:49:0x0097, code skipped:
            r1.close();
     */
    /* JADX WARNING: Missing block: B:50:0x009a, code skipped:
            com.tencent.matrix.trace.core.AppMethodBeat.o(90472);
     */
    /* JADX WARNING: Missing block: B:51:0x009d, code skipped:
            throw r0;
     */
    /* JADX WARNING: Missing block: B:52:0x009e, code skipped:
            r0 = th;
     */
    /* JADX WARNING: Missing block: B:54:0x00a1, code skipped:
            r0 = null;
     */
    /* JADX WARNING: Missing block: B:63:?, code skipped:
            return null;
     */
    /* JADX WARNING: Missing block: B:64:?, code skipped:
            return r0;
     */
    protected static java.lang.String zza(android.content.ContentResolver r10, android.net.Uri r11, java.lang.String r12) {
        /*
        r6 = 0;
        r9 = 90472; // 0x16168 float:1.26778E-40 double:4.4699E-319;
        com.tencent.matrix.trace.core.AppMethodBeat.i(r9);
        r1 = com.google.android.gms.internal.stable.zze$zza.class;
        monitor-enter(r1);
        r7 = zza(r10, r11);	 Catch:{ all -> 0x0027 }
        monitor-exit(r1);	 Catch:{ all -> 0x0027 }
        monitor-enter(r7);
        r8 = r7.zzagt;	 Catch:{ all -> 0x005d }
        r0 = r7.zzags;	 Catch:{ all -> 0x005d }
        r0 = r0.containsKey(r12);	 Catch:{ all -> 0x005d }
        if (r0 == 0) goto L_0x002d;
    L_0x001a:
        r0 = r7.zzags;	 Catch:{ all -> 0x005d }
        r0 = r0.get(r12);	 Catch:{ all -> 0x005d }
        r0 = (java.lang.String) r0;	 Catch:{ all -> 0x005d }
        monitor-exit(r7);	 Catch:{ all -> 0x005d }
        com.tencent.matrix.trace.core.AppMethodBeat.o(r9);
    L_0x0026:
        return r0;
    L_0x0027:
        r0 = move-exception;
        monitor-exit(r1);	 Catch:{ all -> 0x0027 }
        com.tencent.matrix.trace.core.AppMethodBeat.o(r9);
        throw r0;
    L_0x002d:
        monitor-exit(r7);	 Catch:{ all -> 0x005d }
        r0 = 1;
        r2 = new java.lang.String[r0];	 Catch:{ SQLException -> 0x0074, all -> 0x0093 }
        r0 = 0;
        r1 = "value";
        r2[r0] = r1;	 Catch:{ SQLException -> 0x0074, all -> 0x0093 }
        r3 = "name=?";
        r0 = 1;
        r4 = new java.lang.String[r0];	 Catch:{ SQLException -> 0x0074, all -> 0x0093 }
        r0 = 0;
        r4[r0] = r12;	 Catch:{ SQLException -> 0x0074, all -> 0x0093 }
        r5 = 0;
        r0 = r10;
        r1 = r11;
        r1 = r0.query(r1, r2, r3, r4, r5);	 Catch:{ SQLException -> 0x0074, all -> 0x0093 }
        if (r1 == 0) goto L_0x004f;
    L_0x0049:
        r0 = r1.moveToFirst();	 Catch:{ SQLException -> 0x00a0 }
        if (r0 != 0) goto L_0x0063;
    L_0x004f:
        r0 = 0;
        zza(r7, r8, r12, r0);	 Catch:{ SQLException -> 0x00a0 }
        if (r1 == 0) goto L_0x0058;
    L_0x0055:
        r1.close();
    L_0x0058:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r9);
        r0 = r6;
        goto L_0x0026;
    L_0x005d:
        r0 = move-exception;
        monitor-exit(r7);	 Catch:{ all -> 0x005d }
        com.tencent.matrix.trace.core.AppMethodBeat.o(r9);
        throw r0;
    L_0x0063:
        r0 = 0;
        r0 = r1.getString(r0);	 Catch:{ SQLException -> 0x00a0 }
        zza(r7, r8, r12, r0);	 Catch:{ SQLException -> 0x00a3 }
        if (r1 == 0) goto L_0x0070;
    L_0x006d:
        r1.close();
    L_0x0070:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r9);
        goto L_0x0026;
    L_0x0074:
        r0 = move-exception;
        r1 = r6;
        r0 = r6;
    L_0x0077:
        r2 = new java.lang.StringBuilder;	 Catch:{ all -> 0x009e }
        r3 = "Can't get key ";
        r2.<init>(r3);	 Catch:{ all -> 0x009e }
        r2 = r2.append(r12);	 Catch:{ all -> 0x009e }
        r3 = " from ";
        r2 = r2.append(r3);	 Catch:{ all -> 0x009e }
        r2.append(r11);	 Catch:{ all -> 0x009e }
        if (r1 == 0) goto L_0x0070;
    L_0x008f:
        r1.close();
        goto L_0x0070;
    L_0x0093:
        r0 = move-exception;
        r1 = r6;
    L_0x0095:
        if (r1 == 0) goto L_0x009a;
    L_0x0097:
        r1.close();
    L_0x009a:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r9);
        throw r0;
    L_0x009e:
        r0 = move-exception;
        goto L_0x0095;
    L_0x00a0:
        r0 = move-exception;
        r0 = r6;
        goto L_0x0077;
    L_0x00a3:
        r2 = move-exception;
        goto L_0x0077;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.stable.zze$zza.zza(android.content.ContentResolver, android.net.Uri, java.lang.String):java.lang.String");
    }

    private static void zza(zzh zzh, Object obj, String str, String str2) {
        AppMethodBeat.i(90473);
        synchronized (zzh) {
            try {
                if (obj == zzh.zzagt) {
                    zzh.zzags.put(str, str2);
                }
            } finally {
                while (true) {
                }
                AppMethodBeat.o(90473);
            }
        }
    }
}
