Since we cant actually get root permissions in appsupport, the next best thing would be Shizuku. I thought some of the users here would be interested, especially after the 4.6.0.12 update. Since I mainly use Shizuku for aurora store to automatically install apps without the need to confirm install/update for each and every app over and over (not to be confused with automatic updates). I also use it (with FreezeYou! from F-droid) to freeze some apps that stay active in the background and never respect the setting to be disabled in the background.
I have found this list of apps utilizing Shizuku if anyone’s interested. Many of them are cosmetic and related to Android UI, but, few others we can use in Appsupport.
Normally, (if an android device is not rooted) Shizuku needs to be started after every reboot with adb. Luckily for us we have a system.img that could be easily unpacked.
So,
1-Install Shizuku (available in Aurora store)
From my experience, one should open the app once for the rest to work.
A script then could be found: /home/defaultuser/android_storage/Android/data/moe.shizuku.privileged.api/start.sh
This script activates shiziku - If you’re satisfied with manually activating it after every appsupport reboot/start :
devel-su
appsupport-attach /system/bin/sh /storage/emulated/0/Android/data/moe.shizuku.privileged.api/start.sh
(most probably chmod +x is needed, can’t remember ).
2- To make it permanent, I have created a service(shizuku.rc) that activates the Shiziku start.sh script whenever appsupport is started:
service runapp /system/bin/start.sh class main
seclabel u:r:su:s0 user root group root
oneshot
on property:dev.bootcomplete=1
start runapp
3- Unpacked system.img:
- placed shizuku.rc in /system/etc/init
- chmod 644 shizuku.rc
- placed start.sh in /system/bin . Not sure if granting it executable permissions is necessary, but thats what I did anyway.
Since this process has to be repeated each time Appsupport gets updated, I’ve made a simple script. It unpacks system.img and repacks it keeping the original one as backup. I put the 2 files needed (start.sh & shizuku.rc) in my working directory and execute as root. Note that squashfs-tools & lzip(??-depending on the version of squashfs-tools installed I suppose) should be already installed.
Edit :
& for clarification:
- Added missing step (chmod 644 shizuku.rc) & uploaded the corrected script again to Mega
- squashfs-tools from Jolla’s repo doesn’t work for this purpose.
- I’m not sure what exactly @NettoHikari is talking about(regarding uid) but if you have a 64bit device and faced an error, check his post below
I’ll post the correct script here
#!/bin/sh
set -e
WORK_DIR="/home/defaultuser/work"
echo "Stoping appsupport..."
systemctl stop aliendalvik
sleep 4
echo "Checking if system.img exists..."
if [ ! -f "$WORK_DIR/origsystem.img" ]; then
echo "copying system.img..."
cp /opt/appsupport/system.img "$WORK_DIR/origsystem.img"
echo "system.img copied"
else
echo "system.img already exists, skipping copy"
fi
echo "extracting system.img..."
unsquashfs "$WORK_DIR/origsystem.img"
cp "$WORK_DIR/start.sh" squashfs-root/system/bin/
chmod +x "$WORK_DIR/squashfs-root/system/bin/start.sh"
echo "start.sh copied and permission set"
cp "$WORK_DIR/shizuku.rc" squashfs-root/system/etc/init
chmod 644 "$WORK_DIR/squashfs-root/system/etc/init/shizuku.rc"
echo "shizuku.rc copied and permission set"
echo "building new system.img..."
mksquashfs "$WORK_DIR/squashfs-root" "$WORK_DIR/system.img" -comp lz4 -Xhc -noappend -no-exports -no-duplicates -no->
echo "Cleaning up..."
rm -r -f "$WORK_DIR/squashfs-root"
echo "new system.img built"
while true; do
read -p "Do you wish to replace the old system.img in /opt/appsupport with the new one? (yes/no): " yn
case $yn in
[Yy]* )
echo "Replacing old system.img in /opt/appsupport..."
mv "$WORK_DIR/system.img" /opt/appsupport
break;;
[Nn]* )
echo "Operation cancelled. The new system.img will not be moved."
break;;
* )
echo "Please answer yes or no.";;
esac
done