Skip to content

tools: profile.py, one household profile captured from the master unit - #3216

Closed
darkrei08 wants to merge 2 commits into
Gathin23:mainfrom
darkrei08:tools/tv-profiles
Closed

darkrei08 wants to merge 2 commits into
Gathin23:mainfrom
darkrei08:tools/tv-profiles

Conversation

@darkrei08

Copy link
Copy Markdown

tools/profile.py keeps one household profile for TVs that should look the same: capture what a master unit has installed and disabled, check another unit against it, and sync the missing apps and the disabled set over ADB. Nothing is uninstalled; the exit codes are the ones check.py already uses.

  • capture: writes profiles/<name>/ with the package lists and a JSON summary.
  • check: compares a unit against the profile and prints what drifts.
  • sync --source: installs the missing apps (split APKs in one session, abandoned when the TV refuses the commit) and mirrors the disabled set.

profiles/master/ is the profile measured on a Chromecast with Google TV 4K: 20 apps and 16 disabled packages. The guide is docs/profiles.md, and docs/TROUBLESHOOTING.md gains the note that ADB never stays on by itself, which the sync depends on.

Tested on: Chromecast with Google TV 4K (sabrina, Android 14), a second unit of the same model synced from it. tools/venv/bin/python -m unittest discover -s tests passes (2869 tests, 37 skipped).

Second of the three PRs the bot asked for on #3214; settings_sync.py and the launcher change come separately.

If this adds or changes a TV list

  • not a TV list

If this touches the launcher

  • not the launcher

If this adds or changes a theme

  • not a theme

If this adds a theme key (a switch)

  • not a switch

If this adds an add-on

  • not an add-on

capture what a master TV has installed and disabled, check another unit against it, and sync the missing apps and the disabled set over ADB. Nothing is uninstalled, and the exit codes match check.py. Ships the master profile measured on a Chromecast with Google TV 4K, the guide, and the troubleshooting note that ADB never stays on by itself.
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

maintainer-bot review · this one needs a maintainer decision

Thanks for the careful split from #3214 and the fake-TV harness, which lets sync be tested without a set. Copying apps between TVs is a new kind of feature, so this needs a scope call from the maintainer. Before that, it would help to send the disabling through disable.sh and to fold the drift check into check.py.

Why it goes to a maintainer: the bot asks for a maintainer decision.

Checks

This is a suggestion; a maintainer makes the final call. A maintainer can comment /bot review to run it again.

Reviewed by maintainer-bot · runs on 0G Private Computer

@github-actions github-actions Bot added needs-maintainer scripts build-and-install, disable, restore, tv.py and the other tools labels Nov 3, 2026
@darkrei08

Copy link
Copy Markdown
Author

A reader's map for this one:

  • tools/profile.py: capture is the only writer under profiles/; check and plan are read-only and produce the drift; sync is plan plus the installs and the disable calls. Nothing in it calls uninstall.
  • install_split uses one install-create session and abandons it when the TV refuses the commit, so a partial split install cannot leave the unit half-installed.
  • tests/profile_fake.py gives each simulated unit its own state file, keyed by TV_HOST, which is why a test can hold a master and a target at once.
  • profiles/master/ is the measurement from the description; it is data, and a different model needs its own folder rather than an edit here.

Not tested: a unit whose Android version differs from the master's.

A profile is hand-editable data, so its debloat list can name a package Android needs to boot. Sync now filters the disable step through recovery.core_packages, the same pattern tests/test_core_packages.py keeps identical to disable.sh and disable.ps1, and says which names it refused. The rest of the sync still runs.
@darkrei08

Copy link
Copy Markdown
Author

Picked up both notes.

The disabling step now refuses the core packages. sync filters its disable list through recovery.core_packages, which is the same pattern tests/test_core_packages.py keeps identical to disable.sh and disable.ps1, so the guard the boot-safety issue in #884 relies on applies here too, and it cannot drift from the two scripts. A refused name is printed with the reason and the rest of the sync still runs. tests/test_profile_sync.py pins it: with com.android.systemui in the profile, no pm disable-user for it reaches the TV, the refusal is on stderr, and a normal package in the same run still lands. Suite: 2870 tests, 0 failures.

What is still genuinely the maintainer's call: the whole destructive step could instead be delegated to tools/disable.sh with a temporary list, which would also bring the Home guard and the ~/.cleanyourtv recovery record for free. I did not do that here because it changes the tool's contract (disable.sh owns a debloat run and its record, sync owns a convergence plan), so I would rather implement it on your word than guess. Say which you prefer and I will.

On the #3198 collision: the two edits are not in the same region. That PR's docs/TROUBLESHOOTING.md hunk is around line 1135 (a Sony settings key that is a service rather than an activity); the note this PR adds sits at line 58, in the wireless-debugging block. A merge of both is two disjoint insertions. If you would still rather keep this PR to the tool alone, I can drop the note: it belongs to the ADB story, not to profile.py.

@Gathin23

Gathin23 commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Thanks @darkrei08, the fake-TV harness and the core-package guard in sync are careful work. Cloning a household's apps from one TV to others is outside the debloat core, so it fits best in your own repo with one SHOWCASE.md row pointing to it. Please drop the always-on ADB note and adbautoenable there too. We never point people at keeping ADB on at boot.

@Gathin23 Gathin23 closed this Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-maintainer scripts build-and-install, disable, restore, tv.py and the other tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants