diff options
| author | 2013-04-12 17:52:42 -0700 | |
|---|---|---|
| committer | 2013-04-12 17:52:42 -0700 | |
| commit | ccbe389b4d2cee16da77685c88fa1475bc08cdb9 (patch) | |
| tree | 71d4739f29bb32acb75eca684e6bc0e09fa0a52a | |
| parent | e107aa43866ce06cd08a7a3f2500a22bf81bbe79 (diff) | |
Introducing manifest flag requiredAccountType
This can be used by apps that won't work without an account of that
type in the limited user environment. This way we can avoid letting
users select these apps when setting up a limited user.
Bug: 8600261
Change-Id: Iaa0dd5ff88e89fa7a1d8a4e70317290268411bdb
| -rw-r--r-- | api/current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/content/pm/PackageInfo.java | 5 | ||||
| -rw-r--r-- | core/java/android/content/pm/PackageParser.java | 16 | ||||
| -rw-r--r-- | core/res/res/values/attrs_manifest.xml | 7 | ||||
| -rw-r--r-- | core/res/res/values/public.xml | 1 |
5 files changed, 26 insertions, 4 deletions
diff --git a/api/current.txt b/api/current.txt index ceccfb78902a..caaec211b16b 100644 --- a/api/current.txt +++ b/api/current.txt @@ -852,6 +852,7 @@ package android { field public static final int reqNavigation = 16843306; // 0x101022a field public static final int reqTouchScreen = 16843303; // 0x1010227 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 requiresFadingEdge = 16843685; // 0x10103a5 field public static final int requiresSmallestWidthDp = 16843620; // 0x1010364 diff --git a/core/java/android/content/pm/PackageInfo.java b/core/java/android/content/pm/PackageInfo.java index 33a67572c567..af1a6d52fc9a 100644 --- a/core/java/android/content/pm/PackageInfo.java +++ b/core/java/android/content/pm/PackageInfo.java @@ -224,6 +224,9 @@ public class PackageInfo implements Parcelable { /** @hide */ public String restrictedAccountType; + /** @hide */ + public String requiredAccountType; + public PackageInfo() { } @@ -266,6 +269,7 @@ public class PackageInfo implements Parcelable { dest.writeInt(installLocation); dest.writeInt(requiredForAllUsers ? 1 : 0); dest.writeString(restrictedAccountType); + dest.writeString(requiredAccountType); } public static final Parcelable.Creator<PackageInfo> CREATOR @@ -306,5 +310,6 @@ public class PackageInfo implements Parcelable { installLocation = source.readInt(); requiredForAllUsers = source.readInt() != 0; restrictedAccountType = source.readString(); + requiredAccountType = source.readString(); } } diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 5a50ec29db0e..358657325bb3 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -289,6 +289,7 @@ public class PackageParser { pi.installLocation = p.installLocation; pi.requiredForAllUsers = p.mRequiredForAllUsers; pi.restrictedAccountType = p.mRestrictedAccountType; + pi.requiredAccountType = p.mRequiredAccountType; pi.firstInstallTime = firstInstallTime; pi.lastUpdateTime = lastUpdateTime; if ((flags&PackageManager.GET_GIDS) != 0) { @@ -1816,13 +1817,19 @@ public class PackageParser { false)) { owner.mRequiredForAllUsers = true; } - String accountType = sa.getString(com.android.internal.R.styleable + String restrictedAccountType = sa.getString(com.android.internal.R.styleable .AndroidManifestApplication_restrictedAccountType); - if (accountType != null && accountType.length() > 0) { - owner.mRestrictedAccountType = accountType; + if (restrictedAccountType != null && restrictedAccountType.length() > 0) { + owner.mRestrictedAccountType = restrictedAccountType; } } + String requiredAccountType = sa.getString(com.android.internal.R.styleable + .AndroidManifestApplication_requiredAccountType); + if (requiredAccountType != null && requiredAccountType.length() > 0) { + owner.mRequiredAccountType = requiredAccountType; + } + if (sa.getBoolean( com.android.internal.R.styleable.AndroidManifestApplication_debuggable, false)) { @@ -3339,6 +3346,9 @@ public class PackageParser { /* The restricted account authenticator type that is used by this application */ public String mRestrictedAccountType; + /* The required account type without which this application will not function */ + public String mRequiredAccountType; + /** * Digest suitable for comparing whether this package's manifest is the * same as another. diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index 7f5a3dc36b68..8821a01dcfad 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -909,8 +909,13 @@ <!-- Declare that this application requires access to restricted accounts of a certain type. The default value is null and restricted accounts won\'t be visible to this application. The type should correspond to the account authenticator type, such as - "com.google" --> + "com.google". Only usable by system apps. --> <attr name="restrictedAccountType" format="string"/> + <!-- Declare that this application requires an account of a certain + type. The default value is null and indicates that the application can work without + any accounts. The type should correspond to the account authenticator type, such as + "com.google". --> + <attr name="requiredAccountType" format="string"/> </declare-styleable> <!-- The <code>permission</code> tag declares a security permission that can be diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 42d692fe4cff..074d91f9cbb5 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2042,6 +2042,7 @@ <public type="attr" name="childIndicatorStart" /> <public type="attr" name="childIndicatorEnd" /> <public type="attr" name="restrictedAccountType" /> + <public type="attr" name="requiredAccountType" /> <public type="style" name="Theme.NoTitleBar.Overscan" /> <public type="style" name="Theme.Light.NoTitleBar.Overscan" /> |