Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

docs: bring back a package removed for user 0, and why the shell cannot disable one component

Mazin Kanuga956134a3f7be
diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md
index 5501e41ef..c56439b93 100644
--- a/docs/TROUBLESHOOTING.md
+++ b/docs/TROUBLESHOOTING.md
@@ -130,6 +130,44 @@ Things that bit us or contributors, so they don't bite you. Commands use `tools/
ten Amazon packages are protected, which
[`examples/amazon-fire-tv-stick-4k-2018/debloat.txt`](../examples/amazon-fire-tv-stick-4k-2018/debloat.txt)
lists, with the same DNS fallback for their endpoints.
+- **`pm disable <package>/<class>` is refused with `Shell cannot change component state`**, the
+ `SecurityException` you get when you try to keep a package and switch off only its Home activity or
+ boot receiver. The notes here have it for setupwraith's `.RecoveryActivity` (TCL G08, Chromecast with
+ Google TV HD, Google TV Streamer), launcherx's `.home.HomeActivity` (XGIMI MoGo 4), boot receivers on a
+ Fire TV Stick Lite (Fire OS 7) and a Motorola MT4310 (Android TV 11), and the ERGO DVB92YC's Live TV
+ boot receiver below. It is not that firmware: from Android 7.0, AOSP's `PackageManagerService` lets
+ the shell change only a whole package, and only between default, enabled and disabled-user (from 8.0
+ a test-only APK is the exception). The same check refuses `pm disable` and `pm disable-until-used` on
+ a whole package, which ask for other states, and any change, `pm enable` included, to a package that
+ is already `disabled` (`enabled=2` in `dumpsys package`, as `tvrecommendations` is on a Chromecast
+ with Google TV 4K). There is no shell route around it, so don't retry it with other flags: disable the
+ whole package with `pm disable-user --user 0`, or keep it.
+- **A package removed with `pm uninstall --user 0`, by hand or by another debloat tool, stays gone
+ after `tools/restore.sh`.** The [Toshiba 55Z500QF](devices/toshiba-55z500qf-cn.md) note (Hisense
+ firmware, Android 11, `RD2A.211001.002`) has 23 preinstalled packages its owner removed that way. The
+ command takes a package away from user 0 only, and a preinstalled one keeps its APK on the system
+ partition. `pm list packages -u --user 0 <package>` still names it (`-u` adds uninstalled packages)
+ and the same command without `-u` does not; the `User 0:` line of `dumpsys package <package>` says
+ `installed=false`. `tools/recovery.py` records a listed package that is already gone when
+ `tools/disable.sh` first runs as `absent`, so `restore.sh` prints
+ `leaving <package> alone (absent when the record was taken)`, and `tools/check.py` lists it under
+ "not installed any more". Bring it back with
+ `tools/tv.py 'cmd package install-existing --user 0 <package>'` (AOSP's `cmd package` has it from
+ Android 8.0; the Android 6 set in [#1185](https://github.com/Gathin23/cleanyourtv/issues/1185) had no
+ such command; no TV here has run it yet). It comes back enabled, and without its data unless the
+ uninstall used `-k`. To keep it, comment its line out of your list first: otherwise `check.py` reports
+ it as back on, and `--fix` or the next `disable.sh` run disables it again. If you don't want it, let
+ the list disable it afterwards, which the TV's own settings can undo. The record still calls it
+ absent, so `restore.sh` keeps leaving it alone: `pm enable --user 0 <package>` is its undo. Two cases
+ this does not cover. An app with no copy on the system partition that only user 0 had is deleted with
+ its APK: the command answers `Package <package> doesn't exist`, and only reinstalling the APK brings
+ it back (the Toshiba's `com.hisense.business.ad`). And a `User 0:` line with
+ `installed=true hidden=true` was hidden, not uninstalled. install-existing changes nothing there even
+ though it prints `Package <package> installed for user: 0`, and the shell cannot unhide it:
+ `pm unhide` needs `MANAGE_USERS`, which the shell does not hold from Android 7.0. Unhide it from the
+ device-owner app that hid it, or leave it, as the
+ [Chromecast with Google TV 4K list](../examples/google-chromecast-gtv-4k/debloat.txt) does with
+ `cast2class` (`hidden=true` and `enabled=2` there).
- **The Input key and CEC die after the hidden factory menu is opened**, seen on a Haier/CVTE set
(Durabrand `DURAT32ISDB`, `dupont`, Android TV 11 build `RTM6.230109.232`,
[#470](https://github.com/Gathin23/cleanyourtv/issues/470)). `com.cvte.tv.hkcfac` is the