阻止程序发起的半小时内的设备重启

hdrplus
Matthew 6 months ago
parent 7a784a89e0
commit 76e6770cac

@ -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));

@ -215,7 +215,7 @@ public:
virtual bool UpdateSchedules();
virtual bool QuerySystemProperties(map<string, string>& 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();

Loading…
Cancel
Save