Maxcredito v1.2.1版本的 MD5 值为:2605738f37f8ddb81288799ddcbfcbe8

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


package com.appsflyer.internal;

import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import com.appsflyer.AFLogger;
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.AppsFlyerProperties;
import com.appsflyer.FirebaseMessagingServiceListener;
import com.appsflyer.internal.b;
import com.facebook.devicerequests.internal.DeviceRequestsHelper;
import com.facebook.internal.NativeProtocol;
import com.facebook.internal.ServerProtocol;
import java.lang.ref.WeakReference;
import java.net.HttpURLConnection;
import java.text.SimpleDateFormat;
import java.util.Locale;
import java.util.concurrent.TimeUnit;

public final class ba extends bd {
    private static String onAppOpenAttributionNative;
    private final SharedPreferences onDeepLinkingNative;

    static {
        StringBuilder sb = new StringBuilder("https://%sregister.%s/api/v");
        sb.append(ah.values);
        onAppOpenAttributionNative = sb.toString();
    }

    public ba(Context context) {
        super(null, r0.toString(), null, null, null, context);
        StringBuilder sb = new StringBuilder();
        sb.append(String.format(onAppOpenAttributionNative, AppsFlyerLib.getInstance().getHostPrefix(), ah.AFInAppEventParameterName().getHostName()));
        sb.append(context.getPackageName());
        this.onDeepLinkingNative = ah.values(context);
    }

    public static boolean AFInAppEventParameterName(SharedPreferences sharedPreferences) {
        return sharedPreferences.getBoolean("sentRegisterRequestToAF", false);
    }

    private void AFKeystoreWrapper(o oVar) {
        this.onDeepLinkingNative.edit().putString("afUninstallToken", oVar.AFKeystoreWrapper).putLong("afUninstallToken_received_time", oVar.AFInAppEventParameterName).putBoolean("afUninstallToken_queued", oVar.valueOf()).apply();
    }

    public static boolean valueOf(Context context) {
        if (AppsFlyerLib.getInstance().isStopped()) {
            return false;
        }
        try {
            Class.forName("com.google.firebase.messaging.FirebaseMessagingService");
        } catch (ClassNotFoundException unused) {
        } catch (Throwable th) {
            AFLogger.values("An error occurred while trying to verify manifest declarations: ", th);
        }
        return aa.valueOf(context, new Intent("com.google.firebase.MESSAGING_EVENT", null, context, FirebaseMessagingServiceListener.class));
    }

    public final void AFInAppEventType(String str) {
        if (str != null) {
            AFLogger.valueOf("Firebase Refreshed Token = ".concat(String.valueOf(str)));
            o values = values();
            if (values == null || !str.equals(values.AFKeystoreWrapper)) {
                long currentTimeMillis = System.currentTimeMillis();
                boolean z = ah.values(this.onDeepLinkingNative) && (values == null || currentTimeMillis - values.AFInAppEventParameterName > TimeUnit.SECONDS.toMillis(2L));
                AFKeystoreWrapper(new o(str, currentTimeMillis, !z));
                if (z) {
                    valueOf(str);
                }
            }
        }
    }

    public o values() {
        String string;
        String string2;
        String string3 = this.onDeepLinkingNative.getString("afUninstallToken", null);
        long j2 = this.onDeepLinkingNative.getLong("afUninstallToken_received_time", 0L);
        boolean z = this.onDeepLinkingNative.getBoolean("afUninstallToken_queued", false);
        this.onDeepLinkingNative.edit().putBoolean("afUninstallToken_queued", false).apply();
        if (string3 == null && (string2 = AppsFlyerProperties.getInstance().getString("afUninstallToken")) != null) {
            string3 = string2.split(",")[r0.length - 1];
        }
        if (j2 == 0 && (string = AppsFlyerProperties.getInstance().getString("afUninstallToken")) != null) {
            String[] split = string.split(",");
            if (split.length >= 2) {
                try {
                    j2 = Long.parseLong(split[split.length - 2]);
                } catch (NumberFormatException unused) {
                }
            }
        }
        if (string3 != null) {
            return new o(string3, j2, z);
        }
        return null;
    }

