汇多多.apk(点击下载) / b.java


package io.dcloud.e.c.h;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.text.TextUtils;
import android.util.Base64;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.facebook.common.callercontext.ContextChain;
import com.taobao.weex.common.WXConfig;
import com.taobao.weex.el.parse.Operators;
import com.taobao.weex.performance.WXInstanceApm;
import com.taobao.weex.ui.component.WXBasicComponentType;
import io.dcloud.common.DHInterface.IApp;
import io.dcloud.common.DHInterface.ICallBack;
import io.dcloud.common.DHInterface.IWebview;
import io.dcloud.common.adapter.util.AndroidResources;
import io.dcloud.common.adapter.util.DeviceInfo;
import io.dcloud.common.adapter.util.Logger;
import io.dcloud.common.adapter.util.PlatformUtil;
import io.dcloud.common.adapter.util.SP;
import io.dcloud.common.constant.AbsoluteConst;
import io.dcloud.common.constant.DataInterface;
import io.dcloud.common.util.ADUtils;
import io.dcloud.common.util.AESUtil;
import io.dcloud.common.util.AppRuntime;
import io.dcloud.common.util.BaseInfo;
import io.dcloud.common.util.CreateShortResultReceiver;
import io.dcloud.common.util.IOUtil;
import io.dcloud.common.util.LauncherUtil;
import io.dcloud.common.util.Md5Utils;
import io.dcloud.common.util.NetTool;
import io.dcloud.common.util.NetworkTypeUtil;
import io.dcloud.common.util.PdrUtil;
import io.dcloud.common.util.TelephonyUtil;
import io.dcloud.common.util.ThreadPool;
import io.dcloud.common.util.ZipUtils;
import io.dcloud.common.util.hostpicker.HostPicker;
import io.dcloud.common.util.net.NetWork;
import io.dcloud.e.c.g;
import io.dcloud.feature.internal.sdk.SDK;
import io.dcloud.sdk.core.util.Const;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;

public class b {

    /* access modifiers changed from: package-private */
    public class a implements HostPicker.HostPickCallback {
        final /* synthetic */ String a;
        final /* synthetic */ HashMap b;

        a(String str, HashMap hashMap) {
            this.a = str;
            this.b = hashMap;
        }

        @Override // io.dcloud.common.util.hostpicker.HostPicker.HostPickCallback
        public boolean doRequest(HostPicker.Host host) {
            byte[] httpPost = NetTool.httpPost(host.getRealHost(), this.a, (HashMap<String, String>) this.b, false);
            if (httpPost == null) {
                return false;
            }
            JSONObject jSONObject = null;
            try {
                jSONObject = new JSONObject(new String(httpPost, "utf-8"));
            } catch (JSONException e) {
                e.printStackTrace();
            } catch (UnsupportedEncodingException e2) {
                e2.printStackTrace();
            }
            Logger.d("commitTid", jSONObject);
            return true;
        }

        @Override // io.dcloud.common.util.hostpicker.HostPicker.HostPickCallback
        public void onNoOnePicked() {
        }

        @Override // io.dcloud.common.util.hostpicker.HostPicker.HostPickCallback
        public void onOneSelected(HostPicker.Host host) {
        }
    }

    /* access modifiers changed from: package-private */
    /* renamed from: io.dcloud.e.c.h.b$b  reason: collision with other inner class name */
    public class C0041b implements HostPicker.HostPickCallback {
        final /* synthetic */ String a;
        final /* synthetic */ HashMap b;

        C0041b(String str, HashMap hashMap) {
            this.a = str;
            this.b = hashMap;
        }

        @Override // io.dcloud.common.util.hostpicker.HostPicker.HostPickCallback
        public boolean doRequest(HostPicker.Host host) {
            byte[] httpPost = NetTool.httpPost(host.getRealHost(), this.a, (HashMap<String, String>) this.b, false);
            if (httpPost == null) {
                return false;
            }
            JSONObject jSONObject = null;
            try {
                jSONObject = new JSONObject(new String(httpPost, StandardCharsets.UTF_8));
            } catch (JSONException unused) {
            }
            Logger.d("commitTid", jSONObject);
            return true;
        }

