/Brevent-fork

Primary LanguageJavaDo What The F*ck You Want To Public LicenseWTFPL

English

Why Brevent

"Brevent" hajacks several system API to prevent not-in-use apps in prevent list from running or keep running. Furthermore, it applies to system apps too, specially, support google-family apps(GAPPS).

Not-in-use packages in prevent list can only run:

  • some other app call it's activity (share, launcher)
  • widget on home, however, it can only run 30 seconds
  • sync service if you allow, it can only run 30 seconds too
  • system services (excluding normal gapps), or alipay's service

NOTE: When Google Play Services(GMS) and related apps are in prevent list, only GAPPS and GCM-apps can use it. However, you cannot receive GCM message if GMS is not running.

WARNING: Don't prevent system apps nor daily apps, otherwise, you may miss important message.

WARNING: Don't prevent "Xposed Installer", otherwise the module won't active when you update it.

"Brevent" should work from Android 4.4 to 6.0. However, I mainly use 7.1.

How to use

  1. Patch your ROM with "Brevent".
  2. Open "Brevent", then add/remove application to/from prevent list.
  3. Use android normally, press back or remove it from recent task to exit, and press HOME for pause.

And "Brevent" would keep non-"service" processes, of cource it cannot turn to "service".

Special Search

  • -3 for third party apps
  • -a for all apps (default show third party apps and gapps)
  • -s for system apps
  • -e for enabled apps
  • -r for running apps
  • -g for gapps, i.e. apps from google
  • -sg for system apps excluding gapps

background

This process contains background code that is expendable.

empty

This process is empty of any actively running code.

foreground

This process is running the foreground UI; that is, it is the thing currently at the top of the screen that the user is interacting with.

foreground service (since Android 6.0)

This process is running a foreground service, for example to perform music playback even while the user is not immediately in the app. This generally indicates that the process is doing something the user actively cares about.

gone (since Android 5.0)

This process does not exist.

perceptible

This process is not something the user is directly aware of, but is otherwise perceptable to them to some degree.

service

This process is contains services that should remain running. These are background services apps have started, not something the user is aware of, so they may be killed by the system relatively freely (though it is generally desired that they stay running as long as they want to).

top sleeping (since Android 6.0)

This process is running the foreground UI, but the device is asleep so it is not visible to the user. This means the user is not really aware of the process, because they can not see or interact with it, but it is quite important because it what they expect to return to once unlocking the device.

visible

This process is running something that is actively visible to the user, though not in the immediate foreground. This may be running a window that is behind the current foreground (so paused and with its state saved, not interacting with the user, but visible to them to some degree); it may also be running other services under the system's control that it inconsiders important.

Project

Project: Brevent - GitHub. If you like, feel free to donate.

中文

黑域介绍

黑域”通过劫持几个系统API,保证阻止列表里的应用只在需要时才启动,同时支持谷歌家族应用。

没有运行的阻止列表应用只会在以下几种情况下启动:

  • 启动器或者第三方应用启动活动(Activity),如手动打开、分享、部分支付等;
  • 桌面小部件定时更新,但是只能运行30秒;
  • 同步开启时的定时同步,也只能运行30秒;
  • 谷歌服务外的系统服务,或者支付宝的支付服务;
  • 其它可能的用户行为引起的启动。

注意:当谷歌服务在阻止列表时,只有谷歌家族应用和第三方的GCM应用可以使用。同时,当有任何一个谷歌家族应用没有退出时,都不会退出谷歌服务。当然,只有GMS运行时才能接收GCM消息,并唤醒相应应用。

警告:请谨慎阻止“系统应用”,以及常用应用。要不然,你可能无法及时收到短信或其它重要消息。“黑域”不会显示和系统同一签名的系统应用,也不会显示系统内置的启动器。

警告:请不要阻止“Xposed Installer”,否则模块更新时,无法更新模块路径,导致重启以后无法加载模块。

提示:有些用户无法或不愿分清HOME返回键区别,可以开启“强行停止后台程序”,在离开程序一段时间后并黑屏时退出应用。这项功能默认关闭。

黑域”支持Android 4.4到7.1,本人主要在7.1上测试。

使用说明

  1. 给手机安装黑域补丁。
  2. 打开“黑域”,配置阻止列表(这个只需要一次)。
  3. 正常使用手机,临时退出时按HOME,不用时按返回键退出或者从最近列表划掉。

同时,“黑域”不杀非服务的程序,但是保证非服务类进程不会变成服务在后台一直运行。

特别搜索

  • -3 用户安装的第方程序
  • -a 全部程序(默认仅展示第三方和谷歌家族的程序)
  • -s 系统预装的程序
  • -e 没有阻止的程序
  • -r 正在运行的程序
  • -g 歌家族的程序
  • -sg 除谷歌家族外的系统程序

后台(background)

可被回收的后台进程。(译者注:或译缓存的后台进程,不需要主动清理。)

空(empty)

进程不包含任何正在运行的代码。

前台(foreground)

进程正在前台运行,也是你正在使用的应用。(译者注:当你在“黑域”中查看进程状态时,“黑域”永远是前台。)

前台服务(foreground service, 自Android 6.0)

进程包含前台服务,比如播放音乐等,通常表明正在处理一些用户关心的事情。

无(gone, 自Android 5.0)

进程不存在。

察觉(perceptible)

虽然用户不能直接注意到,但是某种层次上可以感觉到(译者注:如输入法)。

服务(service)

包含需要持续运行的服务。这些是已经启动的后台服务,用户并不能注意到,它们也有可能被系统回收(虽然从设计上会被一直运行下去)。

前台休眠(top sleeping,自Android 6.0)

进程在前台运行,但是设备正在休眠,所以用户看不见。这意味着用户并不能真正注意到它,因为看不见也无法操作,但是当设备解锁时期望立即看到,所以也非常重要。

可见(visible)

进程对用户可见,虽然不一定是最近的前台。它可能运行在当前前台后的窗口,虽然已经暂停并且保存状态,也无法使用,但是某种层次上用户能见到;也可能是系统控制下的其它重要服务。

项目

黑域代码暂时不开源,项目地址:Brevent - GitHub。如果喜欢,请随意捐赠。