lihenggui/blocker
소개
통합 방화벽을 사용해 애플리케이션 구성 요소를 관리합니다.
보안 및 개인정보 보호측정된 스타 증가
- in 24h
- 0
- in 7 days
- +15
- in 15 days
- +22
- in 1 month
- +54
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalBlocker
Blocker is a component controller for Android applications that currently supports using
PackageManager and Intent Firewall to manage the state of components. For bloated applications, many
components within the application are redundant. Blocker provides a convenient control button to
manage the corresponding components, enabling the disabling of unnecessary functions and saving
application runtime resources.
Blocker can be seamlessly switched between these controllers, and for application rules, you can
export and import them. Additionally, it is compatible with backup files generated by
MyAndroidTools, and you can effortlessly convert them to Intent Firewall rules. The application also
has the potential to be extended in the future.
Advantages
- Lightweight, don't burden the system
- Easy to use
- Supports multiple control types
Introduction to different component controllers
Package Manager
The Android system provides a tool called PackageManager, which is used for managing installed
applications or obtaining information about them. One of its
methods, setComponentEnabledSetting(ComponentName, int, int), allows an application to control
the state of its own components. If attempting to use this method to control components in other
applications, a signature permission is required, or the call will fail.
Fortunately, Android provides another tool called pm that allows users to control component states in command-line mode. However, the pm tool requires root permission to run. The following command can be used to disable a specific package or component:
pm disable [PackageName/ComponentName]
Whether using PackageManager in the code or pm in command-line mode, the configurations will be written to /data/system/users/0/package_restrictions.xml.
Intent Firewall Mode
Intent Firewall was introduced in Android 4.4.2 (API 19) and is still effective in the latest Android systems. It is integrated into the Android Framework to filter the intents sent by applications or systems.
What Intent Firewall can do
Each intent sent by an application is filtered by the Intent Firewall, with rules stored in XML files. The Intent Firewall updates rules immediately if changes occur in the configuration file.
Limitations of Intent Firewall
Only system applications can read and write the directory where the configuration file is stored, and third-party applications do not have permission to access it.
The firewall cannot stop implicit broadcasts to a single receiver, so Intent Firewall mode disables broadcast receivers through PackageManager. Applications can detect this disabled state.
Differences between Intent Firewall and Package Manager
Intent Firewall, indeed it is a firewall, it has no impact on component status. The application detects the component is on, but it just cannot start the component.
An attempt to start a component disabled through PackageManager can throw an exception. An application can catch the exception and re-enable the component.
References
Shizuku/Sui Mode
Shizuku is an application developed by Rikka, RikkaApps/Shizuku
Starting from Android O, if we install a Test-Only application, users could use pm command to control the command status. We could modify the install package to set it into Test-Only mode, using APIs provided by Shizuku to control the component status.
Tutorial for modifying APKs (Chinese Only) [实验性功能] [开发者向]如何免Root控制应用程序组件
Please note: For normal applications, the Shell permission in Shizuku mode is not sufficient to
change the switch status of components. In other words, unmodified APKs do not support non-root
modification. If you want to use Shizuku to modify the component status of normal applications,
please start Shizuku with Root privileges.
Implementation of this restriction in
AOSP: frameworks/base/services/core/java/com/android/server/pm/PackageManagerService.java
Screenshot tests
Blocker uses Roborazzi to do screenshot tests
of certain screens and components. To run these tests, run the verifyRoborazziDebug or
recordRoborazziDebug tasks. Note that screenshots are recorded on CI, using Linux, and other
platforms might generate slightly different images, making the tests fail.
Architecture
The architecture of the Blocker app is based on the architecture described in Now in Android, and it also adheres to the official architecture guidance.
For information on modularization, please refer to this article: Modularization Learning Journey.
UI
The app was designed using Material 3 guidelines. Learn more about the design process and obtain the design files in Figma.
Huge thanks to our UI designer: @COPtimer
The Screens and UI elements are built entirely using Jetpack Compose.
The app has two themes:
- Dynamic color - uses colors based on the user's current color theme (if supported)
- Default theme - uses predefined colors when dynamic color is not supported
Each theme also supports dark mode.
Translation Contributions
Default string resources for the Blocker app are located here:
app-compose/src/main/res/values/strings.xmlcore/[module]/src/main/res/values/strings.xmlsync/[module]/src/main/res/values/strings.xmlfeature/[module]/src/main/res/values/strings.xml
Translate each and place them in the respective locations ([module]/src/main/res/values-[lang]/strings.xml).
Alternatively, you can use Weblate to translate this project. (Thanks @SanmerDev for providing the service)
Frequently Asked Questions
- Why can I not change an app's component state in Shizuku mode?
- Shizuku started through ADB can change components only in apps marked as test-only. Regular apps require root-backed Shizuku. When Android refuses a component change under ADB permissions, Blocker asks you to start Shizuku with root and try again.
- Does Blocker include analytics or closed-source dependencies?
- No. Blocker is completely open-source and contains no Firebase, Google Mobile Services, or telemetry SDKs across all distribution channels (GitHub Releases, F-Droid, and Google Play). Local runtime and crash logs stay on your device and are only exported when you choose Export error log in Support & Feedback.
관련 프로젝트 살펴보기
불러오는 중…

