summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nicolas Prevot <nprevot@google.com> 2014-02-25 10:35:25 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2014-02-25 10:35:25 +0000
commit1f63810638a54ebfe963a20deb7698236e9855ab (patch)
treefd6523b989d21a0630f22f8422ef3f605fb07b8d
parent6dd4e28b60307d41c626f3c28046f354fa3328a3 (diff)
parent531270a4a177a9f245d328d9467c6d1adbd5354a (diff)
Merge "Adding the requiredForProfile flag."
-rw-r--r--api/current.txt1
-rw-r--r--core/java/android/content/pm/PackageInfo.java21
-rw-r--r--core/java/android/content/pm/PackageParser.java6
-rw-r--r--core/res/res/values/attrs_manifest.xml12
-rw-r--r--core/res/res/values/public.xml1
5 files changed, 41 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt
index eb39a16a0b56..d2e52c9b464c 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -890,6 +890,7 @@ package android {
field public static final int required = 16843406; // 0x101028e
field public static final int requiredAccountType = 16843734; // 0x10103d6
field public static final int requiredForAllUsers = 16843728; // 0x10103d0
+ field public static final int requiredForProfile = 16843778; // 0x1010402
field public static final int requiresFadingEdge = 16843685; // 0x10103a5
field public static final int requiresSmallestWidthDp = 16843620; // 0x1010364
field public static final int resizeMode = 16843619; // 0x1010363
diff --git a/core/java/android/content/pm/PackageInfo.java b/core/java/android/content/pm/PackageInfo.java
index 785f2b42bc68..ef0c4d521fa9 100644
--- a/core/java/android/content/pm/PackageInfo.java
+++ b/core/java/android/content/pm/PackageInfo.java
@@ -209,6 +209,19 @@ public class PackageInfo implements Parcelable {
*/
public static final int INSTALL_LOCATION_PREFER_EXTERNAL = 2;
/**
+ * Flag for {@link #requiredForProfile}
+ * The application will always be installed for a restricted profile.
+ * @hide
+ */
+ public static final int RESTRICTED_PROFILE = 1;
+ /**
+ * Flag for {@link #requiredForProfile}
+ * The application will always be installed for a managed profile.
+ * @hide
+ */
+ public static final int MANAGED_PROFILE = 2;
+
+ /**
* The install location requested by the activity. From the
* {@link android.R.attr#installLocation} attribute, one of
* {@link #INSTALL_LOCATION_AUTO},
@@ -218,6 +231,12 @@ public class PackageInfo implements Parcelable {
*/
public int installLocation = INSTALL_LOCATION_INTERNAL_ONLY;
+ /**
+ * Defines which profiles this app is required for.
+ * @hide
+ */
+ public int requiredForProfile;
+
/** @hide */
public boolean requiredForAllUsers;
@@ -276,6 +295,7 @@ public class PackageInfo implements Parcelable {
dest.writeTypedArray(reqFeatures, parcelableFlags);
dest.writeInt(installLocation);
dest.writeInt(requiredForAllUsers ? 1 : 0);
+ dest.writeInt(requiredForProfile);
dest.writeString(restrictedAccountType);
dest.writeString(requiredAccountType);
dest.writeString(overlayTarget);
@@ -318,6 +338,7 @@ public class PackageInfo implements Parcelable {
reqFeatures = source.createTypedArray(FeatureInfo.CREATOR);
installLocation = source.readInt();
requiredForAllUsers = source.readInt() != 0;
+ requiredForProfile = source.readInt();
restrictedAccountType = source.readString();
requiredAccountType = source.readString();
overlayTarget = source.readString();
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index 7fa941784db3..c222003cb578 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -304,6 +304,7 @@ public class PackageParser {
if ((pi.applicationInfo.flags&ApplicationInfo.FLAG_SYSTEM) != 0
|| (pi.applicationInfo.flags&ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) {
pi.requiredForAllUsers = p.mRequiredForAllUsers;
+ pi.requiredForProfile = p.mRequiredForProfile;
}
pi.restrictedAccountType = p.mRestrictedAccountType;
pi.requiredAccountType = p.mRequiredAccountType;
@@ -1978,6 +1979,8 @@ public class PackageParser {
false)) {
owner.mRequiredForAllUsers = true;
}
+ owner.mRequiredForProfile = sa.getInt(
+ com.android.internal.R.styleable.AndroidManifestApplication_requiredForProfile, 0);
String restrictedAccountType = sa.getString(com.android.internal.R.styleable
.AndroidManifestApplication_restrictedAccountType);
@@ -3565,6 +3568,9 @@ public class PackageParser {
/* An app that's required for all users and cannot be uninstalled for a user */
public boolean mRequiredForAllUsers;
+ /* For which types of profile this app is required */
+ public int mRequiredForProfile;
+
/* The restricted account authenticator type that is used by this application */
public String mRestrictedAccountType;
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 4647413f9f35..2efbca2a731a 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -259,6 +259,17 @@
applications can request this feature. Default value is false. -->
<attr name="requiredForAllUsers" format="boolean" />
+ <!-- Flag to specifiy for which types of profile this application needs to be present.
+ Only pre-installed applications can request this feature. Default is none. -->
+ <attr name="requiredForProfile">
+ <!-- This application needs to be present for restricted profiles -->
+ <flag name="restricted" value="0x0001" />
+ <!-- This application needs to be present for managed profiles -->
+ <flag name="managed" value="0x0002" />
+ <!-- This application needs to be present for all types of profiles -->
+ <flag name="all" value="0xFFFF" />
+ </attr>
+
<!-- Flag indicating whether the application can be debugged, even when
running on a device that is running in user mode. -->
<attr name="debuggable" format="boolean" />
@@ -901,6 +912,7 @@
<attr name="hasCode" format="boolean" />
<attr name="persistent" />
<attr name="requiredForAllUsers" />
+ <attr name="requiredForProfile" />
<!-- Specify whether the components in this application are enabled or not (that is, can be
instantiated by the system).
If "false", it overrides any component specific values (a value of "true" will not
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 44ad5eedfebc..c814d25d8e49 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -2108,6 +2108,7 @@
<public type="attr" name="sharedElementName" />
<public type="attr" name="transitionGroup" />
<public type="attr" name="castsShadow" />
+ <public type="attr" name="requiredForProfile"/>
<public type="id" name="shared_element_name" />