        @Override // io.dcloud.common.util.hostpicker.HostPicker.HostPickCallback
        public void onNoOnePicked() {
        }

        @Override // io.dcloud.common.util.hostpicker.HostPicker.HostPickCallback
        public void onOneSelected(HostPicker.Host host) {
        }
    }

    class c implements Runnable {
        final /* synthetic */ IApp a;
        final /* synthetic */ int b;
        final /* synthetic */ String c;
        final /* synthetic */ String d;
        final /* synthetic */ ICallBack e;

        class a implements HostPicker.HostPickCallback {
            final /* synthetic */ String a;
            final /* synthetic */ HashMap b;
            final /* synthetic */ HashMap c;
            final /* synthetic */ SharedPreferences d;

            a(String str, HashMap hashMap, HashMap hashMap2, SharedPreferences sharedPreferences) {
                this.a = str;
                this.b = hashMap;
                this.c = hashMap2;
                this.d = sharedPreferences;
            }

            @Override // io.dcloud.common.util.hostpicker.HostPicker.HostPickCallback
            public boolean doRequest(HostPicker.Host host) {
                byte[] httpPost = NetTool.httpPost(host.getRealHost(), this.a, (HashMap<String, String>) this.b, false, true);
                if (httpPost == null) {
                    return false;
                }
                SP.setBundleData(c.this.a.getActivity(), "pdr", SP.REPORT_UNI_VERIFY_GYUID, "");
                if (this.c.containsKey(AbsoluteConst.XML_APPS)) {
                    this.d.edit().putLong(AbsoluteConst.COMMIT_APP_LIST_TIME, System.currentTimeMillis()).commit();
                }
                c cVar = c.this;
                ICallBack iCallBack = cVar.e;
                if (iCallBack != null) {
                    iCallBack.onCallBack(1, new Object[]{cVar.a, cVar.c, httpPost});
                }
                return true;
            }

            @Override // io.dcloud.common.util.hostpicker.HostPicker.HostPickCallback
            public void onNoOnePicked() {
            }

            @Override // io.dcloud.common.util.hostpicker.HostPicker.HostPickCallback
            public void onOneSelected(HostPicker.Host host) {
            }
        }

        c(IApp iApp, int i, String str, String str2, ICallBack iCallBack) {
            this.a = iApp;
            this.b = i;
            this.c = str;
            this.d = str2;
            this.e = iCallBack;
        }

        public void run() {
            String str;
            HashMap hashMap = new HashMap();
            HashMap hashMap2 = new HashMap();
            hashMap2.put(NetWork.CONTENT_TYPE, "application/x-www-form-urlencoded;charset=utf-8");
            SharedPreferences orCreateBundle = SP.getOrCreateBundle(this.a.getActivity(), AbsoluteConst.START_STATISTICS_DATA);
            HashMap<Object, Object> a2 = b.a(this.a, orCreateBundle);
            a2.put("gudi", Integer.valueOf(this.b));
            hashMap.putAll(a2);
            try {
                hashMap.put("paid", this.c);
                hashMap.put("urv", this.d);
            } catch (Exception e2) {
                e2.printStackTrace();
            }
            if (hashMap.size() != 0) {
                do {
                    str = null;
                } while (hashMap.values().remove(null));
                do {
                } while (hashMap.values().remove("null"));
                try {
                    str = URLEncoder.encode(Base64.encodeToString(AESUtil.encrypt(this.a.getConfusionMgr().getSK(), this.a.getConfusionMgr().getSIV(), ZipUtils.zipString(new JSONObject(hashMap).toString())), 2), "utf-8");
                } catch (UnsupportedEncodingException e3) {
                    e3.printStackTrace();
                }
                ArrayList arrayList = new ArrayList();
                arrayList.add(new HostPicker.Host("YHx8eHsyJyd7OSZsa2RnfWwmZm18JmtmJ2tnZGRta3wneGR9e2l4eCd7fGl6fH14J346", HostPicker.Host.PriorityEnum.FIRST));
                arrayList.add(new HostPicker.Host("YHx8eHsyJyd7OiZsa2RnfWwmZm18JmtmJ2tnZGRta3wneGR9e2l4eCd7fGl6fH14J346", HostPicker.Host.PriorityEnum.NORMAL));
                arrayList.add(new HostPicker.Host("YHx8eHsyJydrO2k/Pzs7OCU7a207JTw5Pm0lMWowOSU9Pzk4aT9tbjhtaj8mant4aXh4JmtnZSdgfHx4J2tpezo=", HostPicker.Host.PriorityEnum.BACKUP));
                HostPicker.getInstance().pickSuitHost(this.a.getActivity(), arrayList, "StartUp", new a("edata=" + str, hashMap2, hashMap, orCreateBundle));
            }
        }
    }

