Skip to content

feat: add "Restore PM modifications" option in settings - #1529

Open
lihenggui wants to merge 6 commits into
mainfrom
feat/reset-pm-modifications
Open

feat: add "Restore PM modifications" option in settings#1529
lihenggui wants to merge 6 commits into
mainfrom
feat/reset-pm-modifications

Conversation

@lihenggui

@lihenggui lihenggui commented Apr 19, 2026

Copy link
Copy Markdown
Owner

Adds a Restore PM modifications entry in Settings that reverts every component Blocker has disabled via the PackageManager controller back to its manifest-declared default state by running pm default-state. This solves a long-standing pain point: once components were disabled via pm disable, there was no one-click way to roll everything back without rebooting into a broken state or manually editing /data/system/users/0/package-restrictions.xml.

Let users revert every component that Blocker has disabled via the
PackageManager controller back to its manifest-declared default state by
running `pm default-state`. This removes the user override from
/data/system/users/0/package-restrictions.xml so the component truly
returns to its original state (unlike `pm enable`, which still leaves a
user-enabled record and may override a manifest default of `false`).

Plumbing:
- ComponentState.DEFAULT (COMPONENT_ENABLED_STATE_DEFAULT).
- RootController gains a `pm default-state` command template; the
  setComponentEnabledSetting-based controllers pass the new value
  through unchanged.
- IfwController maps DEFAULT to "remove filter" since IFW has no
  manifest default.
- AppComponentDao.getPmBlockedComponents() surfaces the set of
  components Blocker has modified via PM, used as the precise scope
  for the restore (no full-system scan needed).
- ComponentRepository.restorePmBlockedComponents() picks Shizuku or
  Root API based on user preference, resets each component, and
  clears pm_blocked in the database on success.
- ResetPmWorker drives the restore as a foreground WorkManager task,
  reusing the existing RuleNotificationWorker scaffolding and error
  reporting flow.
- New PM section in Settings with a confirmation dialog.
core:data-test wasn't rebuilt locally; CI caught the missing override.
Also drops the unused feature_settings_api_reset_pm_confirm string —
BlockerWarningAlertDialog uses android.R.string.ok for the confirm
button.
feature/settings/api: es, fr, in, ru, tr, vi
core/rule: ar, es, fr, in, pt-rBR, ru

Clears MissingTranslation lint warnings introduced by the reset PM feature.
…ations

# Conflicts:
#	core/component-controller/src/main/kotlin/com/merxury/blocker/core/controllers/root/command/RootController.kt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant