|
@@ -16,6 +16,7 @@
|
|
|
#include <sys/reboot.h>
|
|
|
#include "service/BusinessConfig.h"
|
|
|
|
|
|
+static bool isRestartTimerRegistered = false;
|
|
|
static bool isHelpTimerRegistered = false;
|
|
|
static bool sosTimerRegistered = true;
|
|
|
static bool isSleepTimerRegistered = false; // 是否开启息屏定时任务
|
|
@@ -26,6 +27,7 @@ static bool isSleep = false; // 是否在息屏
|
|
|
#define NURSING_TIME_HANDLE 6 // 护理的定时器id
|
|
|
#define EVENT_TIME_HANDLE 8 // 事件定时器
|
|
|
#define SLEEP_STRAT_TIME_HANDLE 9 // 息屏
|
|
|
+#define SYS_RESTART 10 // 重启
|
|
|
|
|
|
namespace {
|
|
|
std::string uilogic[] = {
|
|
@@ -512,6 +514,24 @@ void setSleepTimerRegistered(bool result) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void setRestartTimerRegistered(bool result) {
|
|
|
+ if (mActivityPtr == NULL) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (result != isRestartTimerRegistered) { // 在传过来的值不相等时,才继续进行
|
|
|
+ if (!isRestartTimerRegistered) { // 如果是false,那就需要开启
|
|
|
+ isRestartTimerRegistered = true;
|
|
|
+ mActivityPtr->registerUserTimer(SYS_RESTART, 180000);
|
|
|
+ }
|
|
|
+ else { // 如果是true,那就需要关闭
|
|
|
+ isRestartTimerRegistered = false;
|
|
|
+ mActivityPtr->unregisterUserTimer(SYS_RESTART);
|
|
|
+ dataRefresh();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
void scrrenOn() {
|
|
|
isSleep = false;
|
|
|
BRIGHTNESSHELPER->screenOn();
|
|
@@ -959,6 +979,12 @@ static bool onUI_Timer(int id){
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
+
|
|
|
+
|
|
|
+ case SYS_RESTART:
|
|
|
+ sync();
|
|
|
+ reboot(RB_AUTOBOOT);
|
|
|
+ break;
|
|
|
}
|
|
|
return true;
|
|
|
}
|