    public static HashMap<Object, Object> a(IApp iApp, SharedPreferences sharedPreferences) {
        HashMap<Object, Object> hashMap = new HashMap<>();
        try {
            Activity activity = iApp.getActivity();
            boolean hasPrivacyForNotShown = AppRuntime.hasPrivacyForNotShown(activity);
            String str = null;
            hashMap.putAll(DataInterface.getStartupUrlBaseData(activity, iApp.obtainAppId(), BaseInfo.getLaunchType(activity.getIntent()), null, hasPrivacyForNotShown));
            hashMap.put("st", Long.valueOf(BaseInfo.run5appEndTime));
            hashMap.put("pn", activity.getPackageName());
            hashMap.put(CreateShortResultReceiver.KEY_VERSIONNAME, iApp.obtainAppVersionName());
            hashMap.put("pv", AndroidResources.versionName);
            hashMap.put("uat", Integer.valueOf(BaseInfo.isUniAppAppid(iApp) ? 1 : 0));
            if (SDK.isUniMPSDK()) {
                try {
                    hashMap.put("name", activity.getApplicationInfo().loadLabel(activity.getPackageManager()));
                } catch (Exception unused) {
                    hashMap.put("name", iApp.obtainAppName());
                }
            } else {
                hashMap.put("name", iApp.obtainAppName());
            }
            try {
                hashMap.put("pname", activity.getApplicationInfo().loadLabel(activity.getPackageManager()));
            } catch (Exception unused2) {
            }
            hashMap.put("it", Integer.valueOf(SDK.isUniMPSDK() ? 1 : 0));
            if (SDK.isUniMPSDK()) {
                boolean checkClass = PlatformUtil.checkClass(iApp.getConfusionMgr().getGDTClassName());
                boolean checkClass2 = PlatformUtil.checkClass(iApp.getConfusionMgr().getCSJClassName());
                boolean checkClass3 = PlatformUtil.checkClass(iApp.getConfusionMgr().getKSClassName());
                JSONObject jSONObject = new JSONObject();
                JSONObject jSONObject2 = new JSONObject();
                String str2 = "1";
                jSONObject2.put("r", checkClass2 ? str2 : WXInstanceApm.VALUE_ERROR_CODE_DEFAULT);
                jSONObject.put(Const.TYPE_CSJ, jSONObject2);
                JSONObject jSONObject3 = new JSONObject();
                jSONObject3.put("r", checkClass ? str2 : WXInstanceApm.VALUE_ERROR_CODE_DEFAULT);
                jSONObject.put(Const.TYPE_GDT, jSONObject3);
                JSONObject jSONObject4 = new JSONObject();
                if (!checkClass3) {
                    str2 = WXInstanceApm.VALUE_ERROR_CODE_DEFAULT;
                }
                jSONObject4.put("r", str2);
                jSONObject.put(Const.TYPE_KS, jSONObject4);
                hashMap.put("cad", jSONObject.toString());
            } else {
                hashMap.put("psdk", 0);
            }
            String bundleData = SP.getBundleData(activity, "pdr", SP.REPORT_UNI_VERIFY_GYUID);
            if (!TextUtils.isEmpty(bundleData)) {
                hashMap.put("uvs", bundleData);
            }
            if (PdrUtil.isSupportOaid()) {
                Object obj = DeviceInfo.oaids;
                if (obj == null) {
                    obj = Operators.OR;
                }
                hashMap.put("oaid", obj);
            }
            if (BaseInfo.isUniAppAppid(iApp)) {
                a(iApp, hashMap);
            }
            hashMap.put("dcid", AppRuntime.getDCloudDeviceID(activity));
            if (TextUtils.isEmpty(BaseInfo.sChannel)) {
                try {
                    str = AndroidResources.getMetaValue("DCLOUD_STREAMAPP_CHANNEL");
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (!TextUtils.isEmpty(str)) {
                    hashMap.put("mc", str);
                } else {
                    hashMap.put("mc", "");
                }
            } else {
                hashMap.put("mc", BaseInfo.sChannel);
            }
            if (!hasPrivacyForNotShown) {
                if ((System.currentTimeMillis() - sharedPreferences.getLong(AbsoluteConst.COMMIT_APP_LIST_TIME, 0)) / 100000 >= 26000) {
                    if (!BaseInfo.isChannelGooglePlay()) {
                        JSONObject jSONObject5 = new JSONObject();
                        jSONObject5.put("pn", LauncherUtil.getLauncherPackageName(activity));
                        hashMap.put("launcher", jSONObject5.toString());
                    }
                    if (!TextUtils.isEmpty(sharedPreferences.getString(AbsoluteConst.GEO_DATA, ""))) {
                        hashMap.put("pos", sharedPreferences.getString(AbsoluteConst.GEO_DATA, ""));
                    }
                }
            }
        } catch (Exception e2) {
            e2.printStackTrace();
        }
        return hashMap;
    }

    private static Map<String, Object> b(Context context, String str, String str2, int i, String str3, HashMap<String, Object> hashMap) {
        String str4;
        String str5;
        try {
            str4 = URLEncoder.encode(Build.MODEL, "utf-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            str4 = "";
        }
        try {
            str5 = DeviceInfo.sApplicationContext.getPackageManager().getPackageInfo(DeviceInfo.sApplicationContext.getPackageName(), 0).versionName;
        } catch (Exception e2) {
            e2.printStackTrace();
            str5 = "";
        }
        String imei = TelephonyUtil.getIMEI(context, true, true);
        HashMap hashMap2 = new HashMap();
        hashMap2.put(ContextChain.TAG_PRODUCT, "a");
        hashMap2.put("appid", str);
        hashMap2.put(CreateShortResultReceiver.KEY_VERSIONNAME, str5);
        hashMap2.put("at", Integer.valueOf(i));
        hashMap2.put(WXConfig.os, Integer.valueOf(Build.VERSION.SDK_INT));
        hashMap2.put("adpid", str3);
        if (imei.endsWith("&ie=1")) {
            imei = imei.replace("&ie=1", "");
            hashMap2.put("ie", 1);
        } else if (imei.endsWith("&ie=0")) {
            imei = imei.replace("&ie=0", "");
            hashMap2.put("ie", 0);
        }
        hashMap2.put("imei", imei);
        hashMap2.put("md", str4);
        hashMap2.put("vd", Build.MANUFACTURER);
        hashMap2.put("net", Integer.valueOf(NetworkTypeUtil.getNetworkType(DeviceInfo.sApplicationContext)));
        hashMap2.put("vb", "1.9.9.81503");
        hashMap2.put("t", Long.valueOf(System.currentTimeMillis()));
        if (TextUtils.isEmpty(BaseInfo.sChannel)) {
            String str6 = null;
            try {
                str6 = AndroidResources.getMetaValue("DCLOUD_STREAMAPP_CHANNEL");
            } catch (Exception e3) {
                e3.printStackTrace();
            }
            if (!TextUtils.isEmpty(str6)) {
                hashMap2.put("mc", str6);
            } else {
                hashMap2.put("mc", "");
            }
        } else {
            hashMap2.put("mc", BaseInfo.sChannel);
        }
        hashMap2.put("paid", str2);
        if (hashMap != null) {
            hashMap2.putAll(hashMap);
        }
        return hashMap2;
    }

    private static void a(IApp iApp, HashMap<Object, Object> hashMap) {
        String str;
        JSONArray jSONArray;
        StringBuilder sb = new StringBuilder();
        try {
            str = IOUtil.toString(iApp.getActivity().getAssets().open("dcloud_uniplugins.json"));
        } catch (Exception unused) {
            str = null;
        }
        if (!PdrUtil.isEmpty(str)) {
            try {
                JSONArray jSONArray2 = JSON.parseObject(str).getJSONArray("nativePlugins");
                if (jSONArray2 != null && jSONArray2.size() > 0) {
                    for (int i = 0; i < jSONArray2.size(); i++) {
                        com.alibaba.fastjson.JSONObject jSONObject = jSONArray2.getJSONObject(i);
                        if (!(jSONObject == null || (jSONArray = jSONObject.getJSONArray("plugins")) == null || jSONArray.size() <= 0)) {
                            for (int i2 = 0; i2 < jSONArray.size(); i2++) {
                                com.alibaba.fastjson.JSONObject jSONObject2 = jSONArray.getJSONObject(i2);
                                if (jSONObject2 != null && jSONObject2.containsKey("name")) {
                                    sb.append(jSONObject2.getString("name"));
                                    sb.append(",");
                                }
                            }
                        }
                    }
                }
            } catch (Exception unused2) {
            }
        }
        if (sb.length() > 0) {
            sb.deleteCharAt(sb.length() - 1);
            hashMap.put("ups", sb.toString());
        }
    }

    public static void a(Context context, String str, String str2, String str3, int i, String str4, String str5, JSONObject jSONObject, String str6, String str7, String str8, String str9, HashMap<String, Object> hashMap) {
        try {
            URLEncoder.encode(Build.MODEL, "utf-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        try {
            String str10 = DeviceInfo.sApplicationContext.getPackageManager().getPackageInfo(DeviceInfo.sApplicationContext.getPackageName(), 0).versionName;
        } catch (Exception e2) {
            e2.printStackTrace();
        }
        TelephonyUtil.getIMEI(context, true, true);
        ArrayList arrayList = new ArrayList();
        if (i == 1) {
            arrayList.add(new HostPicker.Host("YHx8eHsyJyd8OSZsa2RnfWwmZm18JmtmJ2tnZGRta3wneGR9e2l4eCdpa3xhZ2Y=", HostPicker.Host.PriorityEnum.FIRST));
            arrayList.add(new HostPicker.Host("YHx8eHsyJyd8OiZsa2RnfWwmZm18JmtmJ2tnZGRta3wneGR9e2l4eCdpa3xhZ2Y=", HostPicker.Host.PriorityEnum.NORMAL));
            arrayList.add(new HostPicker.Host("YHx8eHsyJyc6OzswaTw6aiU7bWs7JTxtaz0lMDlrMCU6bm1rMTE/MDw/aTAmant4aXh4JmtnZSdgfHx4J2tpaQ==", HostPicker.Host.PriorityEnum.BACKUP));
        } else {
            arrayList.add(new HostPicker.Host("YHx8eHsyJydpezkmbGtkZ31sJmZtfCZrZidrZ2RkbWt8J3hkfXtpeHgnaWt8YWdm", HostPicker.Host.PriorityEnum.FIRST));
            arrayList.add(new HostPicker.Host("YHx8eHsyJydpezombGtkZ31sJmZtfCZrZidrZ2RkbWt8J3hkfXtpeHgnaWt8YWdm", HostPicker.Host.PriorityEnum.NORMAL));
            arrayList.add(new HostPicker.Host("YHx8eHsyJyc8bTFqOGowaSU4bDw8JTw6bmwlMTA7bCU6P2wxMTlsbGw6Ozomant4aXh4JmtnZSdgfHx4J2tpaQ==", HostPicker.Host.PriorityEnum.BACKUP));
        }
        Map<String, Object> b = b(context, str, str3, i, str8, hashMap);
        if (str6 != null) {
            b.put("mediaId", str6);
        }
        if (str7 != null) {
            b.put("slotId", str7);
        }
        b.put("tid", str2);
        if (i == 32) {
            b.put("dec", str4);
            b.put("dem", str5);
        }
        if (i == 41 && jSONObject != null && str6 == null) {
            if (jSONObject.has(WXBasicComponentType.IMG)) {
                b.put(WXBasicComponentType.IMG, Md5Utils.md5(jSONObject.optString(WXBasicComponentType.IMG)).toLowerCase(Locale.ENGLISH));
            }
            if (jSONObject.has("dw")) {
                b.put("dw", jSONObject.optString("dw"));
            }
            if (jSONObject.has("dh")) {
                b.put("dh", jSONObject.optString("dh"));
            }
            if (jSONObject.has("click_coord")) {
                b.put("click_coord", jSONObject.optJSONObject("click_coord").toString());
            }
        }
        String str11 = null;
        try {
            str11 = URLEncoder.encode(Base64.encodeToString(AESUtil.encrypt(io.dcloud.f.a.c(), io.dcloud.f.a.b(), ZipUtils.zipString(new JSONObject(b).toString())), 2), "utf-8");
        } catch (UnsupportedEncodingException e3) {
            e3.printStackTrace();
        }
        String str12 = "edata=" + str11;
        try {
            HashMap hashMap2 = new HashMap();
            try {
                if (!PdrUtil.isEmpty(str9) && str9.equalsIgnoreCase("webview")) {
                    Object ADHandlerMethod = ADUtils.ADHandlerMethod("get", "ua-webview");
                    if (ADHandlerMethod instanceof String) {
                        hashMap2.put(IWebview.USER_AGENT, (String) ADHandlerMethod);
                    }
                }
            } catch (Exception unused) {
            }
            HostPicker.getInstance().pickSuitHost(context, arrayList, "CAA_" + i, new a(str12, hashMap2));
        } catch (Exception e4) {
            Logger.p("CommitDataUtil", e4.getMessage());
        }
    }

    public static void a(Context context, String str, String str2, int i, String str3, HashMap<String, Object> hashMap) {
        String str4;
        Map<String, Object> b = b(context, str, str2, i, str3, hashMap);
        ArrayList arrayList = new ArrayList();
        arrayList.add(new HostPicker.Host("YHx8eHsyJydpejkmbGtkZ31sJmZtfCZrZidrZ2RkbWt8J3hkfXtpeHgnent4", HostPicker.Host.PriorityEnum.FIRST));
        arrayList.add(new HostPicker.Host("YHx8eHsyJydpejombGtkZ31sJmZtfCZrZidrZ2RkbWt8J3hkfXtpeHgnent4", HostPicker.Host.PriorityEnum.NORMAL));
        arrayList.add(new HostPicker.Host("YHx8eHsyJyc8bTFqOGowaSU4bDw8JTw6bmwlMTA7bCU6P2wxMTlsbGw6Ozomant4aXh4JmtnZSdgfHx4J2tpeg==", HostPicker.Host.PriorityEnum.BACKUP));
        try {
            str4 = URLEncoder.encode(Base64.encodeToString(AESUtil.encrypt(io.dcloud.f.a.c(), io.dcloud.f.a.b(), ZipUtils.zipString(new JSONObject(b).toString())), 2), "utf-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            str4 = null;
        }
        HostPicker.getInstance().pickSuitHost(context, arrayList, "RSP", new C0041b("edata=" + str4, new HashMap()));
    }

    public static void a(String str, String str2, String str3, String str4) {
        NetTool.httpGet("https://96f0e031-f37a-48ef-84c7-2023f6360c0a.bspapp.com/http/rewarded-video/report?p=a&t=" + str4 + "&a=" + str + "&c=" + str2 + "&m=" + PdrUtil.encodeURL(str3));
    }

    public static void a(IApp iApp, String str, int i, String str2, ICallBack iCallBack) {
        if (!g.b() || a.d(iApp.getActivity(), iApp.obtainAppId())) {
            ThreadPool.self().addThreadTask(new c(iApp, i, str, str2, iCallBack));
        }
    }
}