diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 37ab57ce..f9815f3d 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -1056,11 +1056,21 @@ bool CPhoneDevice::InstallAPP(const std::string& path, unsigned int delayedTime) return true; } -bool CPhoneDevice::Reboot(int resetType, const std::string& reason) +bool CPhoneDevice::Reboot(int resetType, bool manually, const std::string& reason) { if (resetType == REBOOT_TYPE_DEVICE) { // reboot the device + if (!manually) + { + time_t rebootTime = GetRebootTime(); + time_t ts = time(NULL); + if ((ts - rebootTime) < 1800) + { + XYLOG(XYLOG_SEVERITY_WARNING, "Frequent REBOOT DEV Cancelled Prev RBT Time=%lld", (int64_t)rebootTime); + return false; + } + } std::thread t([]() { std::this_thread::sleep_for(std::chrono::milliseconds(1000)); diff --git a/app/src/main/cpp/PhoneDevice.h b/app/src/main/cpp/PhoneDevice.h index 7b3fb8d9..e6dee1e2 100644 --- a/app/src/main/cpp/PhoneDevice.h +++ b/app/src/main/cpp/PhoneDevice.h @@ -215,7 +215,7 @@ public: virtual bool UpdateSchedules(); virtual bool QuerySystemProperties(map& properties); virtual bool InstallAPP(const std::string& path, unsigned int delayedTime); - virtual bool Reboot(int resetType, const std::string& reason); + virtual bool Reboot(int resetType, bool manually, const std::string& reason); virtual bool EnableGPS(bool enabled); virtual float QueryBattaryVoltage(int timesForAvg, bool* isCharging); virtual bool RequestPosition();