From ffd14a13ce7425562777152256ea7760d95f254d Mon Sep 17 00:00:00 2001 From: Craig Mautner Date: Wed, 23 Apr 2014 21:38:50 -0700 Subject: [PATCH] Add activity attribute allowEmbedded Activitys without allowEmbedded=true may not be launched in an ActivityView. Fixes bug 13693121. Change-Id: I431d554300fc3504ab1bc7d73a58d5dad24f8639 --- api/current.txt | 1 + core/java/android/content/pm/ActivityInfo.java | 9 ++++++++- core/java/android/content/pm/PackageParser.java | 6 ++++++ core/res/res/values/attrs_manifest.xml | 10 +++++++++- core/res/res/values/public.xml | 3 ++- 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/api/current.txt b/api/current.txt index a3824d7221646..2464e38eae22a 100644 --- a/api/current.txt +++ b/api/current.txt @@ -277,6 +277,7 @@ package android { field public static final int allContactsName = 16843468; // 0x10102cc field public static final int allowBackup = 16843392; // 0x1010280 field public static final int allowClearUserData = 16842757; // 0x1010005 + field public static final int allowEmbedded = 16843765; // 0x10103f5 field public static final int allowParallelSyncs = 16843570; // 0x1010332 field public static final int allowSingleTap = 16843353; // 0x1010259 field public static final int allowTaskReparenting = 16843268; // 0x1010204 diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java index b8ac3bf9a8e00..941b72668e1bf 100644 --- a/core/java/android/content/pm/ActivityInfo.java +++ b/core/java/android/content/pm/ActivityInfo.java @@ -187,7 +187,7 @@ public class ActivityInfo extends ComponentInfo /** * @hide Bit in {@link #flags}: If set, this component will only be seen * by the primary user. Only works with broadcast receivers. Set from the - * {@link android.R.attr#primaryUserOnly} attribute. + * android.R.attr#primaryUserOnly attribute. */ public static final int FLAG_PRIMARY_USER_ONLY = 0x20000000; /** @@ -198,6 +198,13 @@ public class ActivityInfo extends ComponentInfo * components; it is not applied to activities. */ public static final int FLAG_SINGLE_USER = 0x40000000; + /** + * @hide Bit in {@link #flags}: If set, this activity may be launched into an + * owned ActivityContainer such as that within an ActivityView. If not set and + * this activity is launched into such a container a SecurityExcception will be + * thrown. Set from the {@link android.R.attr#allowEmbedded} attribute. + */ + public static final int FLAG_ALLOW_EMBEDDED = 0x80000000; /** * Options that have been set in the activity declaration in the * manifest. diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 0ce1e44a54a83..d5de97a533b9d 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -2414,6 +2414,12 @@ public class PackageParser { a.info.flags |= ActivityInfo.FLAG_IMMERSIVE; } + if (sa.getBoolean( + com.android.internal.R.styleable.AndroidManifestActivity_allowEmbedded, + false)) { + a.info.flags |= ActivityInfo.FLAG_ALLOW_EMBEDDED; + } + if (!receiver) { if (sa.getBoolean( com.android.internal.R.styleable.AndroidManifestActivity_hardwareAccelerated, diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index b629c688cb260..bb4d3b6885737 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -735,7 +735,14 @@ selected a new global font size. --> - + + + + @@ -1516,6 +1523,7 @@ +