This is doable in Android [rooted: 1] if you're willing to do some scripting:
- install Termux and the Termux widget
- create a directory names .shortcuts in your Termux home directory
- install the tsu package in Termux:
pkg update; pkg install tsu
- place enable/disable scripts in the
.shortcuts directory, these scripts can look like this:
#!/data/data/com.termux/files/usr/bin/bash
PACKAGE="com.google.android.apps.maps"
PATH="/data/data/com.termux/files/usr/bin:$PATH"
command=$(echo "$0"|cut -d: -f2)
case $command in
disable)
sudo pm disable "$PACKAGE"
;;
enable)
sudo pm enable "$PACKAGE"
;;
*)
echo "command '$command' not supported"
;;
esac
exit 0
For each package you want to be able to enable/disable on the fly put a copy of this script in the
$HOME/.shortcuts directory using a name like (in this case, using Google Maps as an example)
Google_Maps:enable, then make a link to this script named
Google_Maps:disable. Configure PACKAGE to the right package name, here it is set to
com.google.android.apps.maps.
- put the Termux widget somewhere on your home screen
You'll see a list of all your enable/disable scripts in the widget and should be able to enable/disable the related packages on the fly.
[1] it might be possible without root but Termux does not seem to be able to run pm* (Android package manager cli) commands in scripts without root, at least not in the current incarnation.