Second, Android SUPERSU blocking permission request notification Sureceiver broadcast

Source: Internet
Author: User

We want to customize the Supersu so that it filters out our own apps and does not show permission reminders. We can take a look at this SU call system to send broadcasts. Then our supersu.apk will receive the broadcast of the pop-up window. We can do interception filtering here.



public class Sureceiver extends Broadcastreceiver {@Override public void OnReceive (final context context, Intent in                Tent) {if (intent = = null) return;        String command = Intent.getstringextra ("command");        if (command = = null) return;        int uid = Intent.getintextra ("UID",-1);        if (uid = =-1) return;        int desireduid = Intent.getintextra ("Desired_uid",-1);        if (Desireduid = =-1) return;        String action = Intent.getstringextra ("action");        if (action = = null) return;        String fromname = Intent.getstringextra ("From_name");        String desiredname = Intent.getstringextra ("Desired_name");        Final LogEntry le = new LogEntry ();        Le.uid = UID;        Le.command = command;        Le.action = action;        Le.desireduid = Desireduid;        Le.desiredname = Desiredname;        Le.username = FromName; Le.date = (int) (System.currenttimemillis ()/1000);        Le.getpackageinfo (context);        Here you can intercept the Super log output, filter out applications that do not want to print the log uidpolicy u = superuserdatabasehelper.addlog (context, le);        String Toast; if (UidPolicy.ALLOW.equals (action)) {//Here will pop the window Super app authorization, we can judge here, let him not show toast prompt toast = context.getstring (r.string.s        Uperuser_granted, Le.getname ());  } else {toast = context.getstring (r.string.superuser_denied, Le.getname ());//Deny user's request} if        (U! = null &&!u.notification) return;        Switch (settings.getnotificationtype (context)) {//Whether the popup window is displayed, and so on. Case Settings.NOTIFICATION_TYPE_NOTIFICATION:NotificationCompat.Builder Builder = new Notificationcompat.build            ER (context); Builder.setticker (Toast). Setautocancel (True). Setcontentintent (pendingintent.getactivity (context, 0            , New Intent (), 0). Setcontenttitle (Context.getstring (R.string.superuser)). Setcontenttext (Toast) . Setsmallicon (R.drawable.ic_stat_notification);            Notificationmanager nm = (Notificationmanager) context.getsystemservice (Context.notification_service);            Nm.notify (notification_id, Builder.getnotification ());        Break            Case Settings.NOTIFICATION_TYPE_TOAST:Toast.makeText (context, TOAST, Toast.length_short). Show ();        Break }} private static final int notification_id = 4545;}
Next article,


Next article will show you how to block the authorization acitivty confirmation notice

by su.c

#include "Su.h"


/* Intent Actions */
#define Action_request "Start", "-N", requestor "/" Requestor_prefix ". Requestactivity "
#define ACTION_NOTIFY "Start", "-N", requestor "/" Requestor_prefix ". Notifyactivity "
#define ACTION_RESULT "Broadcast", "-N", requestor "/" Requestor_prefix ". Sureceiver "


#define Am_path "/system/bin/app_process", "/system/bin", "Com.android.commands.am.Am"

This I found, Su is through, shell command to start a permission request Acitivty This is what we see the permission alert interface.



Second, Android SUPERSU blocking permission request notification Sureceiver broadcast

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.