diff --git a/docs/html/guide/topics/manifest/permission-element.jd b/docs/html/guide/topics/manifest/permission-element.jd index 4bb5f6affe9dc..d8dbf4096f839 100644 --- a/docs/html/guide/topics/manifest/permission-element.jd +++ b/docs/html/guide/topics/manifest/permission-element.jd @@ -10,70 +10,80 @@ parent.link=manifest-intro.html android:label="string resource" android:name="string" android:permissionGroup="string" - android:protectionLevel=["normal" | "dangerous" | + android:protectionLevel=["normal" | "dangerous" | "signature" | "signatureOrSystem"] />
<manifest><manifest>-This attribute must be set as a reference to a string resource; +This attribute must be set as a reference to a string resource; unlike the {@code label} attribute, it cannot be a raw string.
-As a convenience, the label can be directly set -as a raw string while you're developing the application. However, -when the application is ready to be published, it should be set as a -reference to a string resource, so that it can be localized like other +As a convenience, the label can be directly set +as a raw string while you're developing the application. However, +when the application is ready to be published, it should be set as a +reference to a string resource, so that it can be localized like other strings in the user interface.
<uses-permission> element and the
+<uses-permission> element and the
{@code permission} attributes of application components.
--The name must be unique, so it should use Java-style scoping — -for example, "{@code com.example.project.PERMITTED_ACTION}". -
+ Note: The system does not allow multiple packages to declare
+ a permission with the same name, unless all the packages are signed with the
+ same certificate. If a package declares a permission, the system does not permit
+ the user to install other packages with the same permission name, unless
+ those packages are signed with the same certificate as the first package. To
+ avoid naming collisions, we recommend using reverse-domain-style naming for custom
+ permissions, for example com.example.myapp.ENGAGE_HYPERSPACE.
+
<permission-group> element in this
+<permission-group> element in this
or another application. If this attribute is not set, the permission
does not belong to a group.| Meaning | ||
|---|---|---|
| "{@code normal}" | -The default value. A lower-risk permission that gives requesting - applications access to isolated application-level features, with - minimal risk to other applications, the system, or the user. + | The default value. A lower-risk permission that gives requesting + applications access to isolated application-level features, with + minimal risk to other applications, the system, or the user. The system automatically grants this type of permission to a requesting application at installation, without asking for the user's explicit approval (though the user always @@ -109,11 +119,11 @@ The value can be set to one of the following strings: asking for the user's explicit approval. |
| "{@code signatureOrSystem}" | -A permission that the system grants only to applications that are + | A permission that the system grants only to applications that are
in the Android system image or that are signed with the same
- certificate as the application that declared the permission. Please avoid using this
- option, as the {@code signature} protection level should be sufficient
- for most needs and works regardless of exactly where applications are
+ certificate as the application that declared the permission. Please avoid using this
+ option, as the {@code signature} protection level should be sufficient
+ for most needs and works regardless of exactly where applications are
installed. The "{@code signatureOrSystem}"
permission is used for certain special situations where multiple
vendors have applications built into a system image and need
diff --git a/docs/html/guide/topics/security/permissions.jd b/docs/html/guide/topics/security/permissions.jd
index ecbe33ab4abbc..c6a12f66db9f0 100644
--- a/docs/html/guide/topics/security/permissions.jd
+++ b/docs/html/guide/topics/security/permissions.jd
@@ -18,6 +18,7 @@ page.tags=permissions
Defining and Enforcing Permissions-To enforce your own permissions, you must first declare them in your
-
+ To enforce your own permissions, you must first declare them in your
+ For example, an application that wants to control who can start one of its activities could declare a permission for this operation as follows: <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.me.app.myapp" >
- <permission android:name="com.me.app.myapp.permission.DEADLY_ACTIVITY"
+ package="com.example.myapp" >
+ <permission android:name="com.example.myapp.permission.DEADLY_ACTIVITY"
android:label="@string/permlab_deadlyActivity"
android:description="@string/permdesc_deadlyActivity"
android:permissionGroup="android.permission-group.COST_MONEY"
@@ -558,50 +561,65 @@ of its activities could declare a permission for this operation as follows:
...
</manifest>
+
+ Note: The system does not allow multiple packages to declare
+ a permission with the same name, unless all the packages are signed with the
+ same certificate. If a package declares a permission, the system does not permit
+ the user to install other packages with the same permission name, unless
+ those packages are signed with the same certificate as the first package. To
+ avoid naming collisions, we recommend using reverse-domain-style naming for custom
+ permissions, for example The {@link android.R.styleable#AndroidManifestPermission_protectionLevel -<protectionLevel>} attribute is required, telling the system how the +protectionLevel} attribute is required, telling the system how the user is to be informed of applications requiring the permission, or who is allowed to hold that permission, as described in the linked documentation. -The {@link android.R.styleable#AndroidManifestPermission_permissionGroup -<permissionGroup>} attribute is optional, and only used to help the system display -permissions to the user. You will usually want to set this to either a standard -system group (listed in {@link android.Manifest.permission_group -android.Manifest.permission_group}) or in more rare cases to one defined by -yourself. It is preferred to use an existing group, as this simplifies the -permission UI shown to the user. +
+ The Note that both a label and description should be supplied for the -permission. These are string resources that can be displayed to the user when + You need to supply both a label and description for the
+permission. These are string resources that the user can see when
they are viewing a list of permissions
( Here is an example of a label and description for the CALL_PHONE permission: - <string name="permlab_callPhone">directly call phone numbers</string> - <string name="permdesc_callPhone">Allows the application to call - phone numbers without your intervention. Malicious applications may - cause unexpected calls on your phone bill. Note that this does not - allow the application to call emergency numbers.</string> +<string name="permlab_callPhone">directly call phone numbers</string> +<string name="permdesc_callPhone">Allows the application to call + phone numbers without your intervention. Malicious applications may + cause unexpected calls on your phone bill. Note that this does not + allow the application to call emergency numbers.</string>- You can look at the permissions currently defined in the system with the + You can view at the permissions currently defined in the system using the
Settings app and the shell command +$ adb shell pm list permissions -s All Permissions: @@ -615,14 +633,53 @@ Services that cost you money: send SMS messages, directly call phone numbers ...+
Enforcing Permissions in AndroidManifest.xml-High-level permissions restricting access to entire components of the
-system or application can be applied through your
- TYou can apply high-level permissions restricting access to entire components
+of the system or application through your
+ {@link android.app.Activity} permissions |