From 9e2c7ecf64e11e69dceb40fba6fd740e41a32417 Mon Sep 17 00:00:00 2001 From: Jiaquan He Date: Mon, 23 May 2016 11:00:12 -0700 Subject: [PATCH] Add support for android.R.attr#onTopLauncher This allows a launcher activity to always stay on top of all other activities. Bug: 28425537 Change-Id: Iad39a076b1e8c6a8304c3b218883a172c913a602 --- core/java/android/content/pm/ActivityInfo.java | 8 ++++++++ core/java/android/content/pm/PackageParser.java | 5 +++++ core/res/res/values/attrs_manifest.xml | 3 +++ .../core/java/com/android/server/am/ActivityRecord.java | 5 +++++ 4 files changed, 21 insertions(+) diff --git a/core/java/android/content/pm/ActivityInfo.java b/core/java/android/content/pm/ActivityInfo.java index 5a09c0028cdce..94c406a882e23 100644 --- a/core/java/android/content/pm/ActivityInfo.java +++ b/core/java/android/content/pm/ActivityInfo.java @@ -332,6 +332,14 @@ public class ActivityInfo extends ComponentInfo */ public static final int FLAG_ALWAYS_FOCUSABLE = 0x40000; + /** + * Bit in {@link #flags} indicating if the activity is a launcher activity which should always + * show up on the top of others. + * See android.R.attr#onTopLauncher. + * @hide + */ + public static final int FLAG_ON_TOP_LAUNCHER = 0x80000; + /** * @hide Bit in {@link #flags}: If set, this component will only be seen * by the system user. Only works with broadcast receivers. Set from the diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index adf9fe62c37e5..7b40cc5cb2c2b 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -79,6 +79,7 @@ import libcore.io.IoUtils; import static android.content.pm.ActivityInfo.FLAG_ALWAYS_FOCUSABLE; import static android.content.pm.ActivityInfo.FLAG_IMMERSIVE; +import static android.content.pm.ActivityInfo.FLAG_ON_TOP_LAUNCHER; import static android.content.pm.ActivityInfo.RESIZE_MODE_FORCE_RESIZEABLE; import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE; import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE_AND_PIPABLE; @@ -3567,6 +3568,10 @@ public class PackageParser { a.info.flags |= FLAG_ALWAYS_FOCUSABLE; } + if (sa.getBoolean(R.styleable.AndroidManifestActivity_onTopLauncher, false)) { + a.info.flags |= FLAG_ON_TOP_LAUNCHER; + } + a.info.lockTaskLaunchMode = sa.getInt(R.styleable.AndroidManifestActivity_lockTaskMode, 0); diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index d69d73db60916..e1bbef7555ab8 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -1898,6 +1898,9 @@ in a task/stack that isn't focusable. This flag allows them to be focusable.--> + +