From e0a3884cb627efc650e19fbe76b1b3343468cf57 Mon Sep 17 00:00:00 2001 From: Craig Mautner Date: Mon, 16 Dec 2013 16:14:02 -0800 Subject: Extend stack management to other displays. - Abandon ActivityContainer.startActivity() in favor of IActivityManager.startActivityAsUserInContainer(). - Modify Am to test starting an activity on a container. - Create a DisplayContext as the base context if the activity token is on a different display. - Test for home display in more cases when manipulating home stack. - Rename mDisplayInfos => mActivityDisplays. - Create new method for moving task to front of stack regardless of which display it is on. Change-Id: I4fcb83ae844c5839ee3e2722229623d1a80ed921 --- cmds/am/src/com/android/commands/am/Am.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'cmds/am') diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java index 7adf5ec..89e15d2 100644 --- a/cmds/am/src/com/android/commands/am/Am.java +++ b/cmds/am/src/com/android/commands/am/Am.java @@ -109,7 +109,7 @@ public class Am extends BaseCommand { " am to-intent-uri [INTENT]\n" + " am switch-user \n" + " am stop-user \n" + - " am stack create \n" + + " am stack start \n" + " am stack movetask [true|false]\n" + " am stack resize \n" + " am stack list\n" + @@ -207,7 +207,7 @@ public class Am extends BaseCommand { "am stop-user: stop execution of USER_ID, not allowing it to run any\n" + " code until a later explicit switch to it.\n" + "\n" + - "am stack create: create a new stack containing which must exist\n" + + "am stack start: start a new activity on using .\n" + "\n" + "am stack movetask: move from its current stack to the top (true) or" + " bottom (false) of .\n" + @@ -1541,8 +1541,8 @@ public class Am extends BaseCommand { private void runStack() throws Exception { String op = nextArgRequired(); - if (op.equals("create")) { - runStackCreate(); + if (op.equals("start")) { + runStackStart(); } else if (op.equals("movetask")) { runStackMoveTask(); } else if (op.equals("resize")) { @@ -1557,19 +1557,16 @@ public class Am extends BaseCommand { } } - private void runStackCreate() throws Exception { - String taskIdStr = nextArgRequired(); - int taskId = Integer.valueOf(taskIdStr); + private void runStackStart() throws Exception { String displayIdStr = nextArgRequired(); int displayId = Integer.valueOf(displayIdStr); + Intent intent = makeIntent(UserHandle.USER_CURRENT); try { IBinder homeActivityToken = mAm.getHomeActivityToken(); IActivityContainer container = mAm.createActivityContainer(homeActivityToken, null); - final int stackId = container.getStackId(); - System.out.println("createStack returned new stackId=" + stackId + "\n"); container.attachToDisplay(displayId); - mAm.moveTaskToStack(taskId, stackId, true); + container.startActivity(intent); } catch (RemoteException e) { } } -- cgit v1.1