From fa176e8877a19dd4cf3a07f8616307c6a358f309 Mon Sep 17 00:00:00 2001 From: Matthew Date: Tue, 10 Sep 2024 14:16:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BB=B6=E8=BF=9F=E9=87=8D=E5=90=AFMpAPP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 避免打断拍照 --- .../main/java/com/xypower/mpmaster/MpMasterService.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java b/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java index 0ae2c614..f30ab515 100644 --- a/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java +++ b/mpmaster/src/main/java/com/xypower/mpmaster/MpMasterService.java @@ -121,6 +121,7 @@ public class MpMasterService extends Service { private boolean mSeparateNetwork = false; + private long mDelayedRestartMpTime = 60000; private PendingIntent mPreviousHB = null; private long mPreviousHeartbeatTime = 0; @@ -366,7 +367,7 @@ public class MpMasterService extends Service { final String appPath = MicroPhotoContext.buildMpAppDir(context); final long ts = System.currentTimeMillis(); if (ts - mTimeToStartMpApp < 30000) { - logger.warning("MpAPP is STILL Running"); + logger.warning("MpAPP has restarted in 30s"); return; } @@ -387,7 +388,7 @@ public class MpMasterService extends Service { MicroPhotoContext.restartMpApp(context); mTimeToStartMpApp = System.currentTimeMillis(); } - }, 60000); + }, mDelayedRestartMpTime); } } catch (Exception ex) { @@ -521,7 +522,7 @@ public class MpMasterService extends Service { mService.mMpHeartbeatDuration = intent.getIntExtra("HeartbeatDuration", 600000); } - mService.logger.info("Heartbeat Timer Fired By MpAPP ACTION=" + action); + mService.logger.info("Heartbeat Timer Fired By MpAPP ACTION=" + action + " MpHB=" + Long.toString(mService.mMpHeartbeatDuration)); mService.registerHeartbeatTimer(); @@ -645,6 +646,7 @@ public class MpMasterService extends Service { registerHeartbeatTimer(zeroPoint + closestTime * 1000, keepAlive); } } else { + // mUsingAbsHbTime: false if ((mPreviousHeartbeatTime != 0) && (mPreviousHeartbeatTime - currentTimeMs < mHeartbeatDuration * 1000)) { registerHeartbeatTimer(mPreviousHeartbeatTime + mHeartbeatDuration * 1000, keepAlive); } else {