One, Android application permissions mechanism
(1) Installation
PachageManagerService:installPackageLI:parsePackage Parse Androidmanifest.xml file, get application permission;
GRANDPERMISSIONSLP grant the GID to apply the appropriate permissions;
(2) Start
pachagemanagerservice:startprocesslocked start the application, create a new process and pass in the GID, UID;
Forkandspecializecommon creates the Systemserver process and sets the process GID and ID;
II. Application Permissions Control
1) Selective permissions
Fine granularity of permissions, need to modify the Android system
Policy restrictions, another layer of protection outside of the permissions mechanism, restrictions on authorization involving changes to the package Manager
2) Rights Management application
Android permission scanner timed to detect installed apps to compare abnormal applications
Third, whether the detection process has the corresponding custom permissions:
1) Other in-Process: checkcallingpermission (permissions)
2) Specify an application: Checkpermission (permission, app name), checkpermission (permission, Pid,uid)
3) itself live in other processes: Checkcallingorselfpermission (permissions) are dangerous, even if the call fails, the permission information is revealed