Giter VIP home page Giter VIP logo

blocker's Introduction

中文README

Telegram discussion group

https://t.me/blockerandroid

Introduction

Blocker is a component controller for Android applications that currently supports using PackageManager and Intent Firewall to manage the state of components. It 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.

Get it on F-Droid Get it on Google Play

Advantages

  1. Lightweight, don't burden the system
  2. Easy to use
  3. 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/ComponmentName]

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 permissions to access it.

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.

For the components disabled by PackageManager, if an application starts it, an exception will be thrown. Developers can catch this exception to know whether the component is disabled or not, so they could re-enable this component. That's the reason why the components will be enabled unexpectedly. If you are using an Intent Firewall controller, there will be no problems.

References

Intent Firewall

Shizuku Mode (No Root Permission Required)

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控制应用程序组件

blocker's People

Contributors

lihenggui avatar newbugger avatar renovate[bot] avatar juliewww avatar tommynok avatar coptimer avatar zhaobozhen avatar handsomexi avatar poussinou avatar david082321 avatar nkh0472 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.