mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-04 19:10:47 -05:00
Fix package management and user targeting on HSUM
- Use --user current for pm install, adb install, and appops set across install_script, adb_pm_install, and test/setup scripts. - Skip headless user 0 in get_users() on HSUM devices. - Use --user current in app_notify for non-app UIDs instead of calling content call against all users. - Clear path buffer on each iteration in setup_magisk_env. - Use --user current for am instrument in app migration tests. Assisted-by: Gemini 4 Argon
This commit is contained in:
@@ -123,11 +123,12 @@ adb_pm_install() {
|
||||
local tmp=/data/local/tmp/temp.apk
|
||||
cp -f "$1" $tmp
|
||||
chmod 644 $tmp
|
||||
su 2000 -c pm install -g $tmp || pm install -g $tmp || su 1000 -c pm install -g $tmp
|
||||
local cmd="pm install --user current -g $tmp"
|
||||
su 2000 -c $cmd || $cmd || su 1000 -c $cmd
|
||||
local res=$?
|
||||
rm -f $tmp
|
||||
if [ $res = 0 ]; then
|
||||
appops set "$2" REQUEST_INSTALL_PACKAGES allow
|
||||
appops set --user current "$2" REQUEST_INSTALL_PACKAGES allow
|
||||
fi
|
||||
return $res
|
||||
}
|
||||
|
||||
+2
-2
@@ -322,8 +322,8 @@ app_test_main() {
|
||||
for apk in "${apks[@]}"; do
|
||||
# Cleanup
|
||||
adb shell pm uninstall com.topjohnwu.magisk || true
|
||||
adb install -r -g $apk
|
||||
adb install -r -g out/test.apk
|
||||
adb install --user current -r -g $apk
|
||||
adb install --user current -r -g out/test.apk
|
||||
am_instrument '.AppTest' $app
|
||||
done
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ if [ -z "$FIRST_STAGE" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
pm install -r -g $(pwd)/magisk.apk
|
||||
pm install --user current -r -g $(pwd)/magisk.apk
|
||||
|
||||
# Stop zygote (and previous setup if exists)
|
||||
magisk --stop 2>/dev/null
|
||||
|
||||
@@ -44,7 +44,7 @@ ensure_android_cli() {
|
||||
# $2 = component
|
||||
am_instrument() {
|
||||
set +x
|
||||
local out=$(adb shell am instrument -w --user 0 -e class "$1" "$2")
|
||||
local out=$(adb shell am instrument -w --user current -e class "$1" "$2")
|
||||
echo "$out"
|
||||
if grep -q 'OK (' <<< "$out"; then
|
||||
set -x
|
||||
@@ -60,10 +60,10 @@ run_setup() {
|
||||
adb shell 'PATH=$PATH:/debug_ramdisk magisk -v'
|
||||
|
||||
# Install the Magisk app
|
||||
adb install -r -g $apk
|
||||
adb install --user current -r -g $apk
|
||||
|
||||
# Install the test app
|
||||
adb install -r -g out/test.apk
|
||||
adb install --user current -r -g out/test.apk
|
||||
|
||||
local app='com.topjohnwu.magisk.test/com.topjohnwu.magisk.test.AppTestRunner'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user