    public void valueOf(String str) {
        Application application = this.valueOf;
        final ah AFInAppEventParameterName = ah.AFInAppEventParameterName();
        if (ah.AFKeystoreWrapper()) {
            AFLogger.values("CustomerUserId not set, Tracking is disabled", true);
            return;
        }
        String values = ah.values(AppsFlyerProperties.AF_KEY);
        if (values == null) {
            AFLogger.AFInAppEventParameterName("[registerUninstall] AppsFlyer's SDK cannot send any event without providing DevKey.");
            return;
        }
        PackageManager packageManager = application.getPackageManager();
        try {
            PackageInfo packageInfo = packageManager.getPackageInfo(application.getPackageName(), 0);
            this.values.put("app_version_code", Integer.toString(packageInfo.versionCode));
            this.values.put("app_version_name", packageInfo.versionName);
            this.values.put(NativeProtocol.BRIDGE_ARG_APP_NAME_STRING, packageManager.getApplicationLabel(packageInfo.applicationInfo).toString());
            long j2 = packageInfo.firstInstallTime;
            this.values.put("installDate", ah.AFKeystoreWrapper(new SimpleDateFormat("yyyy-MM-dd_HHmmssZ", Locale.US), j2));
        } catch (Throwable th) {
            AFLogger.values("Exception while collecting application version info.", th);
        }
        ah.valueOf(application, this.values);
        String string = AppsFlyerProperties.getInstance().getString(AppsFlyerProperties.APP_USER_ID);
        if (string != null) {
            this.values.put("appUserId", string);
        }
        try {
            this.values.put(DeviceRequestsHelper.DEVICE_INFO_MODEL, Build.MODEL);
            this.values.put("brand", Build.BRAND);
        } catch (Throwable th2) {
            AFLogger.values("Exception while collecting device brand and model.", th2);
        }
        if (AppsFlyerProperties.getInstance().getBoolean(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, false)) {
            this.values.put(AppsFlyerProperties.DEVICE_TRACKING_DISABLED, ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
        }
        b.e.a AFInAppEventType = ac.AFInAppEventType(application.getContentResolver());
        if (AFInAppEventType != null) {
            this.values.put("amazon_aid", AFInAppEventType.AFKeystoreWrapper);
            this.values.put("amazon_aid_limit", String.valueOf(AFInAppEventType.values));
        }
        String string2 = AppsFlyerProperties.getInstance().getString("advertiserId");
        if (string2 != null) {
            this.values.put("advertiserId", string2);
        }
        this.values.put("devkey", values);
        this.values.put("uid", an.AFKeystoreWrapper(new WeakReference(application)));
        this.values.put("af_gcm_token", str);
        this.values.put("launch_counter", Integer.toString(ah.values(this.onDeepLinkingNative, "appsFlyerCount", false)));
        this.values.put(ServerProtocol.DIALOG_PARAM_SDK_VERSION, Integer.toString(Build.VERSION.SDK_INT));
        String AFInAppEventType2 = AFInAppEventParameterName.AFInAppEventType(application);
        if (AFInAppEventType2 != null) {
            this.values.put(AppsFlyerProperties.CHANNEL, AFInAppEventType2);
        }
        new Thread(new Runnable() {
            @Override
            public final void run() {
                try {
                    ba baVar = ba.this;
                    baVar.onDeepLinking = AFInAppEventParameterName.isStopped();
                    HttpURLConnection AFKeystoreWrapper = new m(baVar).AFKeystoreWrapper();
                    if (AFKeystoreWrapper != null) {
                        if (AFKeystoreWrapper.getResponseCode() == 200) {
                            ba.values(ba.this);
                        }
                        AFKeystoreWrapper.disconnect();
                    }
                } catch (Throwable th3) {
                    AFLogger.values(th3.getMessage(), th3);
                }
            }
        }).start();
    }

    public static void values(ba baVar) {
        baVar.onDeepLinkingNative.edit().putBoolean("sentRegisterRequestToAF", true).apply();
        AFLogger.AFKeystoreWrapper("Successfully registered for Uninstall Tracking");
    }
}