From 76e6770caccb94ecbeb9b95b94ffa7caf7d4c193 Mon Sep 17 00:00:00 2001 From: Matthew Date: Sun, 8 Dec 2024 00:36:01 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=BB=E6=AD=A2=E7=A8=8B=E5=BA=8F=E5=8F=91?= =?UTF-8?q?=E8=B5=B7=E7=9A=84=E5=8D=8A=E5=B0=8F=E6=97=B6=E5=86=85=E7=9A=84?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E9=87=8D=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/PhoneDevice.cpp | 12 +++++++++++- app/src/main/cpp/PhoneDevice.h | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) 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();