This article demonstrates how to use Termux in combination with Tasker and Rish to manage application states; this allows users to enable or disable built-in applications directly from the device (when configured).
Table of Contents
If you haven’t already configured Shizuku (Rish) with Termux there is a guide available at: Termux, Shizuku and Rish configuration for Android 14
Rish variants for ADB commands
Note the following table assume that you have installed Rish within Termux at path: /data/data/com.termux/files/usr/bin/rish_auto
if you have installed Rish with a different Shell or path ensure you update it here.
Description | Command | Rish Equivalent |
---|---|---|
List all packages | adb shell pm list packages | rish_auto pm list packages |
List disabled packages | This command lists all disabled packages.adb shell pm list packages -d | rish_auto pm list packages - d |
List enabled packages | adb shell pm list packages -e | rish_auto pm list packages -e |
Disable packages | adb shell pm disable-user --user 0 <package_to_disable> | rish_auto pm disable-user --user 0 <package_to_disable> |
Enable packages | Find the package name that corresponds to the app you want to enable. adb shell pm enable <package_to_enable> | rish_auto pm enable <package_to_enable> |
Uninstall packages | Note that this on uninstall applications from user_mode:adb shell pm uninstall -k --user 0 <package_to_disable> | rish_auto pm uninstall -k --user 0 <package_to_disable> |
Reinstall built-packages to userspace | adb shell cmd package install-existing <name of package> | rish_auto cmd package install-existing <name of package> |
For those interested a previous article covered ADB in greater detail: Android: removing and managing built-in/bloatware applications with ADB
Example Task for Tasker
Download the XML for GitLab – Rish based Package State Prompt Task for Tasker to import on your device.
Tasker Task description
Task: Package Manager Prompt - Rish (Demonstration)
A1: Input Dialog [
Title: Which package?
Close After (Seconds): 30
Output Variable Name: %package
Continue Task After Error:On ]
A2: If [ %package !Set ]
A3: Flash [
Text: No package defined
Continue Task Immediately: On
Dismiss On Click: On ]
A4: Stop [ ]
A5: End If
A6: Input Dialog [
Title: Disable or Enable?
Default Input: disable
Close After (Seconds): 30
Output Variable Name: %state_temp
Continue Task After Error:On ]
A7: If [ %state_temp eq enable ]
A8: Variable Set [
Name: %state
To: enable-user
Structure Output (JSON, etc): On ]
A9: Else
A10: Variable Set [
Name: %state
To: disable-user
Structure Output (JSON, etc): On ]
A11: End If
A12: Variable Set [
Name: %arguments
To: -c 'pm %state %package'
Structure Output (JSON, etc): On ]
A13: Termux [
Configuration: /data/data/com.termux/files/usr/bin/rish_auto %arguments
Working Directory ✕
Stdin ✕
Custom Log Level null
Terminal Ses
Timeout (Seconds): 10
Structure Output (JSON, etc): On ]
A14: Flash [
Text: Attempting to %arguments with %result
Long: On
Continue Task Immediately: On
Dismiss On Click: On ]