feat: add "Restore PM modifications" option in settings - #1529
Open
lihenggui wants to merge 6 commits into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 viapm 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.