导航菜单

页面标题

页面副标题

bbinstant v6.24.0 - EventsPublisherWorker.java 源代码

正在查看: bbinstant v6.24.0 应用的 EventsPublisherWorker.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.amazon.android.apay.commonlibrary.instrumentationlib.worker;

import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import androidx.core.app.NotificationCompat;
import androidx.work.ListenableWorker;
import androidx.work.Worker;
import androidx.work.WorkerParameters;
import ch.qos.logback.core.CoreConstants;
import com.amazon.android.apay.commonlibrary.instrumentationlib.clients.HttpsClient;
import com.amazon.android.apay.commonlibrary.instrumentationlib.utils.b;
import com.amazon.android.apay.commonlibrary.instrumentationlib.writer.a;
import java.sql.Timestamp;
import java.util.Map;
import java.util.Objects;
import javax.net.ssl.HttpsURLConnection;
import kotlin.jvm.internal.v;
import kotlin.text.p;
import org.json.JSONObject;

public final class EventsPublisherWorker extends Worker {
    public static final String h = "EventsPublisherWorker";

    public final Context f331a;

    public final WorkerParameters f332b;

    public final HttpsClient f333c;
    public final String d;
    public final a e;
    public final com.amazon.android.apay.commonlibrary.instrumentationlib.encryptor.a f;
    public String g;

    public EventsPublisherWorker(Context context, WorkerParameters workerParameters) {
        super(context, workerParameters);
        v.checkNotNullParameter(context, CoreConstants.CONTEXT_SCOPE_VALUE);
        v.checkNotNullParameter(workerParameters, "workerParams");
        this.f331a = context;
        this.f332b = workerParameters;
        this.f333c = new HttpsClient();
        this.e = new a(context);
        String valueOf = String.valueOf(workerParameters.getInputData().getString("clientId"));
        this.g = valueOf;
        this.f = new com.amazon.android.apay.commonlibrary.instrumentationlib.encryptor.a(valueOf);
        this.d = String.valueOf(workerParameters.getInputData().getString(NotificationCompat.CATEGORY_EVENT));
    }

    public final boolean a(String str) {
        return p.contains$default(str, ".log", false, 2, (Object) null) || new Timestamp(System.currentTimeMillis()).getTime() - this.e.b(str, "MetricEvent") > 240000;
    }

    @Override
    public ListenableWorker.Result doWork() {
        for (String str : this.e.a(this.d)) {
            try {
                if (a(str)) {
                    if (p.contains$default(str, ".tmp", false, 2, (Object) null)) {
                        str = b.f329a.a(this.e, str, this.d);
                    }
                    Integer a2 = this.f333c.a(this.d.equals("MetricEvent") ? "https://amazonpay.amazon.in/v3/sdk/metric-events" : "https://amazonpay.amazon.in/v3/sdk/crash-events", str, a(this.f.a(a(this.f332b) + '\n' + this.e.c(str, this.d))));
                    String str2 = this.d;
                    if (a2 != null && (a2.intValue() / 100 == 2 || a2.intValue() / 100 == 4)) {
                        this.e.a(str, str2);
                    }
                    Thread.sleep(1000L);
                }
            } catch (Exception e) {
                e.toString();
                Objects.toString(e.getCause());
            }
        }
        HttpsURLConnection httpsURLConnection = this.f333c.f304a;
        if (httpsURLConnection != null) {
            httpsURLConnection.disconnect();
        }
        ListenableWorker.Result success = ListenableWorker.Result.success();
        v.checkNotNullExpressionValue(success, "success()");
        return success;
    }

    public final String a(WorkerParameters workerParameters) {
        String str;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("sessionId", (Object) null);
        jSONObject.put("appId", this.f331a.getPackageName());
        jSONObject.put("brand", Build.BRAND);
        jSONObject.put("device", Build.DEVICE);
        jSONObject.put("buildId", Build.ID);
        jSONObject.put("clientId", this.g);
        jSONObject.put("clientSdkVersion", workerParameters.getInputData().getString("clientSdkVersion"));
        jSONObject.put("clientSdkName", workerParameters.getInputData().getString("clientSdkName"));
        jSONObject.put("clientAdditionalMetadata", workerParameters.getInputData().getString("clientAdditionalMetadata"));
        jSONObject.put("instrumentationSdkVersion", "L.1.3.2");
        try {
            str = this.f331a.getPackageManager().getPackageInfo("in.amazon.mShop.android.shopping", 0).versionName;
            v.checkNotNullExpressionValue(str, "context.packageManager.g…            ).versionName");
        } catch (PackageManager.NameNotFoundException unused) {
            str = "mshopNotInstalled";
        }
        jSONObject.put("mshopVersion", str);
        jSONObject.put("product", Build.PRODUCT);
        jSONObject.put("releaseVersion", Build.VERSION.RELEASE);
        jSONObject.put("sdkVersion", Build.VERSION.SDK_INT);
        String jSONObject2 = jSONObject.toString();
        v.checkNotNullExpressionValue(jSONObject2, "payload.toString()");
        return jSONObject2;
    }

    public final String a(Map<String, String> map) {
        StringBuilder sb = new StringBuilder();
        sb.append(map.get("iv") + '\n');
        sb.append(map.get("encryptedSessionKey") + '\n');
        sb.append(map.get("encryptedData") + '\n');
        sb.append(map.get("clientId") + '\n');
        String sb2 = sb.toString();
        v.checkNotNullExpressionValue(sb2, "stringBuilder.toString()");
        return sb2;
    }
}