Git Product home page Git Product logo

blocker's Introduction

中文README

Introduction

Blocker is a component controller for Android applications. Currently it supports using PackageManager and Intent Firewall to control the state of componets, and it can be extended in the future. You could switch between these controllers seamlessly. For the application rules, you could export & import it. It is compatible with the backup files generated by MyAndroidTools, and you could convert it to Intent Firewall rules without any effort.

Advantages

  1. Lightwight, don't burden the system
  2. Easy to use
  3. Supports multiple control types
  4. FREE

Introduction to different component controllers

Package Manager

Android system provide us a tool called PackageManager, for managing the applications installed on the phone or getting informations of the applications. It has a method called setComponentEnabledSetting(ComponentName, int, int), application can call this API to control the component state for itself. Call to this API to control other applications will fail unless you have signature permission.

Fortunately Android has another tool called pm, users could control the component state in the command line mode. But it needs Root permission to run with.

pm disable [PackageName/ComponmentName]

No matter using PackageManager in the code or using pm in the command line mode, the configurations will be written to /data/system/users/0/package restrictions.xml.

Intent Firewall Mode

Starting from Android 4.4.2(API 19), the Intent Firewall was introduced. It is still has effects in the latest Android system (Pie, API 28). It was intergrated into Android Framework, for filtering the intents sent by applications or system.

What Intent Firewall can do

Each intent sent by application will be filtered by Intent firewall. The rules are stored in xml files. If there are changes in the configuration file has changed, the Intent Firewall will update the rules immediately.

Limitations of Intent Firewall

Based on security considerations, only system applications can read & write the directory directly where the configuration file is placed, third-party applications does not have any permissions to get the configuration file. Furthermore, when the firewall filters the rules, the sender identity of the intent will not be considered, so we cannot filter intents by sender identity.

Differences between Intent Firewall and Package Manager

Intent Firewall, indeed it is a firewall, it has no impact on component status. The applications detects the component is on, but it just cannot start the component.

For the components disabled by PackageManager, if 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 unexpectly. If you are using Intent Firewall controller, there will be no problems.

References

Intent Firewall

Shizuku Mode (No Root Permission Required)

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

Plan

  1. Support online rules
  2. Comments for componets
  3. Refactor existing code

blocker's People

Contributors

lihenggui avatar coptimer avatar david082321 avatar

Watchers

James Cloos 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.