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

import android.app.AppOpsManager$OnOpActiveChangedListener;

/* JADX INFO: loaded from: classes2.dex */
public final class sh implements AppOpsManager$OnOpActiveChangedListener {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f16448a = 1;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ Object f16449b;

    public sh(th thVar) {
        this.f16449b = thVar;
    }

    public final void onOpActiveChanged(String str, int i10, String str2, boolean z10) {
        switch (this.f16448a) {
            case 0:
                if (z10) {
                    th thVar = (th) this.f16449b;
                    thVar.f16895a = System.currentTimeMillis();
                    thVar.f16898d = true;
                    return;
                }
                th thVar2 = (th) this.f16449b;
                long j10 = thVar2.f16896b;
                long jCurrentTimeMillis = System.currentTimeMillis();
                if (j10 > 0) {
                    long j11 = thVar2.f16896b;
                    if (jCurrentTimeMillis >= j11) {
                        thVar2.f16897c = jCurrentTimeMillis - j11;
                    }
                }
                thVar2.f16898d = false;
                return;
            default:
                hp1 hp1Var = (hp1) this.f16449b;
                synchronized (hp1Var) {
                    try {
                        if (z10) {
                            hp1Var.f12232c = System.currentTimeMillis();
                            hp1Var.f12235f = true;
                        } else {
                            long jCurrentTimeMillis2 = System.currentTimeMillis();
                            long j12 = hp1Var.f12233d;
                            if (j12 > 0 && jCurrentTimeMillis2 >= j12) {
                                hp1Var.f12234e = jCurrentTimeMillis2 - j12;
                            }
                            hp1Var.f12235f = false;
                        }
                    } catch (Throwable th) {
                        throw th;
                    }
                    break;
                }
                return;
        }
    }

    public sh(hp1 hp1Var) {
        this.f16449b = hp1Var;
    }
}
