- 
                Notifications
    
You must be signed in to change notification settings  - Fork 205
 
Exec Command via Brevent (Since 2.6.6)
        Liu DongMiao edited this page Feb 11, 2018 
        ·
        2 revisions
      
    Brevent contains two parts, Brevent manager, and the always working Brevent server, runs as shell, driven by event log and Brevent manager. Brefore 2.6.1, only Brevent manager has permission to access Brevent server.
Since 2.6.6, Brevent offers command to other apps. It's very simple to use it:
final String action = "me.piebridge.brevent.intent.action.COMMAND";
final String extra = "me.piebridge.brevent.intent.extra.COMMAND";
final String command = ""; // command
Intent intent = new Intent(action);
intent.putExtra(extra, command);
List<ResolveInfo> ris = getPackageManager().queryIntentActivities(intent, 0);
if (ris != null && !ris.isEmpty()) {
    startActivity(intent);
}Brevent server runs as following:
sh
${command}
exitIt's like supersu, however, there are some restrictions:
- 
(Support since 2.6.8 beta)&is not allowed in command&will run command in background and never return, and there is no output. - 
direct
shorsuis not allowed - 
${command}will be replaced asidif Brevent server runs as Root - 
Brevent server will kill
${command}if Brevent manager goes into background