Android Get other app permissions (Modify status)

Source: Internet
Author: User

These two days the boss said to me to study the function of Android security software, first extracted a small module, research rights Management


Go to Packagemanager at the beginning. There are several ways to find out:

First go to see the Ipackagemanager inside the method:

There's a lot of me here that lists the permissions.

Permissioninfo Getpermissioninfo (String name,intflags); List<PermissionInfo> Querypermissionsbygroup (String Group,intflags); Permissiongroupinfo Getpermissiongroupinfo (String name,intflags); List<PermissionGroupInfo> Getallpermissiongroups (intflags); intcheckpermission (String permname, string pkgname); intCheckuidpermission (String Permname,intuid); Booleanaddpermission (in Permissioninfo info); voidremovepermission (String name); voidgrantpermission (String packagename, string permissionname); voidrevokepermission (String packagename, string permissionname);            String[] Getappoppermissionpackages (String permissionname); Parceledlistslice getpackagesholdingpermissions (in string[] permissions,intFlagsintuserId); BooleanAddpermissionasync (in Permissioninfo info); voidsetpermissionenforced (String permission,Booleanenforced);

Look at the features on the security software:

Find permissions by package name

Find the package name through permissions

Disable prompt allows three states

First of all: There are 2 methods found:

void removepermission (String name);   void
I was happy to start writing the code. Test Result:  java.lang.SecurityException:Can' t change Android.permission.INTERNET. It's required by the application  has been reporting this mistake    

I went online to check some of the information: see this kind of appopsmanager I understand I found the corresponding server code iappopsservice:

    InterfaceIappopsservice {//These first methods is also called by native code, so must//Be kept on sync with frameworks/native/include/binder/iappopsservice.h        intCheckoperation (intCodeintuid, String packagename); intNoteoperation (intCodeintuid, String packagename); intStartoperation (IBinder token,intCodeintuid, String packagename); voidFinishoperation (IBinder token,intCodeintuid, String packagename); voidStartwatchingmode (intop, String packagename, Iappopscallback callback); voidStopwatchingmode (Iappopscallback callback);                IBinder GetToken (IBinder clienttoken); //Remaining methods is only used in Java.         intCheckpackage (intuid, String packagename); List<appopsmanager.packageops> Getpackagesforops (inint[] OPS); List<appopsmanager.packageops> Getopsforpackage (intUID, String PackageName, inint[] ops); voidSetMode (intCodeintUID, String PackageName,intmode);voidResetallmodes (intRequserid, String reqpackagename); intCheckaudiooperation (intCodeintUsageintuid, String packagename); voidSetaudiorestriction (intCodeintUsageintUidintmode, in string[] exceptionpackages); voidSetuserrestrictions (in Bundle restrictions,intuserhandle); voidRemoveuser (intuserhandle); }

It uses mode to set the state,

Permissions can be obtained by package name

You can also get the package name through permissions


More importantly, the return permissions are not all returned to you according to the level system.

You can get a rating based on permissions, and it's all clear.

Android Get other app permissions (Modify status)

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.