导航菜单

页面标题

页面副标题

Biko v2.0.23 - PingService.java 源代码

正在查看: Biko v2.0.23 应用的 PingService.java JAVA 源代码文件

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


package app.callpe.service;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Build;
import android.os.IBinder;
import androidx.core.app.NotificationCompat;
import app.callpe.common.utils.helper_functions.Utils;
import app.callpe.ui.home.StreamerHomeActivity;
import dagger.hilt.android.AndroidEntryPoint;
import java.util.concurrent.CancellationException;
import javax.inject.Inject;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.CoroutineContext;
import kotlin.jvm.internal.Intrinsics;
import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineScopeKt;
import kotlinx.coroutines.CoroutineStart;
import kotlinx.coroutines.Dispatchers;
import kotlinx.coroutines.Job;
import timber.log.Timber;

@Metadata(d1 = {"\u0000B\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\t\b\u0007\u0018\u0000 !2\u00020\u0001:\u0001!B\u0005¢\u0006\u0002\u0010\u0002J\b\u0010\u000b\u001a\u00020\fH\u0002J\b\u0010\r\u001a\u00020\u000eH\u0003J\u0010\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u0012H\u0002J\u0011\u0010\u0013\u001a\u00020\u0010H\u0082@ø\u0001\u0000¢\u0006\u0002\u0010\u0014J\u0011\u0010\u0015\u001a\u00020\u000eH\u0082@ø\u0001\u0000¢\u0006\u0002\u0010\u0014J\u0012\u0010\u0016\u001a\u0004\u0018\u00010\u00172\u0006\u0010\u0018\u001a\u00020\u0019H\u0016J\b\u0010\u001a\u001a\u00020\u000eH\u0016J\b\u0010\u001b\u001a\u00020\u000eH\u0016J\"\u0010\u001c\u001a\u00020\u00102\b\u0010\u0018\u001a\u0004\u0018\u00010\u00192\u0006\u0010\u001d\u001a\u00020\u00102\u0006\u0010\u001e\u001a\u00020\u0010H\u0016J\u0011\u0010\u001f\u001a\u00020\u000eH\u0082@ø\u0001\u0000¢\u0006\u0002\u0010\u0014J\b\u0010 \u001a\u00020\u000eH\u0002R\u001e\u0010\u0003\u001a\u00020\u00048\u0006@\u0006X\u0087.¢\u0006\u000e\n\u0000\u001a\u0004\b\u0005\u0010\u0006\"\u0004\b\u0007\u0010\bR\u0010\u0010\t\u001a\u0004\u0018\u00010\nX\u0082\u000e¢\u0006\u0002\n\u0000\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006\""}, d2 = {"Lapp/callpe/service/PingService;", "Landroid/app/Service;", "()V", "apiService", "Lapp/callpe/service/ApiService;", "getApiService", "()Lapp/callpe/service/ApiService;", "setApiService", "(Lapp/callpe/service/ApiService;)V", "job", "Lkotlinx/coroutines/Job;", "createNotification", "Landroid/app/Notification;", "createNotificationChanel", "", "getNotificationIcon", "", "notificationBuilder", "Landroidx/core/app/NotificationCompat$Builder;", "getStepCount", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "markOffline", "onBind", "Landroid/os/IBinder;", "intent", "Landroid/content/Intent;", "onCreate", "onDestroy", "onStartCommand", "flags", "startId", "sendPing", "stopServiceFunc", "Companion", "app_bikoRelease"}, k = 1, mv = {1, 8, 0}, xi = 48)
@AndroidEntryPoint
public final class PingService extends Hilt_PingService {
    public static final long INACTIVITY_DURATION_LOCK = 1080000;
    public static final long PING_INTERVAL = 60000;

    @Inject
    public ApiService apiService;
    private Job job;

    @Override
    public IBinder onBind(Intent intent) {
        Intrinsics.checkNotNullParameter(intent, "intent");
        return null;
    }

    public final ApiService getApiService() {
        ApiService apiService = this.apiService;
        if (apiService != null) {
            return apiService;
        }
        Intrinsics.throwUninitializedPropertyAccessException("apiService");
        return null;
    }

