Home | History | Annotate | Download | only in manifest
      1 page.title=<permission>
      2 parent.title=The AndroidManifest.xml File
      3 parent.link=manifest-intro.html
      4 @jd:body
      5 
      6 <dl class="xml">
      7 <dt>syntax:</dt></dt>
      8 <dd><pre class="stx">&lt;permission android:<a href="#desc">description</a>="<i>string resource</i>"
      9             android:<a href="#icon">icon</a>="<i>drawable resource</i>"
     10             android:<a href="#label">label</a>="<i>string resource</i>"
     11             android:<a href="#nm">name</a>="<i>string</i>"
     12             android:<a href="#pgroup">permissionGroup</a>="<i>string</i>"
     13             android:<a href="#plevel">protectionLevel</a>=["normal" | "dangerous" |
     14                                      "signature" | "signatureOrSystem"] /&gt;</pre></dd>
     15 
     16 <dt>contained in:</dt>
     17 <dd><code><a href="{@docRoot}guide/topics/manifest/manifest-element.html"
     18   >&lt;manifest&gt;</a></code></dd>
     19 
     20 <dt>description:</dt>
     21 <dd itemprop="description">Declares a security permission that can be used to
     22 limit access to specific components or features of this or other applications.
     23 See the <a href="{@docRoot}guide/topics/manifest/manifest-intro.html#perms"
     24 >Permissions</a> section in the introduction, and the <a
     25 href="{@docRoot}guide/topics/security/security.html">Security and
     26 Permissions</a> document for more information on how permissions work.</dd>
     27 
     28 <dt>attributes:</dt>
     29 <dd><dl class="attr">
     30 <dt><a name="desc"></a>{@code android:description}</dt>
     31 <dd>A user-readable description of the permission, longer and more
     32 informative than the label.  It may be displayed to explain the
     33 permission to the user &mdash; for example, when the user is asked
     34 whether to grant the permission to another application.
     35 
     36 <p>
     37 This attribute must be set as a reference to a string resource;
     38 unlike the {@code label} attribute, it cannot be a raw string.
     39 </p></dd>
     40 
     41 <dt><a name="icon"></a>{@code android:icon}</dt>
     42 <dd>A reference to a drawable resource for an icon that represents the
     43 permission.</dd>
     44 
     45 <dt><a name="label"></a>{@code android:label}</dt>
     46 <dd>A name for the permission, one that can be displayed to users.
     47 
     48 <p>
     49 As a convenience, the label can be directly set
     50 as a raw string while you're developing the application.  However,
     51 when the application is ready to be published, it should be set as a
     52 reference to a string resource, so that it can be localized like other
     53 strings in the user interface.
     54 </p></dd>
     55 
     56 <dt><a name="nm"></a>{@code android:name}</dt>
     57 <dd>The name of the permission.  This is the name that will be used in
     58 code to refer to the permission &mdash; for example, in a
     59 <code><a href="{@docRoot}guide/topics/manifest/uses-permission-element.html"
     60   >&lt;uses-permission&gt;</a></code> element and the
     61 {@code permission} attributes of application components.
     62 
     63 
     64 <p class="note">
     65   <strong>Note:</strong> The system does not allow multiple packages to declare
     66   a permission with the same name, unless all the packages are signed with the
     67   same certificate. If a package declares a permission, the system does not permit
     68   the user to install other packages with the same permission name, unless
     69   those packages are signed with the same certificate as the first package. To
     70   avoid naming collisions, we recommend using reverse-domain-style naming for custom
     71   permissions, for example <code>com.example.myapp.ENGAGE_HYPERSPACE</code>.
     72 </p>
     73 </dd>
     74 
     75 <dt><a name="pgroup"></a>{@code android:permissionGroup}</dt>
     76 <dd>Assigns this permission to a group.  The value of this attribute is
     77 the name of the group, which must be declared with the
     78 <code><a href="{@docRoot}guide/topics/manifest/permission-group-element.html"
     79   >&lt;permission-group&gt;</a></code> element in this
     80 or another application.  If this attribute is not set, the permission
     81 does not belong to a group.</dd>
     82 
     83 <dt><a name="plevel"></a>{@code android:protectionLevel}</dt>
     84 <dd>Characterizes the potential risk implied in the permission and
     85 indicates the procedure the system should follow when determining
     86 whether or not to grant the permission to an application requesting it.
     87 The value can be set to one of the following strings:
     88 
     89 <table>
     90 <tr>
     91    <th>Value</th>
     92    <th>Meaning</th>
     93 </tr><tr>
     94    <td>"{@code normal}"</td>
     95    <td>The default value.  A lower-risk permission that gives requesting
     96        applications access to isolated application-level features, with
     97        minimal risk to other applications, the system, or the user.
     98        The system automatically grants this type
     99        of permission to a requesting application at installation, without
    100        asking for the user's explicit approval (though the user always
    101        has the option to review these permissions before installing).
    102 </tr><tr>
    103    <td>"{@code dangerous}"</td>
    104    <td>A higher-risk permission that would give a requesting application
    105        access to private user data or control over the device that can
    106        negatively impact the user.  Because this type of permission
    107        introduces potential risk, the system may not automatically
    108        grant it to the requesting application.  For example, any dangerous
    109        permissions requested by an application may be displayed to the
    110        user and require confirmation before proceeding, or some other
    111        approach may be taken to avoid the user automatically allowing
    112        the use of such facilities.
    113 </tr><tr>
    114    <td>"{@code signature}"</td>
    115    <td>A permission that the system grants only if the requesting
    116        application is signed with the same certificate as the application
    117        that declared the permission. If the certificates match, the system
    118        automatically grants the permission without notifying the user or
    119        asking for the user's explicit approval.
    120 </tr><tr>
    121    <td>"{@code signatureOrSystem}"</td>
    122    <td>A permission that the system grants only to applications that are
    123        in the Android system image <em>or</em> that are signed with the same
    124        certificate as the application that declared the permission. Please avoid using this
    125        option, as the {@code signature} protection level should be sufficient
    126        for most needs and works regardless of exactly where applications are
    127        installed.  The "{@code signatureOrSystem}"
    128        permission is used for certain special situations where multiple
    129        vendors have applications built into a system image and need
    130        to share specific features explicitly because they are being built
    131        together.
    132 </tr>
    133 </table>
    134 </dd>
    135 </dl></dd>
    136 
    137 <!-- ##api level indication## -->
    138 <dt>introduced in:</dt>
    139 <dd>API Level 1</dd>
    140 
    141 <dt>see also:</dt>
    142 <dd><code><a href="{@docRoot}guide/topics/manifest/uses-permission-element.html">&lt;uses-permission&gt;</a></code>
    143 <br/><code><a href="{@docRoot}guide/topics/manifest/permission-tree-element.html">&lt;permission-tree&gt;</a></code>
    144 <br/><code><a href="{@docRoot}guide/topics/manifest/permission-group-element.html">&lt;permission-group&gt;</a></code></dd>
    145 </dd>
    146 
    147 </dl>
    148