正在查看: 火箭TNT加速 v1.5.4 应用的 ProfileWorker.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 火箭TNT加速 v1.5.4 应用的 ProfileWorker.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.github.kr328.clash.service;
import android.app.Notification;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import androidx.core.app.NotificationChannelCompat;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import com.facebook.react.uimanager.events.PointerEventHelper;
import com.github.kr328.clash.common.compat.ContextKt;
import com.github.kr328.clash.common.compat.IntentsKt;
import com.github.kr328.clash.common.constants.Components;
import com.github.kr328.clash.common.constants.Intents;
import com.github.kr328.clash.common.id.UndefinedIds;
import com.github.kr328.clash.common.util.IntentKt;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import kotlin.Metadata;
import kotlin.Unit;
import kotlin.collections.CollectionsKt;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.InlineMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Job;
import kotlinx.coroutines.NonCancellable;
@Metadata(d1 = {"\u0000R\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0010!\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\u0018\u0000 &2\u00020\u0001:\u0001&B\u0005¢\u0006\u0002\u0010\u0002J\u0018\u0010\t\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u000eH\u0002J\b\u0010\u000f\u001a\u00020\nH\u0002J \u0010\u0010\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\f2\u0006\u0010\r\u001a\u00020\u000e2\u0006\u0010\u0011\u001a\u00020\u000eH\u0002J\b\u0010\u0012\u001a\u00020\nH\u0002J\u0012\u0010\u0013\u001a\u00020\u00142\b\u0010\u0015\u001a\u0004\u0018\u00010\u0016H\u0016J\b\u0010\u0017\u001a\u00020\nH\u0016J\b\u0010\u0018\u001a\u00020\nH\u0016J\"\u0010\u0019\u001a\u00020\u001a2\b\u0010\u0015\u001a\u0004\u0018\u00010\u00162\u0006\u0010\u001b\u001a\u00020\u001a2\u0006\u0010\u001c\u001a\u00020\u001aH\u0016J'\u0010\u001d\u001a\u00020\n2\u0006\u0010\r\u001a\u00020\u000e2\f\u0010\u001e\u001a\b\u0012\u0004\u0012\u00020\n0\u001fH\u0082Hø\u0001\u0000¢\u0006\u0002\u0010 J\u0018\u0010!\u001a\u00020\"2\u0006\u0010#\u001a\u00020\u001a2\u0006\u0010\u000b\u001a\u00020\fH\u0002J\u0019\u0010$\u001a\u00020\n2\u0006\u0010\u000b\u001a\u00020\fH\u0082@ø\u0001\u0000¢\u0006\u0002\u0010%R\u0014\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0006\u001a\u00020\u00008BX\u0082\u0004¢\u0006\u0006\u001a\u0004\b\u0007\u0010\b\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006'"}, d2 = {"Lcom/github/kr328/clash/service/ProfileWorker;", "Lcom/github/kr328/clash/service/BaseService;", "()V", "jobs", PointerEventHelper.POINTER_TYPE_UNKNOWN, "Lkotlinx/coroutines/Job;", NotificationCompat.CATEGORY_SERVICE, "getService", "()Lcom/github/kr328/clash/service/ProfileWorker;", "completed", PointerEventHelper.POINTER_TYPE_UNKNOWN, Intents.EXTRA_UUID, "Ljava/util/UUID;", "name", PointerEventHelper.POINTER_TYPE_UNKNOWN, "createChannels", "failed", "reason", "foreground", "onBind", "Landroid/os/IBinder;", "intent", "Landroid/content/Intent;", "onCreate", "onDestroy", "onStartCommand", PointerEventHelper.POINTER_TYPE_UNKNOWN, "flags", "startId", "processing", "block", "Lkotlin/Function0;", "(Ljava/lang/String;Lkotlin/jvm/functions/Function0;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "resultBuilder", "Landroidx/core/app/NotificationCompat$Builder;", "id", "run", "(Ljava/util/UUID;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "Companion", "service_meta-alphaRelease"}, k = 1, mv = {1, 7, 1}, xi = 48)
public final class ProfileWorker extends BaseService {
private static final String RESULT_CHANNEL = "profile_result_channel";
private static final String SERVICE_CHANNEL = "profile_service_channel";
private static final String STATUS_CHANNEL = "profile_status_channel";
private final List<Job> jobs = new ArrayList();
public final ProfileWorker getService() {
return this;
}
@Override
public void onCreate() {
super.onCreate();
createChannels();
foreground();
BuildersKt.launch$default(this, (CoroutineContext) null, (CoroutineStart) null, new ProfileWorker$onCreate$1(this, null), 3, (Object) null);
}
@Override
public void onDestroy() {
stopForeground(true);
super.onDestroy();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
super.onStartCommand(intent, flags, startId);
String action = intent != null ? intent.getAction() : null;
if (Intrinsics.areEqual(action, Intents.INSTANCE.getACTION_PROFILE_REQUEST_UPDATE())) {
UUID uuid = IntentKt.getUuid(intent);
if (uuid == null) {
return 2;
}
this.jobs.add(BuildersKt.launch$default(this, (CoroutineContext) null, (CoroutineStart) null, new ProfileWorker$onStartCommand$1$job$1(this, uuid, null), 3, (Object) null));
return 2;
}
if (!Intrinsics.areEqual(action, Intents.INSTANCE.getACTION_PROFILE_SCHEDULE_UPDATES())) {
return 2;
}
this.jobs.add(BuildersKt.launch$default(this, (CoroutineContext) null, (CoroutineStart) null, new ProfileWorker$onStartCommand$job$1(this, null), 3, (Object) null));
return 2;
}
public final java.lang.Object run(java.util.UUID r13, kotlin.coroutines.Continuation<? super kotlin.Unit> r14) {
throw new UnsupportedOperationException("Method not decompiled: com.github.kr328.clash.service.ProfileWorker.run(java.util.UUID, kotlin.coroutines.Continuation):java.lang.Object");
}
private final void createChannels() {
NotificationManagerCompat.from(this).createNotificationChannelsCompat(CollectionsKt.listOf(new NotificationChannelCompat[]{new NotificationChannelCompat.Builder(SERVICE_CHANNEL, 2).setName(getString(R.string.profile_service_status)).build(), new NotificationChannelCompat.Builder(STATUS_CHANNEL, 2).setName(getString(R.string.profile_process_status)).build(), new NotificationChannelCompat.Builder(RESULT_CHANNEL, 3).setName(getString(R.string.profile_process_result)).build()}));
}
private final void foreground() {
ProfileWorker profileWorker = this;
Notification build = new NotificationCompat.Builder(profileWorker, SERVICE_CHANNEL).setContentTitle(getString(R.string.profile_updater)).setContentText(getString(R.string.running)).setColor(ContextKt.getColorCompat(profileWorker, R.color.color_clash)).setSmallIcon(R.drawable.ic_logo_service).setOngoing(true).setOnlyAlertOnce(true).build();
Intrinsics.checkNotNullExpressionValue(build, "Builder(this, SERVICE_CH…rue)\n .build()");
startForeground(R.id.nf_profile_worker, build);
}
private final Object processing(String str, Function0<Unit> function0, Continuation<? super Unit> continuation) {
int next = UndefinedIds.INSTANCE.next();
ProfileWorker profileWorker = this;
Notification build = new NotificationCompat.Builder(profileWorker, STATUS_CHANNEL).setContentTitle(getString(R.string.profile_updating)).setContentText(str).setColor(ContextKt.getColorCompat(profileWorker, R.color.color_clash)).setSmallIcon(R.drawable.ic_logo_service).setOngoing(true).setOnlyAlertOnce(true).setGroup(STATUS_CHANNEL).build();
Intrinsics.checkNotNullExpressionValue(build, "Builder(this, STATUS_CHA…NEL)\n .build()");
NotificationManagerCompat.from(getApplicationContext()).notify(next, build);
try {
function0.invoke();
InlineMarker.finallyStart(1);
CoroutineContext coroutineContext = NonCancellable.INSTANCE;
ProfileWorker$processing$2 profileWorker$processing$2 = new ProfileWorker$processing$2(this, next, null);
InlineMarker.mark(0);
BuildersKt.withContext(coroutineContext, profileWorker$processing$2, continuation);
InlineMarker.mark(1);
InlineMarker.finallyEnd(1);
return Unit.INSTANCE;
} catch (Throwable th) {
InlineMarker.finallyStart(1);
CoroutineContext coroutineContext2 = NonCancellable.INSTANCE;
ProfileWorker$processing$2 profileWorker$processing$22 = new ProfileWorker$processing$2(this, next, null);
InlineMarker.mark(0);
BuildersKt.withContext(coroutineContext2, profileWorker$processing$22, continuation);
InlineMarker.mark(1);
InlineMarker.finallyEnd(1);
throw th;
}
}
private final NotificationCompat.Builder resultBuilder(int id, UUID uuid) {
ProfileWorker profileWorker = this;
Intent component = new Intent().setComponent(Components.INSTANCE.getPROPERTIES_ACTIVITY());
Intrinsics.checkNotNullExpressionValue(component, "Intent().setComponent(Co…ents.PROPERTIES_ACTIVITY)");
NotificationCompat.Builder group = new NotificationCompat.Builder(profileWorker, RESULT_CHANNEL).setColor(ContextKt.getColorCompat(profileWorker, R.color.color_clash)).setSmallIcon(R.drawable.ic_logo_service).setOnlyAlertOnce(true).setContentIntent(PendingIntent.getActivity(profileWorker, id, IntentKt.setUUID(component, uuid), IntentsKt.pendingIntentFlags$default(134217728, false, 2, null))).setAutoCancel(true).setGroup(RESULT_CHANNEL);
Intrinsics.checkNotNullExpressionValue(group, "Builder(this, RESULT_CHA….setGroup(RESULT_CHANNEL)");
return group;
}
private final void completed(UUID uuid, String name) {
int next = UndefinedIds.INSTANCE.next();
Notification build = resultBuilder(next, uuid).setContentTitle(getString(R.string.update_successfully)).setContentText(getString(R.string.format_update_complete, new Object[]{name})).build();
Intrinsics.checkNotNullExpressionValue(build, "resultBuilder(id, uuid)\n…me))\n .build()");
NotificationManagerCompat.from(this).notify(next, build);
}
private final void failed(UUID uuid, String name, String reason) {
int next = UndefinedIds.INSTANCE.next();
String string = getString(R.string.format_update_failure, new Object[]{name, reason});
Intrinsics.checkNotNullExpressionValue(string, "getString(R.string.forma…te_failure, name, reason)");
String str = string;
Notification build = resultBuilder(next, uuid).setContentTitle(getString(R.string.update_failure)).setContentText(str).setStyle(new NotificationCompat.BigTextStyle().bigText(str)).build();
Intrinsics.checkNotNullExpressionValue(build, "resultBuilder(id, uuid)\n…nt))\n .build()");
NotificationManagerCompat.from(this).notify(next, build);
}
@Override
public IBinder onBind(Intent intent) {
return new Binder();
}
}