Merge "Add support for android.R.attr#onTopLauncher"

This commit is contained in:
Jiaquan He
2016-05-25 16:12:42 +00:00
committed by Android (Google) Code Review
4 changed files with 21 additions and 0 deletions

View File

@@ -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

View File

@@ -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);

View File

@@ -1898,6 +1898,9 @@
in a task/stack that isn't focusable. This flag allows them to be focusable.-->
<attr name="alwaysFocusable" format="boolean" />
<attr name="enableVrMode" />
<!-- @hide This activity is a launcher which should always show up on the top of others.
This attribute is ignored if the activity isn't a launcher. -->
<attr name="onTopLauncher" format="boolean" />
</declare-styleable>
<!-- The <code>activity-alias</code> tag declares a new

View File

@@ -19,6 +19,7 @@ package com.android.server.am;
import static android.app.ActivityManager.StackId;
import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.content.pm.ActivityInfo.FLAG_ON_TOP_LAUNCHER;
import static android.content.pm.ActivityInfo.RESIZE_MODE_CROP_WINDOWS;
import static android.content.pm.ActivityInfo.FLAG_ALWAYS_FOCUSABLE;
import static android.content.pm.ActivityInfo.RESIZE_MODE_RESIZEABLE;
@@ -858,6 +859,10 @@ final class ActivityRecord {
return (info.flags & FLAG_ALWAYS_FOCUSABLE) != 0;
}
boolean isOnTopLauncher() {
return isHomeActivity() && (info.flags & FLAG_ON_TOP_LAUNCHER) != 0;
}
void makeFinishingLocked() {
if (!finishing) {
if (task != null && task.stack != null