From 4850c9f4805e12efd7a38c7923e716cc2fc743a9 Mon Sep 17 00:00:00 2001 From: newbit1 Date: Sat, 22 Apr 2023 20:29:14 +0200 Subject: [PATCH] added switching to user 0 when running FAKEBOOTIMG --- README.md | 8 +++++++- rootAVD.sh | 16 +++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 274d5e3..f8f1482 100644 --- a/README.md +++ b/README.md @@ -240,6 +240,9 @@ rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-31\google_apis_play * The script also detects if there is already a patched Boot.img present * This feature lets you also update and switch between Magisk Versions * Updating a patched ramdisk will delete the overlay.d folder, all mods are gone! +* If Magisk can't open a file manager, i.e. on Automotive AVDs, + * download and install the famous [X-plore file manager](https://www.lonelycatgames.com/apps/xplore) +* The script switches to user 0, so that you can see `/sdcard/Download/fakeboot.img` ### 2 Ways to boot the AVD into Safe Mode * 1st Way - If the AVD still boots normal: @@ -257,7 +260,7 @@ rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-31\google_apis_play * switch again to user 0 * open the Magisk App -> Settings -> Multiuser Mode -> **User-Independent** -> reboot AVD * Every time you want to Grant Su Permissions, switch to user 0 and then back to 10 `adb shell am switch-user 10` -* Alternative, you can install the Module [magisk-single-user](https://github.com/seebz/magisk-single-user) +* Alternative, you can install the Module [Magisk Single User Mod](https://github.com/newbit1/msum) * and remove all user higher than 0 i.e. `adb shell pm remove-user 13` or `adb shell pm remove-user 10` ### BlueStacks 4 Notes on MacOs @@ -345,6 +348,9 @@ rootAVD.bat %LOCALAPPDATA%\Android\Sdk\system-images\android-31\google_apis_play ### Change Logs #### [April 2023] +* [General] - added link to X-plore file manager +* [General] - added link to Magisk Single User Mod +* [General] - added switching to user 0 when running FAKEBOOTIMG * [rootAVD.bat] - changed return 1 to return 0 * [rootAVD.sh] - changed return 1 to return 0 * [rootAVD.sh] - changed copy and move routine diff --git a/rootAVD.sh b/rootAVD.sh index 46968e5..cd4a15a 100755 --- a/rootAVD.sh +++ b/rootAVD.sh @@ -227,13 +227,26 @@ runMagisk_to_Patch_fake_boot_img() { echo "[-] Starting Magisk" monkey -p $PKG_NAME -c android.intent.category.LAUNCHER 1 > /dev/null 2>&1 echo "[*] Install/Patch $FBI and hit Enter when done(max. 60s)" - read -t 60 proceed + read -t 60 proceed case $proceed in *) ;; esac } +detecting_users() { + local userID="" + local userZero=0 + echo "[*] Detecting current user" + userID=$(am get-current-user) + echo "[-] Current user $userID" + if [ "$userID" != "$userZero" ]; then + am switch-user $userZero + userID=$(am get-current-user) + echo "[-] Current user $userID" + fi +} + generate_build_prop() { echo "[*] generating Build.prop" local BPR=$BASEDIR/build.prop @@ -274,6 +287,7 @@ create_fake_boot_img() { echo "[*] repacking ramdisk.img into $FBI" $BASEDIR/magiskboot repack $FBHI $FBI > /dev/null 2>&1 InstallMagiskTemporarily + detecting_users runMagisk_to_Patch_fake_boot_img RemoveTemporarilyMagisk }