package com.google.android.play.core.assetpacks;

import android.content.Context;
import com.bytedance.covode.number.Covode;
import com.google.android.play.core.b.b;

public final class ch {
    public static final b LIZ = new b("PackageStateCache");
    public final Context LIZIZ;
    public int LIZJ = -1;

    static {
        Covode.recordClassIndex(44168);
    }

    public ch(Context context) {
        this.LIZIZ = context;
    }

    /* JADX WARNING: Can't wrap try/catch for region: R(2:26|27) */
    /* JADX WARNING: Code restructure failed: missing block: B:27:?, code lost:
        LIZ.LIZIZ("The current version of the app could not be retrieved", new java.lang.Object[0]);
     */
    /* JADX WARNING: Missing exception handler attribute for start block: B:26:0x0063 */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final synchronized int LIZ() {
        /*
            r6 = this;
            monitor-enter(r6)
            r5 = 11207(0x2bc7, float:1.5704E-41)
            com.bytedance.frameworks.apm.trace.MethodCollector.i(r5)     // Catch:{ all -> 0x0073 }
            int r1 = r6.LIZJ     // Catch:{ all -> 0x0073 }
            r0 = -1
            if (r1 != r0) goto L_0x006c
            r3 = 0
            android.content.Context r0 = r6.LIZIZ     // Catch:{ NameNotFoundException -> 0x0063 }
            java.lang.String r4 = r0.getPackageName()     // Catch:{ NameNotFoundException -> 0x0063 }
            android.content.Context r0 = r6.LIZIZ     // Catch:{ NameNotFoundException -> 0x0063 }
            android.content.pm.PackageManager r2 = r0.getPackageManager()     // Catch:{ NameNotFoundException -> 0x0063 }
            X.9EH r0 = X.AnonymousClass9EH.LJJIFFI     // Catch:{ NameNotFoundException -> 0x0063 }
            android.content.Context r1 = r0.LIZ()     // Catch:{ NameNotFoundException -> 0x0063 }
            boolean r0 = X.C30738n2.LJIIIZ     // Catch:{ NameNotFoundException -> 0x0063 }
            if (r0 == 0) goto L_0x0029
            java.lang.String r0 = r1.getPackageName()     // Catch:{ NameNotFoundException -> 0x0063 }
            android.text.TextUtils.equals(r4, r0)     // Catch:{ NameNotFoundException -> 0x0063 }
        L_0x0029:
            boolean r0 = X.C30738n2.LJIIIZ     // Catch:{ NameNotFoundException -> 0x0063 }
            if (r0 == 0) goto L_0x0048
            java.lang.String r0 = r1.getPackageName()     // Catch:{ NameNotFoundException -> 0x0063 }
            boolean r0 = android.text.TextUtils.equals(r4, r0)     // Catch:{ NameNotFoundException -> 0x0063 }
            if (r0 == 0) goto L_0x0048
            android.content.pm.PackageInfo r0 = X.C30738n2.LIZLLL     // Catch:{ NameNotFoundException -> 0x0063 }
            if (r0 != 0) goto L_0x0041
            android.content.pm.PackageInfo r0 = r2.getPackageInfo(r4, r3)     // Catch:{ NameNotFoundException -> 0x0063 }
            X.C30738n2.LIZLLL = r0     // Catch:{ NameNotFoundException -> 0x0063 }
        L_0x0041:
            android.content.pm.PackageInfo r0 = X.C30738n2.LIZLLL     // Catch:{ NameNotFoundException -> 0x0063 }
        L_0x0043:
            int r0 = r0.versionCode     // Catch:{ NameNotFoundException -> 0x0063 }
            r6.LIZJ = r0     // Catch:{ NameNotFoundException -> 0x0063 }
            goto L_0x006c
        L_0x0048:
            boolean r0 = X.C30738n2.LJIIIZ     // Catch:{ NameNotFoundException -> 0x0063 }
            if (r0 == 0) goto L_0x0053
            java.lang.String r0 = r1.getPackageName()     // Catch:{ NameNotFoundException -> 0x0063 }
            android.text.TextUtils.equals(r4, r0)     // Catch:{ NameNotFoundException -> 0x0063 }
        L_0x0053:
            boolean r0 = X.C30738n2.LJIIIZ     // Catch:{ NameNotFoundException -> 0x0063 }
            if (r0 == 0) goto L_0x005e
            java.lang.String r0 = r1.getPackageName()     // Catch:{ NameNotFoundException -> 0x0063 }
            android.text.TextUtils.equals(r4, r0)     // Catch:{ NameNotFoundException -> 0x0063 }
        L_0x005e:
            android.content.pm.PackageInfo r0 = r2.getPackageInfo(r4, r3)     // Catch:{ NameNotFoundException -> 0x0063 }
            goto L_0x0043
        L_0x0063:
            com.google.android.play.core.b.b r2 = LIZ     // Catch:{ all -> 0x0073 }
            java.lang.String r1 = "The current version of the app could not be retrieved"
            java.lang.Object[] r0 = new java.lang.Object[r3]     // Catch:{ all -> 0x0073 }
            r2.LIZIZ(r1, r0)     // Catch:{ all -> 0x0073 }
        L_0x006c:
            int r0 = r6.LIZJ     // Catch:{ all -> 0x0073 }
            com.bytedance.frameworks.apm.trace.MethodCollector.o(r5)     // Catch:{ all -> 0x0073 }
            monitor-exit(r6)
            return r0
        L_0x0073:
            r0 = move-exception
            monitor-exit(r6)
            throw r0
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.play.core.assetpacks.ch.LIZ():int");
    }
}
