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

Commit 60fcce6c authored by Christopher Tate's avatar Christopher Tate Committed by Android (Google) Code Review
Browse files

Merge "Introduce maxSdkVersion for <uses-permission>" into klp-dev

parents 3fb53d82 fb0676a9
Loading
Loading
Loading
Loading
+21 −10
Original line number Diff line number Diff line
@@ -1441,8 +1441,18 @@ public class PackageParser {
*/
        boolean required = true; // Optional <uses-permission> not supported

        int maxSdkVersion = 0;
        TypedValue val = sa.peekValue(
                com.android.internal.R.styleable.AndroidManifestUsesPermission_maxSdkVersion);
        if (val != null) {
            if (val.type >= TypedValue.TYPE_FIRST_INT && val.type <= TypedValue.TYPE_LAST_INT) {
                maxSdkVersion = val.data;
            }
        }

        sa.recycle();

        if ((maxSdkVersion == 0) || (maxSdkVersion >= Build.VERSION.RESOURCES_SDK_INT)) {
            if (name != null) {
                int index = pkg.requestedPermissions.indexOf(name);
                if (index == -1) {
@@ -1456,6 +1466,7 @@ public class PackageParser {
                    }
                }
            }
        }

        XmlUtils.skipCurrentTag(parser);
        return true;
+6 −1
Original line number Diff line number Diff line
@@ -1048,6 +1048,11 @@
        tag; often this is one of the {@link android.Manifest.permission standard
        system permissions}. -->
        <attr name="name" />
        <!-- Optional: specify the maximum version of the Android OS for which the
             application wishes to request the permission.  When running on a version
             of Android higher than the number given here, the permission will not
             be requested.  -->
        <attr name="maxSdkVersion" format="integer" />
        <!--  Specify whether this permission is required for the application.
              The default is true, meaning the application requires the
              permission, and it must always be granted when it is installed.
@@ -1129,7 +1134,7 @@
             on.  You can use this to ensure your application is filtered out
             of later versions of the platform when you know you have
             incompatibility with them. -->
        <attr name="maxSdkVersion" format="integer" />
        <attr name="maxSdkVersion" />
    </declare-styleable>
    
    <!-- The <code>library</code> tag declares that this apk is providing itself