Cyber Surfer v5.2.5版本的 MD5 值为:db13c5fce988de393e52d2679f934b22

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


package com.appsflyer.internal.event.uninstall;

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.AFDateFormat;
import com.appsflyer.AFFacebookDeferredDeeplink;
import com.appsflyer.AFLogger;
import com.appsflyer.AdvertisingIdObject;
import com.appsflyer.AdvertisingIdUtil;
import com.appsflyer.AndroidUtils;
import com.appsflyer.AppsFlyerLib;
import com.appsflyer.AppsFlyerLibCore;
import com.appsflyer.AppsFlyerProperties;
import com.appsflyer.BackgroundHttpTask;
import com.appsflyer.FirebaseMessagingServiceListener;
import com.appsflyer.Installation;
import com.appsflyer.ServerConfigHandler;
import com.appsflyer.ServerParameters;
import com.appsflyer.internal.model.event.BackgroundEvent;
import java.lang.ref.WeakReference;
import java.net.HttpURLConnection;
import java.util.concurrent.TimeUnit;
public final class Register extends BackgroundEvent {
    public static final String TOKEN_PAYLOAD_KEY = "af_gcm_token";
    public static final String TOKEN_PERSIST_KEY = "afUninstallToken";
    public static final String TOKEN_RECEIVED_TIME_PERSIST_KEY = "afUninstallToken_received_time";
    public static String URL;
    private final SharedPreferences getDataFormatter;

    static void $$a(Register register) {
        register.getDataFormatter.edit().putBoolean("sentRegisterRequestToAF", true).apply();
        AFLogger.afDebugLog("Successfully registered for Uninstall Tracking");
    }

    private AFFacebookDeferredDeeplink $$b() {
        String string;
        String string2;
        String string3 = this.getDataFormatter.getString(TOKEN_PERSIST_KEY, null);
        long j = this.getDataFormatter.getLong(TOKEN_RECEIVED_TIME_PERSIST_KEY, 0L);
        boolean z = this.getDataFormatter.getBoolean("afUninstallToken_queued", false);
        this.getDataFormatter.edit().putBoolean("afUninstallToken_queued", false).apply();
        if (string3 == null && (string2 = AppsFlyerProperties.getInstance().getString(TOKEN_PERSIST_KEY)) != null) {
            String[] split = string2.split(",");
            string3 = split[split.length - 1];
        }
        if (j == 0 && (string = AppsFlyerProperties.getInstance().getString(TOKEN_PERSIST_KEY)) != null) {
            String[] split2 = string.split(",");
            if (split2.length >= 2) {
                try {
                    j = Long.parseLong(split2[split2.length - 2]);
                } catch (NumberFormatException unused) {
                }
            }
        }
        if (string3 != null) {
            return new AFFacebookDeferredDeeplink(string3, j, z);
        }
        return null;
    }

