Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 51fbad5a authored by Peter Visontay's avatar Peter Visontay
Browse files

Fix outdated docs of permission protection levels.

1) Added deprecation notice to the 'system' and 'signatureOrSystem' protection levels.
These were deprecated in API Level 23:
https://developer.android.com/reference/android/content/pm/PermissionInfo.html#PROTECTION_SIGNATURE_OR_SYSTEM
https://developer.android.com/reference/android/content/pm/PermissionInfo.html#PROTECTION_FLAG_SYSTEM

2) Removed an outdated list of protection levels from PermissionInfo.protectionLevel's JavaDoc.
Its Javadoc has a link to an up-to-date list.

Test: Ran "make docs".
Change-Id: Ia6dc88ba3a66f248f60f010323d5ba40200c1cda
parent 5f52b4df
Loading
Loading
Loading
Loading
+12 −6
Original line number Original line Diff line number Diff line
@@ -155,12 +155,18 @@ public class PermissionInfo extends PackageItemInfo implements Parcelable {


    /**
    /**
     * The level of access this permission is protecting, as per
     * The level of access this permission is protecting, as per
     * {@link android.R.attr#protectionLevel}.  Values may be
     * {@link android.R.attr#protectionLevel}. Consists of
     * {@link #PROTECTION_NORMAL}, {@link #PROTECTION_DANGEROUS}, or
     * a base permission type and zero or more flags:
     * {@link #PROTECTION_SIGNATURE}.  May also include the additional
     *
     * flags {@link #PROTECTION_FLAG_SYSTEM} or {@link #PROTECTION_FLAG_DEVELOPMENT}
     * <pre>
     * (which only make sense in combination with the base
     * int basePermissionType = protectionLevel & {@link #PROTECTION_MASK_BASE};
     * {@link #PROTECTION_SIGNATURE}.
     * int permissionFlags = protectionLevel & {@link #PROTECTION_MASK_FLAGS};
     * </pre>
     *
     * <p></p>Base permission types are {@link #PROTECTION_NORMAL},
     * {@link #PROTECTION_DANGEROUS}, {@link #PROTECTION_SIGNATURE}
     * and the deprecated {@link #PROTECTION_SIGNATURE_OR_SYSTEM}.
     * Flags are listed under {@link android.R.attr#protectionLevel}.
     */
     */
    public int protectionLevel;
    public int protectionLevel;


+31 −23
Original line number Original line Diff line number Diff line
@@ -171,34 +171,42 @@
         permanent protectionLevel. If you are creating a custom permission in an
         permanent protectionLevel. If you are creating a custom permission in an
         application, you can define a protectionLevel attribute with one of the
         application, you can define a protectionLevel attribute with one of the
         values listed below. If no protectionLevel is defined for a custom
         values listed below. If no protectionLevel is defined for a custom
         permission, the system assigns the default ("normal"). -->
         permission, the system assigns the default ("normal").
         <p>Each protection level consists of a base permission type and zero or
         more flags:
         <pre>
         int basePermissionType = protectionLevel & {@link android.content.pm.PermissionInfo#PROTECTION_MASK_BASE};
         int permissionFlags = protectionLevel & {@link android.content.pm.PermissionInfo#PROTECTION_MASK_FLAGS};
         </pre>
         -->
    <attr name="protectionLevel">
    <attr name="protectionLevel">
        <!-- A lower-risk permission that gives an application access to isolated
        <!-- <strong>Base permission type</strong>: a lower-risk permission that gives
             application-level features, with minimal risk to other applications,
             an application access to isolated application-level features, with minimal
             the system, or the user. The system automatically grants this type
             risk to other applications, the system, or the user. The system
             of permission to a requesting application at installation, without
             automatically grants this type of permission to a requesting application at
             asking for the user's explicit approval (though the user always
             installation, without asking for the user's explicit approval (though the
             has the option to review these permissions before installing). -->
             user always has the option to review these permissions before installing). -->
        <flag name="normal" value="0" />
        <flag name="normal" value="0" />
        <!-- A higher-risk permission that would give a requesting application
        <!-- <strong>Base permission type</strong>: a higher-risk permission that
             access to private user data or control over the device that can
             would give a requesting application access to private user data or
             negatively impact the user.  Because this type of permission
             control over the device that can negatively impact the user.  Because
             introduces potential risk, the system may not automatically
             this type of permission introduces potential risk, the system may
             grant it to the requesting application.  For example, any dangerous
             not automatically grant it to the requesting application.  For example,
             permissions requested by an application may be displayed to the
             any dangerous permissions requested by an application may be displayed
             user and require confirmation before proceeding, or some other
             to the user and require confirmation before proceeding, or some other
             approach may be taken to avoid the user automatically allowing
             approach may be taken to avoid the user automatically allowing
             the use of such facilities.  -->
             the use of such facilities.  -->
        <flag name="dangerous" value="1" />
        <flag name="dangerous" value="1" />
        <!-- A permission that the system is to grant only if the requesting
        <!-- <strong>Base permission type</strong>: a permission that the system is
             application is signed with the same certificate as the application
             to grant only if the requesting application is signed with the same
             that declared the permission. If the certificates match, the system
             certificate as the application that declared the permission. If the
             automatically grants the permission without notifying the user or
             certificates match, the system automatically grants the permission
             asking for the user's explicit approval. -->
             without notifying the user or asking for the user's explicit approval. -->
        <flag name="signature" value="2" />
        <flag name="signature" value="2" />
        <!-- A permission that the system is to grant only to packages in the
        <!-- Old synonym for "signature|privileged". Deprecated in API level 23.
             Android system image <em>or</em> that are signed with the same
             Base permission type: a permission that the system is to grant only
             certificates. Please avoid using this option, as the
             to packages in the Android system image <em>or</em> that are signed
             with the same certificates. Please avoid using this option, as the
             signature protection level should be sufficient for most needs and
             signature protection level should be sufficient for most needs and
             works regardless of exactly where applications are installed.  This
             works regardless of exactly where applications are installed.  This
             permission is used for certain special situations where multiple
             permission is used for certain special situations where multiple
@@ -216,7 +224,7 @@
             to share specific features explicitly because they are being built
             to share specific features explicitly because they are being built
             together. -->
             together. -->
        <flag name="privileged" value="0x10" />
        <flag name="privileged" value="0x10" />
        <!-- Old synonym for "privileged". -->
        <!-- Old synonym for "privileged". Deprecated in API level 23. -->
        <flag name="system" value="0x10" />
        <flag name="system" value="0x10" />
        <!-- Additional flag from base permission type: this permission can also
        <!-- Additional flag from base permission type: this permission can also
             (optionally) be granted to development applications. -->
             (optionally) be granted to development applications. -->