Fix detector daemon status check and dumpsys-hang stale status

action.sh: use short pgrep patterns so the enforcement/detector 'running'
check resolves correctly instead of falsely reporting 'not running'.
cgdetect.sh: wrap dumpsys telephony.registry in timeout so a blocking
registry read can no longer freeze the status file and stall the frame
counter.
This commit is contained in:
sssnake
2026-07-12 11:09:41 -07:00
parent 9a3e3a0501
commit a5700eddce
2 changed files with 31 additions and 22 deletions

View File

@@ -38,7 +38,9 @@ echo "[$(date '+%Y-%m-%d %H:%M:%S')] cgdetect start (poll=${POLL}s)" >> "$CG/cgd
while true; do
# detector toggle (WebUI) — idle when off
if [ "$(cat "$CG/detect_enabled" 2>/dev/null)" = "0" ]; then sleep "$POLL"; continue; fi
reg=$(dumpsys telephony.registry 2>/dev/null)
# timeout guards against a blocking dumpsys hanging the whole loop (which
# would freeze the status file — the cause of stale frame counts).
reg=$(timeout 6 dumpsys telephony.registry 2>/dev/null)
# serving air-interface RAT = type of the registered cell identity (real MCC).
# A serving GSM/WCDMA identity == an active 2G/3G downgrade.
if echo "$reg" | grep -q 'CellIdentityNr:{[^}]*mMcc=[0-9]'; then rat=NR