    public final void setApiService(ApiService apiService) {
        Intrinsics.checkNotNullParameter(apiService, "<set-?>");
        this.apiService = apiService;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        if (Build.VERSION.SDK_INT > 26) {
            createNotificationChanel();
        } else {
            startForeground(1, createNotification());
        }
        this.job = BuildersKt.launch$default(CoroutineScopeKt.CoroutineScope(Dispatchers.getIO()), (CoroutineContext) null, (CoroutineStart) null, new PingService$onCreate$1(this, null), 3, (Object) null);
    }

    public final Object getStepCount(Continuation<? super Integer> continuation) {
        return BuildersKt.withContext(Dispatchers.getDefault(), new PingService$getStepCount$2(this, null), continuation);
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        super.onStartCommand(intent, flags, startId);
        return 1;
    }

    public final java.lang.Object sendPing(kotlin.coroutines.Continuation<? super kotlin.Unit> r5) {
        throw new UnsupportedOperationException("Method not decompiled: app.callpe.service.PingService.sendPing(kotlin.coroutines.Continuation):java.lang.Object");
    }

    public final java.lang.Object markOffline(kotlin.coroutines.Continuation<? super kotlin.Unit> r5) {
        throw new UnsupportedOperationException("Method not decompiled: app.callpe.service.PingService.markOffline(kotlin.coroutines.Continuation):java.lang.Object");
    }

    private final Notification createNotification() {
        PingService pingService = this;
        NotificationCompat.Builder priority = new NotificationCompat.Builder(pingService, "ping_channel").setContentTitle(getString(2131951675)).setContentText(getString(2131952387)).setPriority(0);
        Intrinsics.checkNotNullExpressionValue(priority, "Builder(this, \"ping_chan…nCompat.PRIORITY_DEFAULT)");
        priority.setSmallIcon(getNotificationIcon(priority));
        priority.setContentIntent(PendingIntent.getActivity(pingService, 0, new Intent(pingService, (Class<?>) StreamerHomeActivity.class), 201326592));
        Notification build = priority.build();
        Intrinsics.checkNotNullExpressionValue(build, "builder.build()");
        return build;
    }

    private final void createNotificationChanel() {
        PingService pingService = this;
        Intent intent = new Intent(pingService, (Class<?>) StreamerHomeActivity.class);
        intent.putExtra("ENTER_PIP_MODE", true);
        intent.addFlags(268484608);
        PendingIntent activity = PendingIntent.getActivity(pingService, 0, intent, 201326592);
        Object systemService = getSystemService("notification");
        Intrinsics.checkNotNull(systemService, "null cannot be cast to non-null type android.app.NotificationManager");
        NotificationManager notificationManager = (NotificationManager) systemService;
        NotificationChannel notificationChannel = new NotificationChannel("5001", "Background Ping", 4);
        notificationChannel.enableLights(true);
        notificationChannel.enableVibration(true);
        notificationChannel.setLightColor(2131099815);
        notificationChannel.setLockscreenVisibility(0);
        notificationChannel.setDescription("Background Ping");
        notificationManager.createNotificationChannel(notificationChannel);
        NotificationCompat.Builder ongoing = new NotificationCompat.Builder(pingService, "5001").setContentTitle(getString(2131951675)).setContentText(getString(2131952387)).setAutoCancel(false).setContentIntent(activity).setOngoing(true);
        Intrinsics.checkNotNullExpressionValue(ongoing, "Builder(this, \"5001\").se…gIntent).setOngoing(true)");
        ongoing.setSmallIcon(getNotificationIcon(ongoing));
        Notification build = ongoing.build();
        Intrinsics.checkNotNullExpressionValue(build, "builder.build()");
        notificationManager.notify(2, build);
        try {
            startForeground(2, build);
        } catch (Exception e) {
            Timber.e(e);
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        Job job = this.job;
        if (job != null) {
            Job.DefaultImpls.cancel$default(job, (CancellationException) null, 1, (Object) null);
        }
    }

    private final int getNotificationIcon(NotificationCompat.Builder notificationBuilder) {
        notificationBuilder.setColor(32768);
        return 2131231663;
    }

    public final void stopServiceFunc() {
        PingService pingService = new PingService();
        PingService pingService2 = this;
        Intent intent = new Intent(pingService2, pingService.getClass());
        if (Utils.isMyServiceRunning(pingService.getClass(), pingService2)) {
            stopService(intent);
            Timber.d("Service stopped!!", new Object[0]);
        } else {
            Timber.d("Service is already stopped!!", new Object[0]);
        }
    }
}