From 0d143f88aa7e76e1a96c2bee8acbd563075a3b37 Mon Sep 17 00:00:00 2001 From: ash-iir <254348575+ash-iir@users.noreply.github.com> Date: Thu, 19 Nov 2026 11:39:48 +0000 Subject: [PATCH] worker: freeze only app uids, in the right user freeze() killed every process of the uid that owns /data/data/. For a system app sharing uid 1000 that includes system_server (soft reboot), and /data/data is always user 0, so a secondary-user op stopped the user-0 instance. Read /data/user/$U and fall back to pidof below 10000. Signed-off-by: ash-iir <254348575+ash-iir@users.noreply.github.com> --- module/scripts/worker.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/module/scripts/worker.sh b/module/scripts/worker.sh index cc63ee9..f089c00 100644 --- a/module/scripts/worker.sh +++ b/module/scripts/worker.sh @@ -406,10 +406,11 @@ freeze() { # only, but the wall merely moved to ~120 - the AMS call itself is the problem. kill makes # ZERO AMS calls, so it scales to any number of apps. Kill every process of the app's uid # (the main process AND its :sub-processes, which a `pidof` comm match alone would miss). - _fu="$(stat -c %u "/data/data/$1" 2>/dev/null)" - case "$_fu" in - ''|*[!0-9]*|0) kill -9 $(pidof "$1" 2>/dev/null) 2>/dev/null || true; return 0 ;; - esac + # Only for an app uid: a system app can share uid 1000 with system_server, and killing + # that uid soft-reboots the phone, so those fall back to the pidof match. + _fu="$(stat -c %u "/data/user/${U:-0}/$1" 2>/dev/null)" + case "$_fu" in ''|*[!0-9]*) _fu=0 ;; esac + if [ $(( _fu % 100000 )) -lt 10000 ]; then kill -9 $(pidof "$1" 2>/dev/null) 2>/dev/null || true; return 0; fi for _fd in /proc/[0-9]*; do [ "$(stat -c %u "$_fd" 2>/dev/null)" = "$_fu" ] && kill -9 "${_fd##*/}" 2>/dev/null done