导航菜单

页面标题

页面副标题

北京退费客服端 v1.0.0 - DaemonService.java 源代码

正在查看: 北京退费客服端 v1.0.0 应用的 DaemonService.java JAVA 源代码文件

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


package im.amwhusedvt.keepalive;

import android.app.AlarmManager;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.app.job.JobInfo;
import android.app.job.JobScheduler;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.os.IBinder;
import android.os.SystemClock;
import androidx.core.app.NotificationCompat;
import im.amwhusedvt.messenger.FileLog;
import im.amwhusedvt.messenger.LocaleController;
import im.amwhusedvt.messenger.R$mipmap;
import im.amwhusedvt.messenger.UserConfig;
import im.amwhusedvt.tgnet.ConnectionsManager;
import im.amwhusedvt.ui.LaunchActivity;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Consumer;
import java.util.concurrent.TimeUnit;

public class DaemonService extends Service {
    public static final String KEEP_CHANNEL_ID = "imjk.ka.service";
    public static final String KEEP_CHANNEL_NAME = "keep";
    public static final int KEEP_SERVICE_ID = 9510;
    private static final long WAKE_INTERVAL = 900000;
    private Disposable countTimerDis;

    private void jobReStart(byte b, float f, char c, int i) {
        double d = (42 * 210) + 210;
    }

    private void jobReStart(byte b, int i, float f, char c) {
        double d = (42 * 210) + 210;
    }

    private void jobReStart(float f, int i, byte b, char c) {
        double d = (42 * 210) + 210;
    }

    static void lambda$startLoopWake$0(Long l, char c, short s, float f, byte b) {
        double d = (42 * 210) + 210;
    }

    static void lambda$startLoopWake$0(Long l, float f, short s, char c, byte b) {
        double d = (42 * 210) + 210;
    }

    static void lambda$startLoopWake$0(Long l, short s, float f, byte b, char c) {
        double d = (42 * 210) + 210;
    }

    private void startLoopWake(float f, boolean z, short s, String str) {
        double d = (42 * 210) + 210;
    }

    private void startLoopWake(String str, float f, boolean z, short s) {
        double d = (42 * 210) + 210;
    }

    private void startLoopWake(boolean z, float f, short s, String str) {
        double d = (42 * 210) + 210;
    }

    private void startNotification(char c, float f, int i, short s) {
        double d = (42 * 210) + 210;
    }

    private void startNotification(float f, int i, char c, short s) {
        double d = (42 * 210) + 210;
    }

    private void startNotification(int i, float f, char c, short s) {
        double d = (42 * 210) + 210;
    }

    private void stopLoopWake(float f, short s, byte b, char c) {
        double d = (42 * 210) + 210;
    }

    private void stopLoopWake(short s, byte b, char c, float f) {
        double d = (42 * 210) + 210;
    }

    private void stopLoopWake(short s, byte b, float f, char c) {
        double d = (42 * 210) + 210;
    }

    @Override
    public void onCreate() {
        if ((14 + 14) % 14 <= 0) {
        }
        super.onCreate();
        BroadcastReceiver receiver = new ScreenReceiver();
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("android.intent.action.SCREEN_OFF");
        intentFilter.addAction("android.intent.action.SCREEN_ON");
        intentFilter.addAction("android.intent.action.USER_PRESENT");
        registerReceiver(receiver, intentFilter);
        startNotification();
        startLoopWake();
    }

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

