Android - How does freezing an app work technically?
Titanium Backup etc just use in-built Package Manager (pm)
to freeze an app. pm
has a feature to prevent apps from running & from appearing in Launcher. To use it, Titanium Backup etc execute following command:
pm disable {package_name}
You can freeze apps by yourself without using a dedicated freezer app. Just use the above command in Terminal Emulator or ADB Shell
.
For example, if you want to freeze Stock Web Browser
, open Terminal Emulator
& switch to root using su
command. Then, execute # pm disable com.android.browser
.
It'll return #Package com.android.browser new state: disabled
. Done!
Restart your Launcher (some devices may require reboot) to see the app icon gone.
To defrost the app, just replace disable
with enable
in the command.
I found how pm disable
works:
If you run cat /system/bin/pm
, it gives:
# Script to start "pm" on the device, which has a very rudimentary
# shell.
#
base=/system
export CLASSPATH=$base/framework/pm.jar
exec app_process $base/bin com.android.commands.pm.Pm "$@"
So apparently it is the same as the PackageManager we use from Java, it is calling it - just in a root context that no user app can directly access.
You CAN check if something is frozen, using
getPackageManager().getApplicationEnabledSetting( the package name ) ==
getPackageManager().COMPONENT_ENABLED_STATE_DISABLED)