Commit ec10da68 by pye52

1、优化点击返回按钮时应用的响应(现在会把进程杀掉避免其他异常)

2、开启定时重启功能
parent 1a73c3ac
......@@ -400,6 +400,8 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
SCWebSocketClient.getInstance().realClose();
SCTaskExecutor.getInstance().quit();
MonitorUtils.stopMonitors(this);
LogUtils.d(TAG, "MainActivity onDestroy,退出应用");
android.os.Process.killProcess(android.os.Process.myPid());
}
private void initViews() {
......
......@@ -26,17 +26,19 @@ public class MonitorUtils {
private static final int LOG_REPEAT_INTERVAL = 4;
private static final int DATABASE_REPEAT_INTERVAL = 12;
// 每天早上指定时间重启设备
private static final int REBOOT_HOUR_OF_DAY = 3;
private static final int REBOOT_MIN = 0;
private static final int REBOOT_HOUR_OF_DAY = 0;
private static final int REBOOT_MIN_OF_HOUR = 1;
public static void startMonitors(Context context) {
startLogFilesMonitor(context);
startDatabaseMonitor(context);
startRebootMonitor(context);
}
public static void stopMonitors(Context context) {
stopLogFilesMonitor(context);
stopDatabaseMonitor(context);
stopRebootMonitor(context);
}
// 指定时间重启设备
......@@ -46,7 +48,7 @@ public class MonitorUtils {
Calendar future = Calendar.getInstance(Locale.getDefault());
future.add(Calendar.DAY_OF_YEAR, 1);
future.set(Calendar.HOUR_OF_DAY, REBOOT_HOUR_OF_DAY);
future.set(Calendar.MINUTE, REBOOT_MIN);
future.set(Calendar.MINUTE, REBOOT_MIN_OF_HOUR);
future.set(Calendar.SECOND, 0);
long delay = future.getTimeInMillis() - now.getTimeInMillis();
LogUtils.d(TAG, delay + "毫秒后将重启设备");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment