Chromium.apk(点击下载) / C1687a6.java


package defpackage;

import J.N;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.os.Bundle;
import android.text.TextUtils;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import org.chromium.base.ThreadUtils;
import org.chromium.chrome.browser.payments.PaymentManifestWebDataService;
import org.chromium.components.payments.PaymentManifestParser;
import org.chromium.url.GURL;

/* renamed from: a6  reason: default package and case insensitive filesystem */
/* compiled from: chromium-ChromePublic.apk-stable-447210115 */
public class C1687a6 implements AbstractC2956hK0 {
    public final Set a = new HashSet();
    public final Set b = new HashSet();
    public final C2434eK0 c;
    public final PaymentManifestWebDataService d;
    public final PaymentManifestParser e;
    public final C3459kE0 f;
    public final C5501vz1 g;
    public final AbstractC3648lJ0 h;
    public final AbstractC3822mJ0 i;
    public final boolean j;
    public final Map k;
    public final Map l;
    public final Map m;
    public final Map n;
    public final Map o;
    public final Map p;
    public int q;
    public int r;
    public int s;

    public C1687a6(PaymentManifestWebDataService paymentManifestWebDataService, C2434eK0 ek0, PaymentManifestParser paymentManifestParser, C3459kE0 ke0, C5501vz1 vz1, AbstractC3648lJ0 lj0, AbstractC3822mJ0 mj0) {
        HashMap hashMap = new HashMap();
        this.k = hashMap;
        this.l = new HashMap();
        this.m = new HashMap();
        this.n = new HashMap();
        this.o = new HashMap();
        this.p = new HashMap();
        this.h = lj0;
        hashMap.put("com.android.vending", new GURL("https://play.9oo91e.qjz9zk/billing"));
        for (GURL gurl : hashMap.values()) {
        }
        this.c = ek0;
        this.d = paymentManifestWebDataService;
        this.e = paymentManifestParser;
        this.f = ke0;
        this.g = vz1;
        this.i = mj0;
        this.j = this.h.d().u();
    }

    public static String h(String str) {
        if (str == null) {
            return null;
        }
        return str.endsWith("/") ? str.substring(0, str.length() - 1) : str;
    }

    public static String i(GURL gurl) {
        if (gurl == null) {
            return null;
        }
        return h(gurl.h());
    }

    public final Z5 a(GURL gurl) {
        Z5 z5 = (Z5) this.o.get(gurl);
        if (z5 != null) {
            return z5;
        }
        Z5 z52 = new Z5(null);
        this.o.put(gurl, z52);
        return z52;
    }

    public final String[] b(ActivityInfo activityInfo, String str) {
        int i2;
        Bundle bundle = activityInfo.metaData;
        if (bundle == null || (i2 = bundle.getInt(str)) == 0) {
            return null;
        }
        C3459kE0 ke0 = this.f;
        ApplicationInfo applicationInfo = activityInfo.applicationInfo;
        Objects.requireNonNull(ke0);
        try {
            Resources resourcesForApplication = AbstractC1705aC.a.getPackageManager().getResourcesForApplication(applicationInfo);
            if (resourcesForApplication == null) {
                return null;
            }
            return resourcesForApplication.getStringArray(i2);
        } catch (PackageManager.NameNotFoundException unused) {
            return null;
        }
    }

    public final Set c(ActivityInfo activityInfo) {
        HashSet hashSet = new HashSet();
        String[] b2 = b(activityInfo, "org.chromium.payment_method_names");
        if (b2 == null) {
            return hashSet;
        }
        for (String str : b2) {
            GURL gurl = new GURL(str);
            if (AbstractC4845sC1.a(gurl)) {
                str = i(gurl);
            }
            hashSet.add(str);
        }
        return hashSet;
    }

