Merge "Apps can request permissions only on platforms that have runtime permissions."

This commit is contained in:
Svetoslav
2015-04-08 19:27:56 +00:00
committed by Android (Google) Code Review
2 changed files with 16 additions and 15 deletions

View File

@@ -1487,7 +1487,11 @@ public class PackageParser {
return null;
}
} else if (tagName.equals("uses-permission")) {
if (!parseUsesPermission(pkg, res, parser, attrs, outError)) {
if (!parseUsesPermission(pkg, res, parser, attrs)) {
return null;
}
} else if (tagName.equals("uses-permission-sdk-m")) {
if (!parseUsesPermission(pkg, res, parser, attrs)) {
return null;
}
} else if (tagName.equals("uses-configuration")) {
@@ -1887,8 +1891,7 @@ public class PackageParser {
}
private boolean parseUsesPermission(Package pkg, Resources res, XmlResourceParser parser,
AttributeSet attrs, String[] outError)
throws XmlPullParserException, IOException {
AttributeSet attrs) throws XmlPullParserException, IOException {
TypedArray sa = res.obtainAttributes(attrs,
com.android.internal.R.styleable.AndroidManifestUsesPermission);
@@ -1914,8 +1917,9 @@ public class PackageParser {
if (index == -1) {
pkg.requestedPermissions.add(name.intern());
} else {
Slog.w(TAG, "Ignoring duplicate uses-permission: " + name + " in package: "
+ pkg.packageName + " at: " + parser.getPositionDescription());
Slog.w(TAG, "Ignoring duplicate uses-permissions/uses-permissions-sdk-m: "
+ name + " in package: " + pkg.packageName + " at: "
+ parser.getPositionDescription());
}
}
}

View File

@@ -1269,8 +1269,13 @@
<!-- The <code>uses-permission</code> tag requests a
{@link #AndroidManifestPermission &lt;permission&gt;} that the containing
package must be granted in order for it to operate correctly.
See the <a href="{@docRoot}guide/topics/security/security.html">Security and Permissions</a>
package must be granted in order for it to operate correctly. For runtime
permissions, i.e. ones with <code>dangerous</code> protection level, on a
platform that supports runtime permissions, the permission will not be
granted until the app explicitly requests it at runtime and the user approves
the grant. You cannot request at runtime permissions that are not declared
as used in the manifest. See the
<a href="{@docRoot}guide/topics/security/security.html">Security and Permissions</a>
document for more information on permissions. Also available is a
{@link android.Manifest.permission list of permissions} included
with the base platform.
@@ -1289,14 +1294,6 @@
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.
If you set this to false, then in some cases the application may
be installed with it being granted the permission, and it will
need to request the permission later if it needs it.
<attr name="required" format="boolean" />
-->
</declare-styleable>
<!-- The <code>uses-configuration</code> tag specifies