From b32300def3c46f6b3643c5457480dbe8909b476e Mon Sep 17 00:00:00 2001 From: Tom Kimsey Date: Fri, 12 Apr 2024 09:37:41 -0400 Subject: [PATCH] Improved reboot watchdog functionality User no longer has to modify the rebootWatchdog.json file. --- .../system/application/SCAppRebootWatchdog.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/hms_networks/americas/sc/extensions/system/application/SCAppRebootWatchdog.java b/src/main/java/com/hms_networks/americas/sc/extensions/system/application/SCAppRebootWatchdog.java index 16e99b60..1c1b4316 100644 --- a/src/main/java/com/hms_networks/americas/sc/extensions/system/application/SCAppRebootWatchdog.java +++ b/src/main/java/com/hms_networks/americas/sc/extensions/system/application/SCAppRebootWatchdog.java @@ -170,12 +170,14 @@ private static void initRebootWatchdogFile() throws IOException, JSONException { ConfigFileAccessManager.getJsonObjectFromFile(REBOOT_WATCHDOG_FILE_PATH); rebootCount = rebootWatchdogObject.getInt(REBOOT_COUNT_KEY); rebootCount += 1; - rebootWatchdogObject.put(REBOOT_COUNT_KEY, rebootCount); - } - // Device reboot loop has been detected - if (rebootCount > MAX_REBOOT_COUNT) { - disableJvmRunFile(); + // Device reboot loop has been detected + if (rebootCount > MAX_REBOOT_COUNT) { + disableJvmRunFile(); + rebootCount = 0; + } + + rebootWatchdogObject.put(REBOOT_COUNT_KEY, rebootCount); } ConfigFileAccessManager.writeJsonObjectToFile(