正在查看: 逼多多 v3.6.2 应用的 LoadTestService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 逼多多 v3.6.2 应用的 LoadTestService.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.eesu.doak;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.Service;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.IBinder;
import androidx.core.app.NotificationCompat;
import com.umeng.commonsdk.statistics.UMErrorCode;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import java.util.UUID;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineScope;
import kotlinx.coroutines.CoroutineScopeKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.Job;
import kotlinx.coroutines.SupervisorKt;
import kotlinx.coroutines.channels.BufferOverflow;
import kotlinx.coroutines.channels.Channel;
import kotlinx.coroutines.channels.ChannelKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@Metadata(d1 = {"\u0000x\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010$\n\u0002\u0010\u0007\n\u0002\b\u0003\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0002\u0010\u0003J\b\u0010\u0017\u001a\u00020\u0016H\u0016J\"\u0010\u0018\u001a\u00020\b2\b\u0010\u0019\u001a\u0004\u0018\u00010\u001a2\u0006\u0010\u001b\u001a\u00020\b2\u0006\u0010\u001c\u001a\u00020\bH\u0016J\b\u0010\u001d\u001a\u00020\u0016H\u0016J\u0014\u0010\u001e\u001a\u0004\u0018\u00010\u001f2\b\u0010\u0019\u001a\u0004\u0018\u00010\u001aH\u0016J\u000e\u0010 \u001a\u00020\u0016H\u0082@¢\u0006\u0002\u0010!J\u000e\u0010\"\u001a\u00020\u0016H\u0082@¢\u0006\u0002\u0010!J\u000e\u0010#\u001a\u00020\u0016H\u0082@¢\u0006\u0002\u0010!J\u0010\u0010$\u001a\u00020%2\u0006\u0010&\u001a\u00020\u0005H\u0002J\u0010\u0010'\u001a\u00020\u00162\u0006\u0010&\u001a\u00020\u0005H\u0002J\b\u0010(\u001a\u00020\u0005H\u0002J\u000e\u0010)\u001a\u00020*H\u0082@¢\u0006\u0002\u0010!J<\u0010+\u001a\u00020\u00162\u0006\u0010,\u001a\u00020\u00052\u0006\u0010-\u001a\u00020.2\u0012\u0010/\u001a\u000e\u0012\u0004\u0012\u00020\u0005\u0012\u0004\u0012\u000201002\b\u00102\u001a\u0004\u0018\u00010\u0005H\u0082@¢\u0006\u0002\u00103R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082D¢\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0005X\u0082D¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\bX\u0082D¢\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\u0005X\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\n\u001a\u00020\u000bX\u0082.¢\u0006\u0002\n\u0000R\u000e\u0010\f\u001a\u00020\rX\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u000fX\u0082\u0004¢\u0006\u0002\n\u0000R\u001a\u0010\u0010\u001a\u000e\u0012\u0004\u0012\u00020\u0005\u0012\u0004\u0012\u00020\u00120\u0011X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0013\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\u0014\u001a\b\u0012\u0004\u0012\u00020\u00160\u0015X\u0082\u0004¢\u0006\u0002\n\u0000¨\u00064"}, d2 = {"Lcom/eesu/doak/LoadTestService;", "Landroid/app/Service;", "<init>", "()V", "TAG", "", "NOTIFICATION_CHANNEL_ID", "NOTIFICATION_ID", "", "workerId", "channel", "Lio/grpc/ManagedChannel;", "serviceScope", "Lkotlinx/coroutines/CoroutineScope;", "isRunning", "Ljava/util/concurrent/atomic/AtomicBoolean;", "runningTaskJobs", "Ljava/util/concurrent/ConcurrentHashMap;", "Lkotlinx/coroutines/Job;", "activeTasksCount", "heartbeatTrigger", "Lkotlinx/coroutines/channels/Channel;", "", "onCreate", "onStartCommand", "intent", "Landroid/content/Intent;", "flags", "startId", "onDestroy", "onBind", "Landroid/os/IBinder;", "startTaskStreaming", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "heartbeatLoop", "sendHeartbeat", "createNotification", "Landroid/app/Notification;", "contentText", "updateNotification", "getUniqueWorkerId", "registerWorker", "", "reportTaskResult", "taskId", "status", "Lcom/eesu/doak/load_test/TaskResult$Status;", "metrics", "", "", "errorMessage", "(Ljava/lang/String;Lcom/eesu/doak/load_test/TaskResult$Status;Ljava/util/Map;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "loadtestsdk_debug"}, k = 1, mv = {2, 0, 0}, xi = 48)
@SourceDebugExtension({"SMAP\nLoadTestService.kt\nKotlin\n*S Kotlin\n*F\n+ 1 LoadTestService.kt\ncom/eesu/doak/LoadTestService\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,279:1\n1#2:280\n*E\n"})
public final class LoadTestService extends Service {
private volatile int activeTasksCount;
private ManagedChannel channel;
private String workerId;
@NotNull
private final String TAG = "LoadTestService";
@NotNull
private final String NOTIFICATION_CHANNEL_ID = "LoadTestServiceChannel";
private final int NOTIFICATION_ID = UMErrorCode.E_UM_BE_SAVE_FAILED;
@NotNull
private final CoroutineScope serviceScope = CoroutineScopeKt.CoroutineScope(Dispatchers.getIO().plus(SupervisorKt.SupervisorJob$default((Job) null, 1, (Object) null)));
@NotNull
private final AtomicBoolean isRunning = new AtomicBoolean(false);
@NotNull
private final ConcurrentHashMap<String, Job> runningTaskJobs = new ConcurrentHashMap<>();
@NotNull
private final Channel<Unit> heartbeatTrigger = ChannelKt.Channel$default(-1, (BufferOverflow) null, (Function1) null, 6, (Object) null);
private final Notification createNotification(String contentText) {
Notification build = new NotificationCompat.Builder(this, this.NOTIFICATION_CHANNEL_ID).setSmallIcon(getApplicationInfo().icon).setOngoing(true).build();
Intrinsics.checkNotNullExpressionValue(build, "build(...)");
return build;
}
private final String getUniqueWorkerId() {
SharedPreferences sharedPreferences = getSharedPreferences("worker_prefs", 0);
String string = sharedPreferences.getString("worker_id", null);
if (string != null) {
return string;
}
String uuid = UUID.randomUUID().toString();
Intrinsics.checkNotNullExpressionValue(uuid, "toString(...)");
sharedPreferences.edit().putString("worker_id", uuid).apply();
return uuid;
}
public final java.lang.Object heartbeatLoop(kotlin.coroutines.Continuation<? super kotlin.Unit> r9) {
throw new UnsupportedOperationException("Method not decompiled: com.eesu.doak.LoadTestService.heartbeatLoop(kotlin.coroutines.Continuation):java.lang.Object");
}
public final java.lang.Object registerWorker(kotlin.coroutines.Continuation<? super java.lang.Boolean> r9) {
throw new UnsupportedOperationException("Method not decompiled: com.eesu.doak.LoadTestService.registerWorker(kotlin.coroutines.Continuation):java.lang.Object");
}
public final java.lang.Object reportTaskResult(java.lang.String r8, com.eesu.doak.load_test.TaskResult.Status r9, java.util.Map<java.lang.String, java.lang.Float> r10, java.lang.String r11, kotlin.coroutines.Continuation<? super kotlin.Unit> r12) {
throw new UnsupportedOperationException("Method not decompiled: com.eesu.doak.LoadTestService.reportTaskResult(java.lang.String, com.eesu.doak.load_test.TaskResult$Status, java.util.Map, java.lang.String, kotlin.coroutines.Continuation):java.lang.Object");
}
public final java.lang.Object sendHeartbeat(kotlin.coroutines.Continuation<? super kotlin.Unit> r10) {
throw new UnsupportedOperationException("Method not decompiled: com.eesu.doak.LoadTestService.sendHeartbeat(kotlin.coroutines.Continuation):java.lang.Object");
}
public final java.lang.Object startTaskStreaming(kotlin.coroutines.Continuation<? super kotlin.Unit> r9) {
throw new UnsupportedOperationException("Method not decompiled: com.eesu.doak.LoadTestService.startTaskStreaming(kotlin.coroutines.Continuation):java.lang.Object");
}
public final void updateNotification(String contentText) {
Notification createNotification = createNotification(contentText);
Object systemService = getSystemService("notification");
Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.app.NotificationManager");
((NotificationManager) systemService).notify(this.NOTIFICATION_ID, createNotification);
}
@Override
@Nullable
public IBinder onBind(@Nullable Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
this.workerId = getUniqueWorkerId();
if (Build.VERSION.SDK_INT >= 26) {
h.a();
((NotificationManager) getSystemService(NotificationManager.class)).createNotificationChannel(g.a(this.NOTIFICATION_CHANNEL_ID, "服务", 3));
}
}
@Override
public void onDestroy() {
super.onDestroy();
this.isRunning.set(false);
ManagedChannel managedChannel = null;
CoroutineScopeKt.cancel$default(this.serviceScope, (CancellationException) null, 1, (Object) null);
ManagedChannel managedChannel2 = this.channel;
if (managedChannel2 != null) {
if (managedChannel2 == null) {
Intrinsics.throwUninitializedPropertyAccessException("channel");
} else {
managedChannel = managedChannel2;
}
managedChannel.shutdownNow();
}
}
@Override
public int onStartCommand(@Nullable Intent intent, int flags, int startId) {
startForeground(this.NOTIFICATION_ID, createNotification("正在初始化..."));
if (this.channel == null) {
String stringExtra = intent != null ? intent.getStringExtra("SERVER_HOST") : null;
Integer valueOf = intent != null ? Integer.valueOf(intent.getIntExtra("SERVER_PORT", 80)) : null;
if (stringExtra == null || valueOf == null) {
stopSelf();
return 2;
}
this.channel = ManagedChannelBuilder.forAddress(stringExtra, valueOf.intValue()).usePlaintext().idleTimeout(5L, TimeUnit.MINUTES).build();
}
if (this.isRunning.getAndSet(true)) {
return 1;
}
BuildersKt.launch$default(this.serviceScope, (CoroutineContext) null, (CoroutineStart) null, new LoadTestService$onStartCommand$1(this, null), 3, (Object) null);
return 1;
}
}