Commit 53ec2317 by pye52

增加定时重启设备的功能

parent 3d0ce647
......@@ -32,17 +32,15 @@ public class MonitorUtils {
public static void startMonitors(Context context) {
startLogFilesMonitor(context);
startDatabaseMonitor(context);
startRebootMonitor(context);
}
public static void stopMonitors(Context context) {
stopLogFilesMonitor(context);
stopDatabaseMonitor(context);
stopRebootMonitor(context);
}
// 指定时间重启设备
private static void startRebootMonitor(Context context) {
public static void startRebootMonitor(Context context) {
stopRebootMonitor(context);
Calendar now = Calendar.getInstance(Locale.getDefault());
Calendar future = Calendar.getInstance(Locale.getDefault());
......@@ -61,21 +59,11 @@ public class MonitorUtils {
}
// 指定时间重启设备
private static void stopRebootMonitor(Context context) {
public static void stopRebootMonitor(Context context) {
WorkManager.getInstance(context)
.cancelUniqueWork(REBOOT_MONITOR_WORKER);
}
public static void startMonitors(Context context) {
startLogFilesMonitor(context);
startDatabaseMonitor(context);
}
public static void stopMonitors(Context context) {
stopLogFilesMonitor(context);
stopDatabaseMonitor(context);
}
// 每隔一定时间检查日志文件夹并进行清理
private static void startLogFilesMonitor(Context context) {
stopLogFilesMonitor(context);
......
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