File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,7 @@ systemui_monitor() {
178178
179179
180180# Monitor SystemUI
181+
181182monitor_package () {
182183 if [ -f " $MONITOR_DISABLE_FILE " ]; then
183184 log_event " SystemUI monitoring is disabled. Exiting monitor."
@@ -188,16 +189,26 @@ monitor_package() {
188189 local MONITOR_TIMEOUT=25 # Total timeout in seconds
189190 local CHECK_INTERVAL=5 # Check interval in seconds
190191 local FAILURE_TIME=0 # Time elapsed since package stopped running
192+ local PREVIOUS_PID=" " # Previous PID of the package
191193
192194 while true ; do
193- if is_package_running; then
195+ CURRENT_PID=$( pidof " $PACKAGE " )
196+
197+ if [ -n " $CURRENT_PID " ]; then
198+ if [ " $CURRENT_PID " != " $PREVIOUS_PID " ]; then
199+ log_event " PID of $PACKAGE has changed from $PREVIOUS_PID to $CURRENT_PID ."
200+ PREVIOUS_PID=" $CURRENT_PID "
201+ if [ ! -f " $lock_file " ]; then
202+ systemui_monitor &
203+ fi
204+ fi
194205 FAILURE_TIME=0
195206 else
196207 log_event " $PACKAGE is not running. Failure timer: $FAILURE_TIME seconds."
197208 FAILURE_TIME=$(( FAILURE_TIME + CHECK_INTERVAL))
198209 if [ ! -f " $lock_file " ]; then
199- systemui_monitor &
200- fi
210+ systemui_monitor &
211+ fi
201212 if [ $FAILURE_TIME -ge $MONITOR_TIMEOUT ]; then
202213 log_event " $PACKAGE has not been running for $MONITOR_TIMEOUT seconds. Disabling Magisk modules and rebooting..."
203214 disable_magisk_modules
You can’t perform that action at this time.
0 commit comments