APKPure v3.19.91版本的 MD5 值为:f9be25764b720fb55728dbddf2153619

以下内容为反编译后的 qdcd.java 源代码,内容仅作参考


package ck;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.text.TextUtils;
import android.util.Pair;
import ck.qdbe;
import com.san.core.receiver.AppPkgReceiver;
import com.tencent.qqdownloader.waterdrop.install.InstallerListenerActivity;
import com.tencent.raft.measure.report.ATTAReporter;
import com.tencent.raft.measure.utils.MeasureConst;
import com.tencent.raft.raftframework.sla.SLAConstant;
import fm.qddh;
import fm.qdea;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import kotlinx.coroutines.qddg;
import nk.qdab;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public final class qdcd {
    public final List<lk.qdaa> A;
    public final String B;
    public final String C;
    public final long D;

    public final Context f4418a;

    public final List<String> f4419b;

    public final String f4420c;

    public final String f4421d;

    public final int f4422e;

    public final String f4423f;

    public final String f4424g;

    public final long f4425h;

    public final int f4426i;

    public final int f4427j;

    public final int f4428k;

    public final int f4429l;

    public final int f4430m;

    public final int f4431n;

    public final int f4432o;

    public final boolean f4433p;

    public final int f4434q;

    public final int f4435r;

    public final List<qdbe> f4436s;

    public final String f4437t;

    public final long f4438u;

    public final long f4439v;

    public int f4440w;

    public final int f4441x;

    public final boolean f4442y;

    public final qdbe.qdab f4443z;

    public static class qdaa {
        public List<lk.qdaa> A;
        public String B;
        public String C;
        public long D;

        public final Context f4444a;

        public final List<String> f4445b;

        public String f4446c;

        public String f4447d;

        public int f4448e;

        public String f4449f;

        public String f4450g;

        public long f4451h;

        public int f4452i;

        public int f4456m;

        public int f4458o;

        public final int f4460q;

        public final int f4461r;

        public List<qdbe> f4462s;

        public String f4463t;

        public long f4464u;

        public long f4465v;

        public int f4466w;

        public int f4467x;

        public boolean f4468y;

        public qdbe.qdab f4469z;

        public int f4453j = -1;

        public int f4454k = -1;

        public int f4455l = 0;

        public int f4457n = -1;

        public boolean f4459p = false;

        public qdaa(Context context, String str) {
            int i4;
            String e10;
            String e11;
            int i5 = 30000;
            try {
                e11 = fm.qdbe.e(fm.qdbh.f20698b, "mads_cpi_config");
            } catch (Exception unused) {
            }
            if (!TextUtils.isEmpty(e11)) {
                JSONObject jSONObject = new JSONObject(e11);
                if (jSONObject.has("connect_timeout")) {
                    i4 = jSONObject.optInt("connect_timeout", 30000);
                    this.f4460q = i4;
                    e10 = fm.qdbe.e(fm.qdbh.f20698b, "mads_cpi_config");
                    if (TextUtils.isEmpty(e10)) {
                        JSONObject jSONObject2 = new JSONObject(e10);
                        if (jSONObject2.has("read_timeout")) {
                            i5 = jSONObject2.optInt("read_timeout", 30000);
                        }
                    }
                    this.f4461r = i5;
                    this.D = -1L;
                    this.f4444a = context;
                    this.f4445b = Arrays.asList(str);
                }
            }
            i4 = 30000;
            this.f4460q = i4;
            e10 = fm.qdbe.e(fm.qdbh.f20698b, "mads_cpi_config");
            if (TextUtils.isEmpty(e10)) {
            }
            this.f4461r = i5;
            this.D = -1L;
            this.f4444a = context;
            this.f4445b = Arrays.asList(str);
        }
    }

    public qdcd(qdaa qdaaVar) {
        this.f4427j = -1;
        this.f4428k = -1;
        this.f4429l = 2;
        this.f4430m = 0;
        this.f4431n = -1;
        this.f4433p = false;
        this.f4434q = 15000;
        this.f4435r = 15000;
        this.f4418a = qdaaVar.f4444a;
        this.f4419b = qdaaVar.f4445b;
        this.f4420c = qdaaVar.f4446c;
        this.f4421d = qdaaVar.f4447d;
        this.f4422e = qdaaVar.f4448e;
        this.f4423f = qdaaVar.f4449f;
        this.f4424g = qdaaVar.f4450g;
        this.f4425h = qdaaVar.f4451h;
        this.f4426i = qdaaVar.f4452i;
        this.f4427j = qdaaVar.f4453j;
        this.f4428k = qdaaVar.f4454k;
        this.f4429l = qdaaVar.f4455l;
        this.f4430m = qdaaVar.f4456m;
        this.f4431n = qdaaVar.f4457n;
        this.f4432o = qdaaVar.f4458o;
        this.f4433p = qdaaVar.f4459p;
        this.f4434q = qdaaVar.f4460q;
        this.f4435r = qdaaVar.f4461r;
        this.f4436s = qdaaVar.f4462s;
        this.f4437t = qdaaVar.f4463t;
        this.f4438u = qdaaVar.f4464u;
        this.f4439v = qdaaVar.f4465v;
        this.f4440w = qdaaVar.f4466w;
        this.f4441x = qdaaVar.f4467x;
        this.f4443z = qdaaVar.f4469z;
        this.f4442y = qdaaVar.f4468y;
        this.A = qdaaVar.A;
        this.B = qdaaVar.B;
        this.C = qdaaVar.C;
        this.D = qdaaVar.D;
    }

    public static HashMap c() {
        HashMap hashMap = new HashMap();
        String e10 = fm.qdbf.e();
        if (!TextUtils.isEmpty(e10)) {
            hashMap.put("User-Agent", e10);
        }
        hashMap.put(ATTAReporter.KEY_CONTENT_TYPE, "application/json");
        hashMap.put("Accept-Charset", MeasureConst.CHARSET_UTF8);
        return hashMap;
    }

    public static void g(List list, JSONObject jSONObject) {
        if (jSONObject.has("placements")) {
            try {
                JSONArray jSONArray = jSONObject.getJSONArray("placements").getJSONObject(0).getJSONArray("ads");
                HashMap hashMap = new HashMap();
                for (int i4 = 0; i4 < jSONArray.length(); i4++) {
                    JSONObject jSONObject2 = jSONArray.getJSONObject(i4);
                    String optString = jSONObject2.optString("attr_code");
                    JSONObject optJSONObject = jSONObject2.optJSONObject(SLAConstant.APP_INFO);
                    if (optJSONObject != null) {
                        hashMap.put(optJSONObject.optString("app_package_name"), optString);
                    }
                }
                Iterator it = list.iterator();
                while (it.hasNext()) {
                    qdbe qdbeVar = (qdbe) it.next();
                    String str = qdbeVar.f4363e;
                    if (!TextUtils.isEmpty(str) && hashMap.containsKey(str)) {
                        qdbeVar.f4381w = (String) hashMap.get(str);
                    }
                }
            } catch (Exception unused) {
            }
        }
    }

    public final String a() {
        int i4;
        int i5;
        int i10;
        int i11;
        String message;
        hl.qdag f10;
        int i12;
        String str;
        Iterator<qdbe> it;
        String str2;
        String str3;
        String b9;
        String f02 = qddg.f0("protect_host_batch", "http://san.myadssupport.com/client/ci?v=2&sec=2");
        HashMap c4 = c();
        String d4 = d(true);
        if (r7.qdab.f0()) {
            r7.qdab.K("CPIRequest#batchSyncLoadAds, load ad request heads is " + c4);
            r7.qdab.K("CPIRequest#batchSyncLoadAds, load ad request body is " + d4);
        }
        Context context = this.f4418a;
        if (!qddh.c(context)) {
            JSONObject jSONObject = new JSONObject();
            if (!TextUtils.isEmpty(d4)) {
                try {
                    if (qdag.f()) {
                        if (f02.contains("?")) {
                            f02 = f02.concat("&gz=1");
                        } else {
                            f02 = f02.concat("?gz=1");
                        }
                        b9 = gm.qdaa.b(gm.qdab.a(d4));
                    } else {
                        b9 = gm.qdab.b(d4);
                    }
                    jSONObject.put("s", b9);
                } catch (Exception unused) {
                }
                d4 = jSONObject.toString();
            }
        }
        List<qdbe> list = this.f4436s;
        if (list != null && list.size() > 0) {
            int size = list.size();
            Iterator<qdbe> it2 = list.iterator();
            while (true) {
                if (it2.hasNext()) {
                    qdbe next = it2.next();
                    if (next != null) {
                        int i13 = next.f4367i;
                        int i14 = next.f4366h;
                        i11 = size;
                        i5 = i13;
                        i10 = next.f4369k;
                        i4 = i14;
                        break;
                    }
                } else {
                    i11 = size;
                    i4 = -1;
                    i5 = -1;
                    i10 = -1;
                    break;
                }
            }
        } else {
            i4 = -1;
            i5 = -1;
            i10 = -1;
            i11 = -1;
        }
        String str4 = "";
        if (TextUtils.isEmpty(d4)) {
            message = "empty post data";
        } else {
            try {
                f10 = f(1, f02, d4, c4);
                StringBuilder sb2 = new StringBuilder("getStatusCode : ");
                i12 = f10.f21981c;
                sb2.append(i12);
                r7.qdab.K(sb2.toString());
            } catch (IOException e10) {
                r7.qdab.K("error : " + e10.getMessage());
                message = e10.getMessage();
            }
            if (i12 != 200) {
                message = i12 + "";
            } else {
                StringBuilder sb3 = new StringBuilder("CPIRequest#batchSyncLoadAds, load ad result is ");
                str = f10.f21980b;
                aj.qdbg.r(sb3, str);
                if (str == null || TextUtils.isEmpty(str)) {
                    str = "success";
                } else {
                    try {
                        JSONObject jSONObject2 = new JSONObject(str);
                        String optString = jSONObject2.optString("ret_code");
                        try {
                            g(list, jSONObject2);
                            r7.qdab.K("CPIRequest#batchSyncLoadAds, mCpiParams = " + list.toString());
                        } catch (JSONException unused2) {
                        }
                        str4 = optString;
                    } catch (JSONException unused3) {
                    }
                }
                np.qdaf.D(true, i4, i5, i10, i12 + "", i11, list.toString(), str4);
                r7.qdab.K("batchSyncLoadAdSForCPI->jsonStr:".concat(str));
                if (!"success".equals(str) || "fail".equals(str)) {
                    it = list.iterator();
                    while (it.hasNext()) {
                        qdbe.qdab qdabVar = it.next().f4379u;
                        if (qdabVar != null) {
                            qdabVar.a(str);
                        }
                    }
                }
                for (qdbe qdbeVar : list) {
                    String str5 = qdbeVar.f4361c;
                    boolean isEmpty = TextUtils.isEmpty(str5);
                    String str6 = qdbeVar.f4363e;
                    if (isEmpty) {
                        gk.qdah.f21247w.remove(str6);
                    } else {
                        gk.qdah.f21247w.remove(str5);
                    }
                    String str7 = qdbeVar.f4360b;
                    int i15 = qdbeVar.f4369k;
                    if (i15 == 0 || i15 == 17 || i15 == 7 || this.f4430m == 22) {
                        if (TextUtils.isEmpty(str)) {
                            if (TextUtils.isEmpty(str5) && TextUtils.isEmpty(str6)) {
                                if (TextUtils.isEmpty(str7)) {
                                    continue;
                                } else {
                                    gk.qdah.f21247w.remove(str7);
                                }
                            }
                            vi.qdca.a().b(new qdcc(this, qdbeVar), 2);
                        } else {
                            r7.qdab.K("cpiReportCacheWork-->:" + str5 + "--mPkgName:" + str6);
                            if (TextUtils.isEmpty(str5) && TextUtils.isEmpty(str6)) {
                                if (TextUtils.isEmpty(str7)) {
                                    continue;
                                } else {
                                    gk.qdah.f21247w.remove(str7);
                                }
                            }
                            gk.qdah i16 = gk.qdae.k(context).i(str6, str5);
                            if (i16 == null) {
                                i16 = gk.qdae.k(context).j(str7);
                            }
                            if (i16 != null) {
                                i16.f21250a = str5;
                                i16.f21252c = str7;
                                i16.f21254e = qdbeVar.f4364f;
                                i16.f21255f = qdbeVar.f4365g;
                                i16.f21251b = i15;
                                i16.f21256g = qdbeVar.f4362d;
                                i16.a("s2s_track_status", "1");
                                i16.f21259j = System.currentTimeMillis();
                                gk.qdae.k(context).o(i16, null);
                                np.qdaf.C(i16.f21266q, qdbeVar.f4361c, str6, "success", str7);
                            }
                        }
                    }
                    if (i15 != 18) {
                        continue;
                    } else if (TextUtils.isEmpty(str)) {
                        if (TextUtils.isEmpty(str6)) {
                            break;
                        }
                        gk.qdah i17 = gk.qdae.k(context).i(str6, str5);
                        if (i17 != null) {
                            i17.a("s2s_track_status", "0");
                            i17.f21259j = System.currentTimeMillis();
                            gk.qdae.k(context).o(i17, null);
                            str2 = i17.f21266q;
                            str3 = "failed";
                            np.qdaf.C(str2, str5, str6, str3, str7);
                        }
                    } else {
                        if (TextUtils.isEmpty(str6)) {
                            break;
                        }
                        gk.qdah i18 = gk.qdae.k(context).i(str6, str5);
                        if (i18 != null) {
                            i18.a("s2s_track_status", "1");
                            i18.f21259j = System.currentTimeMillis();
                            gk.qdae.k(context).o(i18, null);
                            str2 = i18.f21266q;
                            str3 = "success";
                            np.qdaf.C(str2, str5, str6, str3, str7);
                        }
                    }
                }
                return str;
            }
        }
        np.qdaf.D(false, i4, i5, i10, message, i11, list.toString(), "");
        str = "fail";
        r7.qdab.K("batchSyncLoadAdSForCPI->jsonStr:".concat(str));
        if (!"success".equals(str)) {
        }
        it = list.iterator();
        while (it.hasNext()) {
        }
        while (r2.hasNext()) {
        }
        return str;
    }

    public final JSONObject b(String str, String str2, int i4, int i5, int i10, int i11, int i12, int i13, int i14, int i15, boolean z10, int i16, boolean z11, List<lk.qdaa> list, String str3, String str4) throws JSONException {
        int i17;
        PackageManager packageManager;
        PackageInfo packageInfo;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("package_type", i5);
        jSONObject.put(InstallerListenerActivity.KEY_PACKAGE_NAME, str);
        jSONObject.put("version_name", str2);
        jSONObject.put(InstallerListenerActivity.KEY_VERSION_CODE, i4);
        jSONObject.put("compete_type", i10);
        jSONObject.put("gp_version", i11);
        jSONObject.put("hot_app", i12);
        jSONObject.put("portal", i13);
        jSONObject.put("app_status", i14);
        jSONObject.put("installer", fm.qdbf.d(fm.qdbh.f20698b, str));
        jSONObject.put("exchange", i15);
        jSONObject.put("upload_status", z10 ? 1 : 0);
        jSONObject.put("is_bundle", String.valueOf(z11));
        if (!TextUtils.isEmpty(this.f4437t)) {
            jSONObject.put("sub_portal", this.f4437t);
        }
        jSONObject.put("is_retry", this.f4440w);
        long j10 = this.f4438u;
        if (j10 > 0) {
            jSONObject.put("download_time", j10);
        }
        long j11 = this.f4439v;
        if (j11 > 0) {
            jSONObject.put("install_time", j11);
        }
        if (this.f4441x != 0) {
            jSONObject.put("download_type", i16);
        }
        String str5 = cl.qdaa.f4500a;
        JSONArray jSONArray = new JSONArray();
        if (list != null) {
            for (lk.qdaa qdaaVar : list) {
                JSONObject jSONObject2 = new JSONObject();
                if (qdaaVar != null) {
                    jSONObject2.put("attr_platform", qdaaVar.f24423n);
                    jSONObject2.put("attr_type", qdaaVar.f24424o);
                    jSONObject2.put("ad_id", Integer.parseInt(qdaaVar.f24411b));
                    jSONObject2.put("label", qdaaVar.f24418i);
                    jSONObject2.put("campaign", qdaaVar.f24419j);
                    jSONObject2.put("tracker", qdaaVar.f24417h);
                    jSONObject2.put("creative", qdaaVar.f24420k);
                    jSONArray.put(jSONObject2);
                }
            }
        }
        jSONObject.put(str5, jSONArray);
        Context context = fm.qdbh.f20698b;
        String str6 = kk.qdad.f23706a;
        boolean z12 = false;
        if (fm.qddb.d(context, str6)) {
            try {
                packageManager = context.getPackageManager();
            } catch (PackageManager.NameNotFoundException unused) {
            }
            if (packageManager != null && (packageInfo = packageManager.getPackageInfo(str6, 0)) != null) {
                i17 = packageInfo.versionCode;
                if (i17 >= 4062161) {
                    z12 = true;
                }
            }
            i17 = 0;
            if (i17 >= 4062161) {
            }
        }
        if (z12) {
            jSONObject.put("s_pi", 1);
        } else {
            jSONObject.put("s_pi", -1);
        }
        if (!TextUtils.isEmpty(str3)) {
            jSONObject.put("ad_type", "true".equals(str3) ? 2 : 1);
        }
        if (!TextUtils.isEmpty(str4)) {
            jSONObject.put("ad_id", str4);
        }
        return jSONObject;
    }

    public final String d(boolean z10) {
        StringBuilder sb2;
        Context context = this.f4418a;
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("target", e(context, z10));
            fm.qdcb.a(context, jSONObject);
        } catch (JSONException e10) {
            e = e10;
            sb2 = new StringBuilder("createPara ms jsonException :");
            aj.qdbg.p(e, sb2);
            return jSONObject.toString();
        } catch (Exception e11) {
            e = e11;
            sb2 = new StringBuilder("createADReteParams error :");
            aj.qdbg.p(e, sb2);
            return jSONObject.toString();
        }
        return jSONObject.toString();
    }

    public final JSONObject e(Context context, boolean z10) throws JSONException {
        JSONObject jSONObject;
        int i4;
        int i5;
        JSONObject jSONObject2;
        JSONArray jSONArray;
        qdcd qdcdVar = this;
        JSONObject jSONObject3 = new JSONObject();
        qdea qdeaVar = new qdea(context);
        jSONObject3.put("forced_country", qdeaVar.b("key_county_abbreviation"));
        jSONObject3.put("forced_city", qdeaVar.b("key_city_abbreviation"));
        int i10 = -1;
        if (z10) {
            List<qdbe> list = qdcdVar.f4436s;
            if (list == null) {
                return jSONObject3;
            }
            JSONArray jSONArray2 = new JSONArray();
            for (qdbe qdbeVar : list) {
                if ((TextUtils.isEmpty(qdbeVar.f4363e) && TextUtils.isEmpty(qdbeVar.f4360b) && TextUtils.isEmpty(qdbeVar.f4361c)) || (i5 = qdbeVar.f4367i) == i10) {
                    jSONObject2 = jSONObject3;
                    jSONArray = jSONArray2;
                } else {
                    qdcdVar.f4440w = qdbeVar.f4377s;
                    jSONObject2 = jSONObject3;
                    jSONArray = jSONArray2;
                    jSONArray.put(b(qdbeVar.f4363e, qdbeVar.f4364f, qdbeVar.f4365g, qdbeVar.f4366h, i5, qdcdVar.f4426i, qdbeVar.f4368j, qdbeVar.f4369k, qdbeVar.f4371m, 0, qdbeVar.f4372n, qdbeVar.f4375q, qdbeVar.f4370l, qdbeVar.f4378t, qdbeVar.f4380v, qdbeVar.f4359a));
                }
                qdcdVar = this;
                jSONArray2 = jSONArray;
                jSONObject3 = jSONObject2;
                i10 = -1;
            }
            jSONObject = jSONObject3;
            jSONObject.put("package_compete_list", jSONArray2);
        } else {
            jSONObject = jSONObject3;
            if ((!TextUtils.isEmpty(qdcdVar.f4420c) || !TextUtils.isEmpty(qdcdVar.f4423f) || !TextUtils.isEmpty(qdcdVar.f4424g)) && (i4 = qdcdVar.f4428k) != -1) {
                jSONObject.put("package_compete", b(qdcdVar.f4420c, qdcdVar.f4421d, qdcdVar.f4422e, qdcdVar.f4427j, i4, qdcdVar.f4426i, qdcdVar.f4429l, qdcdVar.f4430m, qdcdVar.f4431n, qdcdVar.f4432o, qdcdVar.f4433p, qdcdVar.f4441x, qdcdVar.f4442y, qdcdVar.A, qdcdVar.B, qdcdVar.C));
                return jSONObject;
            }
        }
        return jSONObject;
    }

    public final hl.qdag f(int i4, String str, String str2, HashMap hashMap) throws IOException {
        IOException e10 = new IOException();
        int i5 = 0;
        while (i5 <= i4) {
            try {
                hl.qdag e11 = fm.qdcg.e("cpi_report", str, hashMap, str2.getBytes(), this.f4434q, this.f4435r);
                r7.qdab.b0("#doRetryPost(): response: " + e11.f21980b);
                return e11;
            } catch (IOException e12) {
                e10 = e12;
                i5++;
                StringBuilder d4 = p.qdab.d("doRetryPost(): URL: ", str, ", Retry count:", i5, " and exception:");
                d4.append(e10.toString());
                r7.qdab.U0(d4.toString());
                if (i5 < i4) {
                    try {
                        Random random = new Random(System.currentTimeMillis());
                        String e13 = fm.qdbe.e(fm.qdbh.f20698b, "mads_cpi_config");
                        int i10 = 10000;
                        if (!TextUtils.isEmpty(e13)) {
                            try {
                                i10 = new JSONObject(e13).optInt("retry_delay", 10000);
                            } catch (Exception unused) {
                            }
                        }
                        Thread.sleep(random.nextInt(i10));
                    } catch (Exception unused2) {
                    }
                }
            }
        }
        throw e10;
    }

    public final String h() {
        String str;
        String str2;
        String str3;
        String str4;
        int i4;
        int i5;
        int i10;
        int i11;
        int i12;
        String str5;
        int i13;
        String message;
        hl.qdag f10;
        String str6;
        qdab.qdaa qdaaVar;
        String g10;
        String str7;
        String str8;
        long j10;
        int i14;
        String str9;
        String str10;
        int i15;
        String str11;
        int i16;
        int i17;
        String str12;
        int i18;
        String str13;
        int i19;
        qdbe.qdab qdabVar;
        int i20;
        HashMap hashMap;
        String str14;
        int i21;
        gk.qdah i22;
        String str15;
        String str16;
        String str17;
        String str18;
        gk.qdah i23;
        String b9;
        int i24 = this.f4430m;
        int i25 = 1;
        if (i24 == 0 || i24 == 17 || i24 == 22) {
            try {
                String e10 = fm.qdbe.e(fm.qdbh.f20698b, "mads_cpi_config");
                if (!TextUtils.isEmpty(e10)) {
                    i25 = new JSONObject(e10).optInt("retry_count", 1);
                }
            } catch (Exception unused) {
            }
        }
        String f02 = qddg.f0("protect_host", "http://san.myadssupport.com/client/ci?sec=2");
        HashMap c4 = c();
        String d4 = d(false);
        if (!qddh.c(this.f4418a) && !qddh.a(fm.qdbh.f20698b)) {
            JSONObject jSONObject = new JSONObject();
            if (!TextUtils.isEmpty(d4)) {
                r7.qdab.K("CPIRequest#doLoadAd, before Base64 load ad request body is " + d4);
                try {
                    if (qdag.f()) {
                        if (f02.contains("?")) {
                            f02 = f02.concat("&gz=1");
                        } else {
                            f02 = f02.concat("?gz=1");
                        }
                        b9 = gm.qdaa.b(gm.qdab.a(d4));
                    } else {
                        b9 = gm.qdab.b(d4);
                    }
                    jSONObject.put("s", b9);
                } catch (Exception unused2) {
                }
                d4 = jSONObject.toString();
            }
        }
        String str19 = "";
        long j11 = -1;
        if (TextUtils.isEmpty(d4)) {
            if (this.D > 0) {
                j11 = System.currentTimeMillis() - this.D;
            }
            String str20 = this.f4423f;
            str2 = this.f4424g;
            str3 = this.f4420c;
            str4 = this.f4421d;
            i4 = this.f4422e;
            i5 = this.f4427j;
            i10 = this.f4428k;
            i11 = this.f4431n;
            i12 = this.f4430m;
            str5 = this.f4437t;
            i13 = this.f4440w;
            message = "empty post data";
            str = str20;
        } else {
            r7.qdab.K("CPIRequest#doLoadAd, hostUrl is " + f02);
            r7.qdab.K("CPIRequest#doLoadAd, load ad request heads is " + c4);
            aj.qdbg.r(new StringBuilder("CPIRequest#doLoadAd, load ad request body is "), d4);
            try {
                Pair<String, String> d9 = qddh.d(f02);
                if (!TextUtils.isEmpty((CharSequence) d9.second)) {
                    c4.put("Host", (String) d9.second);
                }
                f10 = f(i25, (String) d9.first, d4, c4);
                r7.qdab.K("getStatusCode : " + f10.f21981c);
            } catch (IOException e11) {
                r7.qdab.K("error : " + e11.getMessage());
                if (this.D > 0) {
                    j11 = System.currentTimeMillis() - this.D;
                }
                String str21 = this.f4423f;
                String str22 = this.f4424g;
                String str23 = this.f4420c;
                String str24 = this.f4421d;
                int i26 = this.f4422e;
                int i27 = this.f4427j;
                int i28 = this.f4428k;
                int i29 = this.f4431n;
                str = str21;
                str2 = str22;
                str3 = str23;
                str4 = str24;
                i4 = i26;
                i5 = i27;
                i10 = i28;
                i11 = i29;
                i12 = this.f4430m;
                str5 = this.f4437t;
                i13 = this.f4440w;
                message = e11.getMessage();
            }
            if (f10.f21981c != 200) {
                if (this.D > 0) {
                    j11 = System.currentTimeMillis() - this.D;
                }
                String str25 = this.f4423f;
                String str26 = this.f4424g;
                String str27 = this.f4420c;
                String str28 = this.f4421d;
                int i30 = this.f4422e;
                int i31 = this.f4427j;
                int i32 = this.f4428k;
                int i33 = this.f4431n;
                int i34 = this.f4430m;
                String str29 = this.f4437t;
                int i35 = this.f4440w;
                g10 = androidx.datastore.preferences.protobuf.qdae.g(new StringBuilder(), f10.f21981c, "");
                str7 = this.B;
                str8 = this.C;
                j10 = j11;
                i14 = i35;
                str9 = str26;
                str10 = str27;
                i15 = i33;
                str11 = str29;
                i16 = i30;
                i17 = i32;
                str12 = str28;
                i18 = i31;
                str13 = str25;
                i19 = i34;
                qdaaVar = null;
                np.qdaf.E(false, str13, str9, str10, str12, i16, i18, i17, i15, i19, str11, i14, g10, str7, str8, "", j10);
                str6 = "fail";
                qdabVar = this.f4443z;
                if (qdabVar != null) {
                    qdabVar.a(str6);
                }
                r7.qdab.K("syncLoadAdFsyncLoadAdForCpiorCPI->jsonStr:".concat(str6));
                i20 = this.f4428k;
                if (i20 != 3 && i20 != 4) {
                    if (!TextUtils.isEmpty(this.f4424g)) {
                        hashMap = gk.qdah.f21247w;
                        str14 = this.f4420c;
                    } else {
                        hashMap = gk.qdah.f21247w;
                        str14 = this.f4424g;
                    }
                    hashMap.remove(str14);
                    i21 = this.f4430m;
                    if (i21 != 0 || i21 == 17 || i21 == 7 || i21 == 22) {
                        if (!TextUtils.isEmpty(str6)) {
                            if (TextUtils.isEmpty(this.f4424g) && TextUtils.isEmpty(this.f4420c)) {
                                if (!TextUtils.isEmpty(this.f4423f)) {
                                    gk.qdah.f21247w.remove(this.f4423f);
                                    new qdea(fm.qdbh.f20698b, "ad_settings").h(this.f4423f);
                                }
                            }
                            vi.qdca.a().b(new qdcb(this), 2);
                        } else {
                            StringBuilder sb2 = new StringBuilder("cpiReportCacheWork-->:");
                            sb2.append(this.f4424g);
                            sb2.append("--mPkgName:");
                            aj.qdbg.r(sb2, this.f4420c);
                            if (TextUtils.isEmpty(this.f4424g) && TextUtils.isEmpty(this.f4420c)) {
                                if (!TextUtils.isEmpty(this.f4423f)) {
                                    gk.qdah.f21247w.remove(this.f4423f);
                                }
                            }
                            gk.qdah i36 = gk.qdae.k(this.f4418a).i(this.f4420c, this.f4424g);
                            if (i36 == null) {
                                i36 = gk.qdae.k(this.f4418a).j(this.f4423f);
                            }
                            if (i36 != null) {
                                i36.f21250a = this.f4424g;
                                i36.f21252c = this.f4423f;
                                i36.f21254e = this.f4421d;
                                i36.f21255f = this.f4422e;
                                i36.f21251b = this.f4430m;
                                i36.f21256g = this.f4425h;
                                i36.a("s2s_track_status", "1");
                                i36.f21259j = System.currentTimeMillis();
                                gk.qdae.k(this.f4418a).o(i36, qdaaVar);
                                np.qdaf.C(i36.f21266q, this.f4424g, this.f4420c, "success", this.f4423f);
                            }
                        }
                    }
                    if (this.f4430m == 18) {
                        if (TextUtils.isEmpty(str6)) {
                            if (!TextUtils.isEmpty(this.f4420c) && (i23 = gk.qdae.k(this.f4418a).i(this.f4420c, this.f4424g)) != null) {
                                i23.a("s2s_track_status", "0");
                                i23.f21259j = System.currentTimeMillis();
                                gk.qdae.k(this.f4418a).o(i23, qdaaVar);
                                str15 = i23.f21266q;
                                str17 = this.f4424g;
                                str18 = this.f4420c;
                                str16 = "failed";
                                np.qdaf.C(str15, str17, str18, str16, this.f4423f);
                            }
                        } else if (!TextUtils.isEmpty(this.f4420c) && (i22 = gk.qdae.k(this.f4418a).i(this.f4420c, this.f4424g)) != null) {
                            i22.a("s2s_track_status", "1");
                            i22.f21259j = System.currentTimeMillis();
                            gk.qdae.k(this.f4418a).o(i22, qdaaVar);
                            str15 = i22.f21266q;
                            str16 = "success";
                            str17 = this.f4424g;
                            str18 = this.f4420c;
                            np.qdaf.C(str15, str17, str18, str16, this.f4423f);
                        }
                    }
                }
                return str6;
            }
            str6 = f10.f21980b;
            androidx.datastore.preferences.protobuf.qdae.l("CPIRequest#doLoadAd, load ad result is ", str6);
            if (str6 == null || TextUtils.isEmpty(str6)) {
                str6 = "success";
            } else {
                try {
                    str19 = new JSONObject(str6).optString("ret_code");
                } catch (JSONException unused3) {
                }
            }
            String str30 = str19;
            if (this.D > 0) {
                j11 = System.currentTimeMillis() - this.D;
            }
            np.qdaf.E(true, this.f4423f, this.f4424g, this.f4420c, this.f4421d, this.f4422e, this.f4427j, this.f4428k, this.f4431n, this.f4430m, this.f4437t, this.f4440w, null, this.B, this.C, str30, j11);
            BroadcastReceiver.PendingResult pendingResult = AppPkgReceiver.f16255c;
            if (pendingResult != null) {
                pendingResult.finish();
                qdaaVar = null;
                AppPkgReceiver.f16255c = null;
            } else {
                qdaaVar = null;
            }
            qdabVar = this.f4443z;
            if (qdabVar != null) {
            }
            r7.qdab.K("syncLoadAdFsyncLoadAdForCpiorCPI->jsonStr:".concat(str6));
            i20 = this.f4428k;
            if (i20 != 3) {
                if (!TextUtils.isEmpty(this.f4424g)) {
                }
                hashMap.remove(str14);
                i21 = this.f4430m;
                if (i21 != 0) {
                }
                if (!TextUtils.isEmpty(str6)) {
                }
            }
            return str6;
        }
        String str31 = this.B;
        str8 = this.C;
        j10 = j11;
        i14 = i13;
        g10 = message;
        str7 = str31;
        str9 = str2;
        str10 = str3;
        i17 = i10;
        i15 = i11;
        str11 = str5;
        str13 = str;
        str12 = str4;
        i18 = i5;
        i19 = i12;
        i16 = i4;
        qdaaVar = null;
        np.qdaf.E(false, str13, str9, str10, str12, i16, i18, i17, i15, i19, str11, i14, g10, str7, str8, "", j10);
        str6 = "fail";
        qdabVar = this.f4443z;
        if (qdabVar != null) {
        }
        r7.qdab.K("syncLoadAdFsyncLoadAdForCpiorCPI->jsonStr:".concat(str6));
        i20 = this.f4428k;
        if (i20 != 3) {
        }
        return str6;
    }
}