Android APP Permissions Basics

Source: Internet
Author: User

1 Definition of permissions (permission).
The system itself defines a number of permission, such as

    • "Android.permission.WAKE_LOCK",
    • "Android.permission.ACCESS_WIFI_STATE",
    • "Android.permission.ACCESS_FINE_LOCATION",
    • "Android.permission.ACCESS_FINE_LOCATION"

An app can also define its own permissions, such as
<permission android:name= "Android.permission.ACCESS_DOWNLOAD_MANAGER"
Android:label= "@string/permlab_downloadmanager"
android:description= "@string/permdesc_downloadmanager"
Android:protectionlevel= "Signatureorsystem"/>

Using these permission, the first step needs to be defined in Androidmanifest. For example

<uses-permission android:name= "Android.permission.ACCESS_FINE_LOCATION"/>
Of course, the system does not open any permissions to any app. Otherwise, there is no permission, permission or level.

2   the level defined by Android permissions. The level of permission is a dimension that is used by the permission
to take the Android.permission.ACCESS_DOWNLOAD_MANAGER permission defined above. Its usage level (defined:  android:protectionlevel= "Signatureorsystem") is a system signature or system application that can be used.
         System defined level: normal, dangerous, signature, Signatureorsystem
 & nbsp;       norma L General definition can be used to
           Dangerous will alert the user when it is installed, and the general application will prompt the user to open these permissions if they are turned off by the user. This level of permissions is limited to

    •   group  permissions
    •   calendar: Read_clender, Write_clendar
    •  camera (camera): Camear
    •   CONTACTS (contact person): read_contacts, write_contacts, get_accounts
    •      ; Location: access_fine_location, access_corase_location
    •   Microphone (MIC): Record_audio
    • &    nbsp Phone: read_phone_state, Call_phone, Read_call_log, Write_call_log, Add_voicemail, Use_sip, Process_outgoing_ca LLS
    •                 SMS (SMS): Send_sms, Receive_sms, read_sms, Receive_wap_push,receive_mms
    •   Sensors (sensor): Body_sensors
    • &NB    Sp STORAGE (store)


Signature requires a system signature before it can be used. For example, permissions
<permission android:name= "Android.permission.SEND_DOWNLOAD_COMPLETED_INTENTS"
Android:label= "@string/permlab_downloadcompletedintent"
android:description= "@string/permdesc_downloadcompletedintent"
Android:protectionlevel= "Signature"/>
Of course the APIs that return the relevant permissions will take effect.
Signatureorsystem indicates that a system signature is required, or that it belongs to a system application, (typically built into an app System/app or System/priv-app or System/priv-app) and can use the system's APIs. such as "Android.permission.ACCESS_DOWNLOAD_MANAGER",

3 user dimensions used by Android permissions
When the app is installed, Android assigns a UID (user ID) and GID (user group ID) to each reference program.
In addition, a gids is generated during the installation process. By parsing androidmanifest, you can resolve the permissions (<uses-permission>) that are used by the app when it is run, and if the app is granted permission permissions during the installation, and it has its own GID, Then the GID of these permissions will be added to the GID of this application. From this perspective, the app's Gids will contain a collection of the permissions it uses (provided that it has been given). Further means that the app can use those permissions or resources that are defined in his GUIDs.
Combining the above, an application will have a UID. And there will be a gids. This gids contains system resources that can be used by the runtime.
Android uses a sandbox to isolate each application and is used to separate resources. Each application has a separate sandbox, which prevents sharing between applications. However, if you need to share resources between two applications, you need two prerequisites: 1 is the same signature for both applications. 2 is two applications that define the same android:shareduserid so that two applications will run within the same process, sharing permissions with each other.

4 Others, users in the Linux process running

    • UID (GUID). Real users (groups), the true owner of the process.
    • Euid (GEUID). Valid users (groups), the various permissions required for the process to run, depend on Suid.
    • Suid (GSUID). Save the Settings User (group), which is a copy of the active user. When a superuser modifies a valid user, Mr. Suid becomes a copy of a valid user, namely, the. This will have the primary recovery from the active user.
    • Fuid (Fuid). File Users (groups)

Android APP Permissions Basics

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.