导航菜单

页面标题

页面副标题

Oolka v2.4.42 - EventsPublisherWorker.java 源代码

正在查看: Oolka v2.4.42 应用的 EventsPublisherWorker.java JAVA 源代码文件

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


package com.amazon.apay.instrumentation.worker;

import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import androidx.work.ListenableWorker;
import androidx.work.Worker;
import androidx.work.WorkerParameters;
import co.hyperverge.hyperkyc.data.models.HyperKycConfig;
import co.hyperverge.hyperkyc.data.models.WorkflowAPIHeaders;
import com.amazon.apay.instrumentation.clients.HttpsClient;
import com.amazon.apay.instrumentation.utils.b;
import com.amazon.apay.instrumentation.writer.a;
import java.sql.Timestamp;
import java.util.Map;
import java.util.Objects;
import javax.net.ssl.HttpsURLConnection;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
import kotlin.text.StringsKt;
import org.jetbrains.annotations.NotNull;
import org.json.JSONObject;

@Metadata
public final class EventsPublisherWorker extends Worker {

    @NotNull
    public final Context a;

    @NotNull
    public final WorkerParameters b;

    @NotNull
    public final HttpsClient c;

    @NotNull
    public final String d;

    @NotNull
    public final a e;

    @NotNull
    public final com.amazon.apay.instrumentation.encryptor.a f;

    @NotNull
    public String g;

    public EventsPublisherWorker(@NotNull Context context, @NotNull WorkerParameters workerParameters) {
        super(context, workerParameters);
        Intrinsics.checkNotNullParameter(context, "context");
        Intrinsics.checkNotNullParameter(workerParameters, "workerParams");
        this.a = context;
        this.b = workerParameters;
        this.c = new HttpsClient();
        this.e = new a(context);
        String valueOf = String.valueOf(workerParameters.d().i("clientId"));
        this.g = valueOf;
        this.f = new com.amazon.apay.instrumentation.encryptor.a(valueOf);
        this.d = String.valueOf(workerParameters.d().i("event"));
    }

    public final String a(WorkerParameters workerParameters) {
        String str;
        JSONObject jSONObject = new JSONObject();
        jSONObject.put("sessionId", (Object) null);
        jSONObject.put(HyperKycConfig.APP_ID, this.a.getPackageName());
        jSONObject.put("brand", Build.BRAND);
        jSONObject.put(WorkflowAPIHeaders.DEVICE, Build.DEVICE);
        jSONObject.put("buildId", Build.ID);
        jSONObject.put("clientId", this.g);
        jSONObject.put("clientSdkVersion", workerParameters.d().i("clientSdkVersion"));
        jSONObject.put("clientSdkName", workerParameters.d().i("clientSdkName"));
        jSONObject.put("clientAdditionalMetadata", workerParameters.d().i("clientAdditionalMetadata"));
        jSONObject.put("instrumentationSdkVersion", "I.1.1.0");
        try {
            str = this.a.getPackageManager().getPackageInfo("in.amazon.mShop.android.shopping", 0).versionName;
            Intrinsics.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();
        Intrinsics.checkNotNullExpressionValue(jSONObject2, "payload.toString()");
        return jSONObject2;
    }

    public final String b(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();
        Intrinsics.checkNotNullExpressionValue(sb2, "stringBuilder.toString()");
        return sb2;
    }

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

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