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

import android.app.Activity;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import com.google.android.gms.ads.internal.overlay.AdOverlayInfoParcel;
import com.google.android.gms.ads.mediation.MediationInterstitialAdapter;

/* JADX INFO: loaded from: classes2.dex */
public final class zzbwl implements MediationInterstitialAdapter {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public Activity f19570a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public s7.l f19571b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public Uri f19572c;

    @Override // com.google.android.gms.ads.mediation.MediationInterstitialAdapter, com.google.android.gms.ads.mediation.MediationNativeAdapter
    public final void onDestroy() {
        q7.j.a("Destroying AdMobCustomTabsAdapter adapter.");
    }

    @Override // com.google.android.gms.ads.mediation.MediationInterstitialAdapter, com.google.android.gms.ads.mediation.MediationNativeAdapter
    public final void onPause() {
        q7.j.a("Pausing AdMobCustomTabsAdapter adapter.");
    }

    @Override // com.google.android.gms.ads.mediation.MediationInterstitialAdapter, com.google.android.gms.ads.mediation.MediationNativeAdapter
    public final void onResume() {
        q7.j.a("Resuming AdMobCustomTabsAdapter adapter.");
    }

    @Override // com.google.android.gms.ads.mediation.MediationInterstitialAdapter
    public final void requestInterstitialAd(Context context, s7.l lVar, Bundle bundle, s7.e eVar, Bundle bundle2) {
        this.f19571b = lVar;
        if (lVar == null) {
            q7.j.d("Listener not set for mediation. Returning.");
            return;
        }
        if (!(context instanceof Activity)) {
            q7.j.d("AdMobCustomTabs can only work with Activity context. Bailing out.");
            ((vu0) this.f19571b).f();
            return;
        }
        if (!uo.a(context)) {
            q7.j.d("Default browser does not support custom tabs. Bailing out.");
            ((vu0) this.f19571b).f();
            return;
        }
        String string = bundle.getString("tab_url");
        if (TextUtils.isEmpty(string)) {
            q7.j.d("The tab_url retrieved from mediation metadata is empty. Bailing out.");
            ((vu0) this.f19571b).f();
        } else {
            this.f19570a = (Activity) context;
            this.f19572c = Uri.parse(string);
            ((vu0) this.f19571b).j();
        }
    }

    @Override // com.google.android.gms.ads.mediation.MediationInterstitialAdapter
    public final void showInterstitial() {
        androidx.browser.customtabs.r rVarB = new androidx.browser.customtabs.q().b();
        rVarB.f884a.setData(this.f19572c);
        p7.r0.f31763l.post(new bv(this, new AdOverlayInfoParcel(new com.google.android.gms.ads.internal.overlay.g(rVarB.f884a, null), null, new qx(this), null, new q7.a(false, 0, 0, false), null, null, "")));
        m7.n nVar = m7.n.C;
        q20 q20Var = nVar.f30469h.f15964j;
        q20Var.getClass();
        nVar.f30472k.getClass();
        long jCurrentTimeMillis = System.currentTimeMillis();
        synchronized (q20Var.f15573a) {
            try {
                if (q20Var.f15575c == 3) {
                    if (q20Var.f15574b + ((Long) n7.y.f31093e.f31096c.b(ao.K6)).longValue() <= jCurrentTimeMillis) {
                        q20Var.f15575c = 1;
                    }
                }
            } finally {
            }
        }
        nVar.f30472k.getClass();
        long jCurrentTimeMillis2 = System.currentTimeMillis();
        synchronized (q20Var.f15573a) {
            try {
                if (q20Var.f15575c != 2) {
                    return;
                }
                q20Var.f15575c = 3;
                if (q20Var.f15575c == 3) {
                    q20Var.f15574b = jCurrentTimeMillis2;
                }
            } finally {
            }
        }
    }
}