    private void $$b(String str) {
        Application context = context();
        final AppsFlyerLibCore appsFlyerLibCore = AppsFlyerLibCore.getInstance();
        if (appsFlyerLibCore.waitingForId()) {
            AFLogger.afInfoLog("CustomerUserId not set, Tracking is disabled", true);
            return;
        }
        String property = appsFlyerLibCore.getProperty(AppsFlyerProperties.AF_KEY);
        if (property == null) {
            AFLogger.afWarnLog("[registerUninstall] AppsFlyer's SDK cannot send any event without providing DevKey.");
            return;
        }
        PackageManager packageManager = context.getPackageManager();
        try {
            PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0);
            this.params.put(ServerParameters.APP_VERSION_CODE, Integer.toString(packageInfo.versionCode));
            this.params.put(ServerParameters.APP_VERSION_NAME, packageInfo.versionName);
            this.params.put("app_name", packageManager.getApplicationLabel(packageInfo.applicationInfo).toString());
            long j = packageInfo.firstInstallTime;
            this.params.put(ServerParameters.INSTALL_DATE, appsFlyerLibCore.dateFormatUTC(AFDateFormat.getDataFormatter(AppsFlyerLibCore.INSTALL_UPDATE_DATE_FORMAT), j));
        } catch (Throwable th) {
            AFLogger.afErrorLog("Exception while collecting application version info.", th);
        }
        appsFlyerLibCore.addNetworkData(context, this.params);
        String customerUserId = appsFlyerLibCore.getCustomerUserId();
        if (customerUserId != null) {
            this.params.put(ServerParameters.APP_USER_ID, customerUserId);
        }
        try {
            this.params.put(ServerParameters.MODEL, Build.MODEL);
            this.params.put(ServerParameters.BRAND, Build.BRAND);
        } catch (Throwable th2) {
            AFLogger.afErrorLog("Exception while collecting device brand and model.", th2);
        }
        if (AppsFlyerProperties.getInstance().getBoolean("deviceTrackingDisabled", false)) {
            this.params.put("deviceTrackingDisabled", "true");
        }
        AdvertisingIdObject amazonAID = AdvertisingIdUtil.getAmazonAID(context.getContentResolver());
        if (amazonAID != null) {
            this.params.put(ServerParameters.AMAZON_AID, amazonAID.getAdvertisingId());
            this.params.put(ServerParameters.AMAZON_AID_LIMIT, String.valueOf(amazonAID.isLimitAdTracking()));
        }
        String string = AppsFlyerProperties.getInstance().getString(ServerParameters.ADVERTISING_ID_PARAM);
        if (string != null) {
            this.params.put(ServerParameters.ADVERTISING_ID_PARAM, string);
        }
        this.params.put(ServerParameters.DEV_KEY, property);
        this.params.put(ServerParameters.AF_USER_ID, Installation.id(new WeakReference(context)));
        this.params.put("af_gcm_token", str);
        this.params.put(ServerParameters.LAUNCH_COUNTER, Integer.toString(appsFlyerLibCore.getLaunchCounter(this.getDataFormatter, false)));
        this.params.put("sdk", Integer.toString(Build.VERSION.SDK_INT));
        String configuredChannel = appsFlyerLibCore.getConfiguredChannel(context);
        if (configuredChannel != null) {
            this.params.put("channel", configuredChannel);
        }
        new Thread(new Runnable() {
            @Override
            public final void run() {
                try {
                    HttpURLConnection doInBackground = new BackgroundHttpTask(Register.this.trackingStopped(appsFlyerLibCore.isStopped())).doInBackground();
                    if (doInBackground != null) {
                        if (doInBackground.getResponseCode() == 200) {
                            Register.$$a(Register.this);
                        }
                        doInBackground.disconnect();
                    }
                } catch (Throwable th3) {
                    AFLogger.afErrorLog(th3.getMessage(), th3);
                }
            }
        }).start();
    }

    static {
        StringBuilder sb = new StringBuilder("https://%sregister.%s/api/v");
        sb.append(AppsFlyerLibCore.BUILD_URL_SUFFIX);
        URL = sb.toString();
    }

    public Register(Context context) {
        super(null, r0.toString(), null, null, null, context);
        StringBuilder sb = new StringBuilder();
        sb.append(ServerConfigHandler.getUrl(URL));
        sb.append(context.getPackageName());
        this.getDataFormatter = AppsFlyerLibCore.getSharedPreferences(context);
    }

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

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

    public final void send(String str) {
        if (str != null) {
            AFLogger.afInfoLog("Firebase Refreshed Token = ".concat(String.valueOf(str)));
            AFFacebookDeferredDeeplink $$b = $$b();
            if ($$b == null || !str.equals($$b.AFDateFormat)) {
                long currentTimeMillis = System.currentTimeMillis();
                boolean z = AppsFlyerLibCore.firstCallSent(this.getDataFormatter) && ($$b == null || currentTimeMillis - $$b.$$b > TimeUnit.SECONDS.toMillis(2L));
                AFFacebookDeferredDeeplink aFFacebookDeferredDeeplink = new AFFacebookDeferredDeeplink(str, currentTimeMillis, !z);
                this.getDataFormatter.edit().putString(TOKEN_PERSIST_KEY, aFFacebookDeferredDeeplink.AFDateFormat).putLong(TOKEN_RECEIVED_TIME_PERSIST_KEY, aFFacebookDeferredDeeplink.$$b).putBoolean("afUninstallToken_queued", aFFacebookDeferredDeeplink.AFDateFormat()).apply();
                if (z) {
                    $$b(str);
                }
            }
        }
    }

    public final void sendIfQueued() {
        AFFacebookDeferredDeeplink $$b = $$b();
        if ($$b == null || !$$b.AFDateFormat()) {
            return;
        }
        String str = $$b.AFDateFormat;
        AFLogger.afDebugLog("Resending Uninstall token to AF servers: ".concat(String.valueOf(str)));
        $$b(str);
    }
}