summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorDavid Brazdil <dbrazdil@google.com>2018-08-30 12:52:52 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-08-30 12:52:52 +0000
commit03b72ae608b491c05514d3eccc2755a303bfebfd (patch)
tree46718e4ae3b03509d060db9797e005a439e48846 /core/java/android
parentce32924cdc884467e9cf0eabddb2e5aebea7a90e (diff)
parent787b6f22a63e5c90e6bde69da64af2fbea68a50d (diff)
Merge "Add android:usesNonSdkApi manifest attribute"
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/content/pm/ApplicationInfo.java16
-rw-r--r--core/java/android/content/pm/PackageParser.java3
2 files changed, 17 insertions, 2 deletions
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java
index b7a53520f060..1108f938ed4f 100644
--- a/core/java/android/content/pm/ApplicationInfo.java
+++ b/core/java/android/content/pm/ApplicationInfo.java
@@ -1009,6 +1009,13 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
public String appComponentFactory;
/**
+ * Indicates whether this package requires access to non-SDK APIs. Only system apps
+ * and tests are allowed to use this property.
+ * @hide
+ */
+ public boolean usesNonSdkApi;
+
+ /**
* The category of this app. Categories are used to cluster multiple apps
* together into meaningful groups, such as when summarizing battery,
* network, or disk usage. Apps should only define this value when they fit
@@ -1712,8 +1719,13 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
}
private boolean isAllowedToUseHiddenApis() {
- return isSignedWithPlatformKey()
- || (isPackageWhitelistedForHiddenApis() && (isSystemApp() || isUpdatedSystemApp()));
+ if (isSignedWithPlatformKey()) {
+ return true;
+ } else if (isSystemApp() || isUpdatedSystemApp()) {
+ return usesNonSdkApi || isPackageWhitelistedForHiddenApis();
+ } else {
+ return false;
+ }
}
/**
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 83757c4b523d..8b058dccbb6e 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -3659,6 +3659,9 @@ public class PackageParser {
ai.appComponentFactory = buildClassName(ai.packageName, factory, outError);
}
+ ai.usesNonSdkApi = sa.getBoolean(
+ com.android.internal.R.styleable.AndroidManifestApplication_usesNonSdkApi, false);
+
if (outError[0] == null) {
CharSequence pname;
if (owner.applicationInfo.targetSdkVersion >= Build.VERSION_CODES.FROYO) {