iKredit v1.2.0.3版本的 MD5 值为:2c00c5c79eecbd6be4c3c546c28d778d

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


package com.appsflyer.internal;

import android.content.pm.PackageManager;
import android.os.Build;
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.AppsFlyerLibCore;
import com.appsflyer.AppsFlyerProperties;
import com.appsflyer.ServerConfigHandler;
import com.appsflyer.ServerParameters;
import com.appsflyer.internal.model.event.BackgroundEvent;
import com.appsflyer.internal.model.event.ProxyEvent;
import java.text.SimpleDateFormat;
import java.util.Locale;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public final class ai {

    public static ai f189;

    private boolean f191;

    public boolean f192;

    private JSONArray f193;

    private JSONObject f194;

    private boolean f195;

    private int f197;

    private boolean f190 = true;

    private String f196 = "-1";

    public ai() {
        this.f197 = 0;
        boolean z = AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.DPM, false);
        this.f195 = z;
        this.f192 = true ^ z;
        this.f193 = new JSONArray();
        this.f197 = 0;
        this.f191 = false;
    }

    public final synchronized void m172(String str) {
        this.f196 = str;
    }

    public final synchronized void m171() {
        this.f191 = true;
        m173("r_debugging_on", new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ", Locale.ENGLISH).format(Long.valueOf(System.currentTimeMillis())), new String[0]);
    }

    public final synchronized void m174() {
        m173("r_debugging_off", new SimpleDateFormat("yyyy-MM-dd HH:mm:ssZ", Locale.ENGLISH).format(Long.valueOf(System.currentTimeMillis())), new String[0]);
        this.f191 = false;
        this.f190 = false;
    }

    public final synchronized void m176() {
        this.f194 = null;
        this.f193 = null;
        f189 = null;
    }

    private boolean m169() {
        if (this.f192) {
            return this.f190 || this.f191;
        }
        return false;
    }

    private synchronized void m167(String str, String str2, String str3, String str4, String str5, String str6) {
        try {
            this.f194.put("brand", str);
            this.f194.put("model", str2);
            this.f194.put("platform", "Android");
            this.f194.put("platform_version", str3);
            if (str4 != null && str4.length() > 0) {
                this.f194.put(ServerParameters.ADVERTISING_ID_PARAM, str4);
            }
            if (str5 != null && str5.length() > 0) {
                this.f194.put("imei", str5);
            }
            if (str6 != null && str6.length() > 0) {
                this.f194.put("android_id", str6);
            }
        } catch (Throwable unused) {
        }
    }

    private synchronized void m166(String str, String str2, String str3, String str4) {
        try {
            this.f194.put("sdk_version", str);
            if (str2 != null && str2.length() > 0) {
                this.f194.put("devkey", str2);
            }
            if (str3 != null && str3.length() > 0) {
                this.f194.put("originalAppsFlyerId", str3);
            }
            if (str4 != null && str4.length() > 0) {
                this.f194.put("uid", str4);
            }
        } catch (Throwable unused) {
        }
    }

    private synchronized void m168(String str, String str2, String str3, String str4) {
        if (str != null) {
            try {
                if (str.length() > 0) {
                    this.f194.put("app_id", str);
                }
            } catch (Throwable unused) {
                return;
            }
        }
        if (str2 != null && str2.length() > 0) {
            this.f194.put("app_version", str2);
        }
        if (str3 != null && str3.length() > 0) {
            this.f194.put("channel", str3);
        }
        if (str4 != null && str4.length() > 0) {
            this.f194.put("preInstall", str4);
        }
    }

    public final synchronized void m173(String str, String str2, String... strArr) {
        if (m169()) {
            if (this.f197 < 98304) {
                try {
                    long currentTimeMillis = System.currentTimeMillis();
                    String str3 = "";
                    if (strArr.length > 0) {
                        StringBuilder sb = new StringBuilder();
                        for (int length = strArr.length - 1; length > 0; length--) {
                            sb.append(strArr[length]);
                            sb.append(", ");
                        }
                        sb.append(strArr[0]);
                        str3 = sb.toString();
                    }
                    String format = new SimpleDateFormat("MM-dd HH:mm:ss.SSS", Locale.ENGLISH).format(Long.valueOf(currentTimeMillis));
                    String format2 = str != null ? String.format("%18s %5s _/%s [%s] %s %s", format, Long.valueOf(Thread.currentThread().getId()), AppsFlyerLibCore.LOG_TAG, str, str2, str3) : String.format("%18s %5s %s/%s %s", format, Long.valueOf(Thread.currentThread().getId()), str2, AppsFlyerLibCore.LOG_TAG, str3);
                    this.f193.put(format2);
                    this.f197 += format2.getBytes().length;
                } catch (Throwable unused) {
                }
            }
        }
    }

    private synchronized String m170() {
        String str;
        try {
            this.f194.put("data", this.f193);
            str = this.f194.toString();
            try {
                m164();
            } catch (JSONException unused) {
            }
        } catch (JSONException unused2) {
            str = null;
        }
        return str;
    }

    private synchronized void m163(String str, PackageManager packageManager) {
        AppsFlyerProperties appsFlyerProperties = AppsFlyerProperties.getInstance();
        AppsFlyerLibCore appsFlyerLibCore = AppsFlyerLibCore.getInstance();
        String string = appsFlyerProperties.getString("remote_debug_static_data");
        if (string != null) {
            try {
                this.f194 = new JSONObject(string);
            } catch (Throwable unused) {
            }
        } else {
            this.f194 = new JSONObject();
            m167(Build.BRAND, Build.MODEL, Build.VERSION.RELEASE, appsFlyerProperties.getString(ServerParameters.ADVERTISING_ID_PARAM), appsFlyerLibCore.f81, appsFlyerLibCore.f103);
            StringBuilder sb = new StringBuilder("5.2.0.");
            sb.append(AppsFlyerLibCore.f66);
            m166(sb.toString(), appsFlyerProperties.getString(AppsFlyerProperties.AF_KEY), appsFlyerProperties.getString("KSAppsFlyerId"), appsFlyerProperties.getString("uid"));
            try {
                int i = packageManager.getPackageInfo(str, 0).versionCode;
                m168(str, String.valueOf(i), appsFlyerProperties.getString("channel"), appsFlyerProperties.getString("preInstallName"));
            } catch (Throwable unused2) {
            }
            appsFlyerProperties.set("remote_debug_static_data", this.f194.toString());
        }
        try {
            this.f194.put("launch_counter", this.f196);
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    private synchronized void m164() {
        this.f193 = null;
        this.f193 = new JSONArray();
        this.f197 = 0;
    }

    public final synchronized void m177() {
        this.f190 = false;
        m164();
    }

    public final boolean m175() {
        return this.f191;
    }

    public static void m165(String str, PackageManager packageManager) {
        try {
            if (f189 == null) {
                f189 = new ai();
            }
            f189.m163(str, packageManager);
            if (f189 == null) {
                f189 = new ai();
            }
            BackgroundEvent trackingStopped = new ProxyEvent().body(f189.m170()).trackingStopped(AppsFlyerLib.getInstance().isTrackingStopped());
            StringBuilder sb = new StringBuilder();
            sb.append(ServerConfigHandler.getUrl("https://%smonitorsdk.%s/remote-debug?app_id="));
            sb.append(str);
            new Thread(new z((BackgroundEvent) trackingStopped.urlString(sb.toString()))).start();
        } catch (Throwable unused) {
        }
    }
}