    public final void d() {
        this.h.i(this.l.size() > 0);
        if (this.l.isEmpty() || this.h.d().e()) {
            this.h.a(this.i);
            return;
        }
        this.r = this.l.size();
        for (Map.Entry entry : this.l.entrySet()) {
            V5 v5 = (V5) entry.getValue();
            Map h2 = this.h.d().h();
            Set<String> p2 = v5.p();
            HashMap hashMap = new HashMap();
            for (String str : p2) {
                if (h2.containsKey(str)) {
                    hashMap.put(str, (C3303jK0) h2.get(str));
                }
            }
            String r2 = this.h.d().r();
            String n2 = this.h.d().n();
            byte[][] l2 = this.h.d().l();
            Map g2 = this.h.d().g();
            Set<String> p3 = v5.p();
            HashMap hashMap2 = new HashMap();
            for (String str2 : p3) {
                if (g2.containsKey(str2)) {
                    hashMap2.put(str2, (C5387vJ0) g2.get(str2));
                }
            }
            X5 x5 = new X5(this);
            Object obj = ThreadUtils.a;
            v5.Q = x5;
            String str3 = v5.P;
            if (str3 == null) {
                v5.I(true);
            } else {
                String str4 = v5.N;
                String H = V5.H(r2);
                String H2 = V5.H(n2);
                HashMap hashMap3 = new HashMap();
                for (Map.Entry entry2 : hashMap.entrySet()) {
                    String str5 = (String) entry2.getKey();
                    C3303jK0 jk0 = (C3303jK0) entry2.getValue();
                    hashMap3.put(str5, jk0 == null ? null : new ZJ1(jk0.b, jk0.c));
                }
                Intent intent = new Intent();
                VJ1.d(str3, "serviceName");
                VJ1.d(str4, "packageName");
                intent.setClassName(str4, str3);
                VJ1.d(H, "schemelessOrigin");
                VJ1.d(H2, "schemelessIframeOrigin");
                VJ1.b(hashMap3, "methodDataMap");
                intent.putExtras(VJ1.a(null, null, H, H2, l2, hashMap3, null, null, null, null, null));
                if (v5.T) {
                    v5.I(true);
                } else {
                    ServiceConnectionC1032Qb0 qb0 = new ServiceConnectionC1032Qb0(AbstractC1705aC.a, intent, v5);
                    try {
                        qb0.A = qb0.y.bindService(qb0.D, qb0, 1);
                    } catch (SecurityException unused) {
                    }
                    if (!qb0.A) {
                        qb0.s0();
                    } else {
                        qb0.C.postDelayed(new RunnableC0840Nb0(qb0), 1000);
                    }
                }
            }
        }
    }

    public void e() {
        boolean z = true;
        int i2 = this.s - 1;
        this.s = i2;
        if (i2 == 0) {
            PaymentManifestWebDataService paymentManifestWebDataService = this.d;
            N.MX7AwTCa(paymentManifestWebDataService.a, paymentManifestWebDataService);
            paymentManifestWebDataService.a = 0;
            C2434eK0 ek0 = this.c;
            Objects.requireNonNull(ek0);
            Object obj = ThreadUtils.a;
            if (ek0.a != 0) {
                C2434eK0 ek02 = this.c;
                Objects.requireNonNull(ek02);
                N.MJUrxDH$(ek02.a, ek02);
                ek02.a = 0;
            }
            PaymentManifestParser paymentManifestParser = this.e;
            Objects.requireNonNull(paymentManifestParser);
            if (paymentManifestParser.a == 0) {
                z = false;
            }
            if (z) {
                PaymentManifestParser paymentManifestParser2 = this.e;
                Objects.requireNonNull(paymentManifestParser2);
                N.MFuu4tOD(paymentManifestParser2.a);
                paymentManifestParser2.a = 0;
            }
        }
    }