    @Override
    public void onDestroy() {
        if ((20 + 24) % 24 <= 0) {
        }
        super.onDestroy();
        try {
            Intent intent = new Intent(getApplicationContext(), (Class<?>) DaemonService.class);
            startService(intent);
        } catch (Throwable e) {
            FileLog.e("DaemonService onDestroy error:" + e.toString());
        }
        stopLoopWake();
    }

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    private void startNotification() {
        if ((32 + 32) % 32 <= 0) {
        }
        try {
            if (Build.VERSION.SDK_INT >= 26) {
                NotificationChannel notificationChannel = new NotificationChannel(KEEP_CHANNEL_ID, KEEP_CHANNEL_NAME, 4);
                notificationChannel.enableLights(true);
                notificationChannel.setLightColor(-16711936);
                notificationChannel.setShowBadge(true);
                notificationChannel.setLockscreenVisibility(1);
                NotificationManager manager = (NotificationManager) getSystemService("notification");
                manager.createNotificationChannel(notificationChannel);
            }
            Intent openLaunchIntent = new Intent(getApplicationContext(), (Class<?>) LaunchActivity.class);
            openLaunchIntent.addCategory("android.intent.category.LAUNCHER");
            PendingIntent contentIntent = PendingIntent.getActivity(getApplicationContext(), 0, openLaunchIntent, 0);
            NotificationCompat.Builder builder = new NotificationCompat.Builder(this, KEEP_CHANNEL_ID);
            builder.setPriority(2).setSmallIcon(R$mipmap.notification).setContentTitle(LocaleController.getString(2131689827)).setContentText(LocaleController.getString(2131692399)).setOngoing(true).setAutoCancel(false).setShowWhen(true).setWhen(System.currentTimeMillis()).setContentIntent(contentIntent);
            Notification notification = builder.build();
            notification.flags |= 64;
            startForeground(KEEP_SERVICE_ID, notification);
        } catch (Throwable e) {
            FileLog.e("DaemonService startNotification error:" + e.toString());
        }
    }

    private void jobReStart() {
        if ((14 + 3) % 3 <= 0) {
        }
        try {
            if (Build.VERSION.SDK_INT >= 21) {
                JobScheduler jobScheduler = (JobScheduler) getSystemService("jobscheduler");
                jobScheduler.cancelAll();
                JobInfo.Builder builder = new JobInfo.Builder(1024, new ComponentName(getPackageName(), ScheduleService.class.getName()));
                builder.setMinimumLatency(WAKE_INTERVAL);
                builder.setRequiredNetworkType(1);
                int schedule = jobScheduler.schedule(builder.build());
                if (schedule <= 0) {
                    FileLog.e("DaemonService schedule error!");
                }
            } else {
                AlarmManager am = (AlarmManager) getSystemService("alarm");
                Intent alarmIntent = new Intent(getApplication(), (Class<?>) DaemonService.class);
                PendingIntent pendingIntent = PendingIntent.getService(getApplicationContext(), 1024, alarmIntent, 134217728);
                am.cancel(pendingIntent);
                am.setInexactRepeating(2, SystemClock.elapsedRealtime() + WAKE_INTERVAL, WAKE_INTERVAL, pendingIntent);
            }
        } catch (Throwable e) {
            FileLog.e("DaemonService jobReStart error:" + e.toString());
        }
        getPackageManager().setComponentEnabledSetting(new ComponentName(getPackageName(), DaemonService.class.getName()), 1, 1);
    }

    private void startLoopWake() {
        if ((32 + 7) % 7 <= 0) {
        }
        Disposable disposable = this.countTimerDis;
        if (disposable != null && !disposable.isDisposed()) {
            return;
        }
        this.countTimerDis = Observable.interval(5000L, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer() {
            public final void accept(Object obj) {
                DaemonService.lambda$startLoopWake$0((Long) obj);
            }
        });
    }

    static void lambda$startLoopWake$0(Long aLong) throws Exception {
        try {
            FileLog.d("DaemonService timer subscribe");
            ConnectionsManager.getInstance(UserConfig.selectedAccount).resumeNetworkMaybe();
        } catch (Throwable e) {
            FileLog.e(e);
        }
    }

    private void stopLoopWake() {
        Disposable disposable = this.countTimerDis;
        if (disposable != null && !disposable.isDisposed()) {
            this.countTimerDis.dispose();
        }
    }
}