summaryrefslogtreecommitdiff
path: root/cmds/am
diff options
context:
space:
mode:
authorFilip Gruszczynski <gruszczy@google.com>2016-02-02 15:07:15 -0800
committerFilip Gruszczynski <gruszczy@google.com>2016-02-02 16:27:18 -0800
commitdebd9a5ed57dce70b77fdee107b870d1a037c8c9 (patch)
treeb747adde04351318d6a26846bfa7ea8a740ca7a5 /cmds/am
parent56190d5e4b9d940ee64fccd75f3759e68bee15a7 (diff)
Allow specifying stack when starting activity in AM command.
Change-Id: I42032bdebf16b6cd2c0c87fd9aa5c261bc9fe25d
Diffstat (limited to 'cmds/am')
-rw-r--r--cmds/am/src/com/android/commands/am/Am.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java
index ba93b2a2cafe..9d81c438360f 100644
--- a/cmds/am/src/com/android/commands/am/Am.java
+++ b/cmds/am/src/com/android/commands/am/Am.java
@@ -21,10 +21,12 @@ package com.android.commands.am;
import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.RESIZE_MODE_SYSTEM;
import static android.app.ActivityManager.RESIZE_MODE_USER;
+import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;
import android.app.ActivityManager;
import android.app.ActivityManager.StackInfo;
import android.app.ActivityManagerNative;
+import android.app.ActivityOptions;
import android.app.IActivityContainer;
import android.app.IActivityController;
import android.app.IActivityManager;
@@ -106,6 +108,7 @@ public class Am extends BaseCommand {
private String mProfileFile;
private int mSamplingInterval;
private boolean mAutoStop;
+ private int mStackId;
/**
* Command-line entry point.
@@ -191,6 +194,7 @@ public class Am extends BaseCommand {
" --track-allocation: enable tracking of object allocations\n" +
" --user <USER_ID> | current: Specify which user to run as; if not\n" +
" specified then run as the current user.\n" +
+ " --stack <STACK_ID>: Specify into which stack should the activity be put." +
"\n" +
"am startservice: start a Service. Options are:\n" +
" --user <USER_ID> | current: Specify which user to run as; if not\n" +
@@ -467,6 +471,7 @@ public class Am extends BaseCommand {
mSamplingInterval = 0;
mAutoStop = false;
mUserId = defUser;
+ mStackId = FULLSCREEN_WORKSPACE_STACK_ID;
return Intent.parseCommandArgs(mArgs, new Intent.CommandOptionHandler() {
@Override
@@ -493,6 +498,8 @@ public class Am extends BaseCommand {
mUserId = parseUserArg(nextArgRequired());
} else if (opt.equals("--receiver-permission")) {
mReceiverPermission = nextArgRequired();
+ } else if (opt.equals("--stack")) {
+ mStackId = Integer.parseInt(nextArgRequired());
} else {
return false;
}
@@ -550,6 +557,7 @@ public class Am extends BaseCommand {
mimeType = mAm.getProviderMimeType(intent.getData(), mUserId);
}
+
do {
if (mStopOption) {
String packageName;
@@ -604,13 +612,20 @@ public class Am extends BaseCommand {
IActivityManager.WaitResult result = null;
int res;
final long startTime = SystemClock.uptimeMillis();
+ ActivityOptions options = null;
+ if (mStackId != FULLSCREEN_WORKSPACE_STACK_ID) {
+ options = ActivityOptions.makeBasic();
+ options.setLaunchStackId(mStackId);
+ }
if (mWaitOption) {
result = mAm.startActivityAndWait(null, null, intent, mimeType,
- null, null, 0, mStartFlags, profilerInfo, null, mUserId);
+ null, null, 0, mStartFlags, profilerInfo,
+ options != null ? options.toBundle() : null, mUserId);
res = result.result;
} else {
res = mAm.startActivityAsUser(null, null, intent, mimeType,
- null, null, 0, mStartFlags, profilerInfo, null, mUserId);
+ null, null, 0, mStartFlags, profilerInfo,
+ options != null ? options.toBundle() : null, mUserId);
}
final long endTime = SystemClock.uptimeMillis();
PrintStream out = mWaitOption ? System.out : System.err;