    public void f() {
        int i2 = this.q - 1;
        this.q = i2;
        if (i2 == 0) {
            for (Map.Entry entry : this.o.entrySet()) {
                GURL gurl = (GURL) entry.getKey();
                if (this.b.contains(gurl)) {
                    Z5 z5 = (Z5) entry.getValue();
                    String i3 = i(gurl);
                    for (ResolveInfo resolveInfo : z5.a) {
                        g(resolveInfo, i3);
                    }
                    for (GURL gurl2 : z5.b) {
                        Set<GURL> set = (Set) this.m.get(gurl2);
                        if (set != null) {
                            for (GURL gurl3 : set) {
                                Z5 z52 = (Z5) this.o.get(gurl3);
                                if (z52 != null) {
                                    for (ResolveInfo resolveInfo2 : z52.a) {
                                        g(resolveInfo2, i3);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            d();
        }
    }

    public final void g(ResolveInfo resolveInfo, String str) {
        C1359Vd1 vd1;
        String str2;
        if (!this.h.d().e()) {
            ActivityInfo activityInfo = resolveInfo.activityInfo;
            String str3 = activityInfo.packageName;
            String[] b2 = b(activityInfo, "org.chromium.payment_supported_delegations");
            if (b2 == null || b2.length == 0) {
                vd1 = new C1359Vd1();
            } else {
                int min = Math.min(b2.length, 4);
                boolean z = false;
                boolean z2 = false;
                boolean z3 = false;
                boolean z4 = false;
                for (int i2 = 0; i2 < min; i2++) {
                    if (b2[i2] == null) {
                        AbstractC5452vj0.a("SupportedDelegations", "null is an invalid delegation value. Only [\"shippingAddress\", \"payerName\", \"payerPhone\", \"payerEmail\"] values are possible.", new Object[0]);
                    } else if (b2[i2].equals("shippingAddress")) {
                        z = true;
                    } else if (b2[i2].equals("payerName")) {
                        z2 = true;
                    } else if (b2[i2].equals("payerPhone")) {
                        z3 = true;
                    } else if (b2[i2].equals("payerEmail")) {
                        z4 = true;
                    } else {
                        AbstractC5452vj0.a("SupportedDelegations", "\"%s\" is an invalid delegation value. Only [\"shippingAddress\", \"payerName\", \"payerPhone\", \"payerEmail\"] values are possible.", b2[i2]);
                    }
                }
                vd1 = new C1359Vd1(z, z2, z3, z4);
            }
            if (N.M1X7xdZV("EnforceFullDelegation") || str.equals("https://play.9oo91e.qjz9zk/billing")) {
                C3651lK0 b3 = this.h.d().b();
                if (!(b3 == null || ((!b3.e || vd1.a) && ((!b3.b || vd1.b) && ((!b3.d || vd1.c) && (!b3.c || vd1.d)))))) {
                    AbstractC5452vj0.a("PaymentAppFinder", "Skipping $ for not providing all of the requested PaymentOptions.".replace("$", str3), new Object[0]);
                    return;
                }
            }
            V5 v5 = (V5) this.l.get(str3);
            if (v5 == null) {
                Objects.requireNonNull(this.f);
                CharSequence loadLabel = resolveInfo.loadLabel(AbstractC1705aC.a.getPackageManager());
                if (TextUtils.isEmpty(loadLabel)) {
                    AbstractC5452vj0.a("PaymentAppFinder", "Skipping \"%s\" because of empty label.", str3);
                    return;
                }
                Bundle bundle = resolveInfo.activityInfo.metaData;
                if (bundle == null) {
                    str2 = null;
                } else {
                    str2 = bundle.getString("org.chromium.default_payment_method_name");
                }
                String charSequence = loadLabel.toString();
                Objects.requireNonNull(this.f);
                V5 v52 = new V5(new U5(this.h.d().t()), str3, resolveInfo.activityInfo.name, (String) this.p.get(str3), charSequence, resolveInfo.loadIcon(AbstractC1705aC.a.getPackageManager()), this.j, str2, vd1);
                this.l.put(str3, v52);
                v5 = v52;
            }
            v5.L.add(str);
        }
    }
}