a
554325746@qq.com
2019-12-25 603cb36a5123e46656b06a5deb8d7ac7ff81307f
app/src/main/java/com/basic/security/service/KeepLifeService.java
@@ -30,7 +30,7 @@
        @Override
        public void onReceive(Context context, Intent intent) {
            lastOnReceive = System.currentTimeMillis();
//            System.out.println("KeepLifeService.onReceive");
//            System1.out.println("KeepLifeService.onReceive");
        }
    };
    private String mPackName;
@@ -86,7 +86,7 @@
        BaseApplication.getApplication().executorService.execute(() -> {
            while (running) {
                try {
//                        System.out.println("KeepLifeService.run " + Thread.currentThread().getId());
//                        System1.out.println("KeepLifeService.run " + Thread.currentThread().getId());
                    SystemClock.sleep(2 * 1000);
                    if (Constants.autoRestart) {
                        boolean isRun = isRunningProcess(mActivityManager, mPackName);
@@ -120,7 +120,7 @@
        try {
            BaseApplication.getApplication().executorService.execute(() -> {
                while (running) {
//                    System.out.println("服务正在运行..." + Thread.currentThread().getId());
//                    System1.out.println("服务正在运行..." + Thread.currentThread().getId());
                    try {
                        Thread.sleep(2 * 1000);
                        if (Constants.autoRestart) {
@@ -174,6 +174,6 @@
        unregisterReceiver(keepLifeReceiver);
        running = false;
        stopForeground(true);
//        System.out.println("KeepLifeService.onDestroy");
//        System1.out.println("KeepLifeService.onDestroy");
    }
}