diff options
author | Nicolas Prevot <nprevot@google.com> | 2014-02-14 12:16:13 +0000 |
---|---|---|
committer | Nicolas Prevot <nprevot@google.com> | 2014-02-24 18:03:14 +0000 |
commit | 531270a4a177a9f245d328d9467c6d1adbd5354a (patch) | |
tree | e02ca484429660cb5ca63bfcb368cc2a9103a723 /core/java | |
parent | 4531e9c45cc42c21f6033e52824453b18146a2c0 (diff) | |
download | frameworks_base-531270a4a177a9f245d328d9467c6d1adbd5354a.zip frameworks_base-531270a4a177a9f245d328d9467c6d1adbd5354a.tar.gz frameworks_base-531270a4a177a9f245d328d9467c6d1adbd5354a.tar.bz2 |
Adding the requiredForProfile flag.
Enabling to use requiredForProfile in application manifests
It determines which applications will be installed for managed profiles
and for restricted profiles
Change-Id: I14b4de2c9f41c2bbf5cd9fd0ca6caf5ce2d04131
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/content/pm/PackageInfo.java | 21 | ||||
-rw-r--r-- | core/java/android/content/pm/PackageParser.java | 6 |
2 files changed, 27 insertions, 0 deletions
diff --git a/core/java/android/content/pm/PackageInfo.java b/core/java/android/content/pm/PackageInfo.java index 785f2b4..ef0c4d5 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 7fa9417..c222003 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; |