diff options
author | Craig Mautner <cmautner@google.com> | 2014-03-08 14:23:10 -0800 |
---|---|---|
committer | Craig Mautner <cmautner@google.com> | 2014-03-13 11:09:13 -0700 |
commit | aea74a5977ca9f1054926eb24f247562c3a4a6ba (patch) | |
tree | 64ea3d6369a984cc8863c7331baa052a3c9891bf /cmds | |
parent | 1cb98aeaad2e04e6f1cc4f67c92808aa1c8f50e5 (diff) | |
download | frameworks_base-aea74a5977ca9f1054926eb24f247562c3a4a6ba.zip frameworks_base-aea74a5977ca9f1054926eb24f247562c3a4a6ba.tar.gz frameworks_base-aea74a5977ca9f1054926eb24f247562c3a4a6ba.tar.bz2 |
Add Lock Task Mode.
When in lock task mode only the specified task may run. All
attempts to switch to another task are ignored until the task
finishes or a call to stopLockTaskMode() is made.
Change-Id: I6cfe92fe1bcf22cd47b5398c08e23c52a4092dda
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/am/src/com/android/commands/am/Am.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java index 01e7615..92cb52c 100644 --- a/cmds/am/src/com/android/commands/am/Am.java +++ b/cmds/am/src/com/android/commands/am/Am.java @@ -114,6 +114,8 @@ public class Am extends BaseCommand { " am stack resize <STACK_ID> <LEFT,TOP,RIGHT,BOTTOM>\n" + " am stack list\n" + " am stack info <STACK_ID>\n" + + " am lock-task <TASK_ID>\n" + + " am lock-task stop\n" + "\n" + "am start: start an Activity. Options are:\n" + " -D: enable debugging\n" + @@ -218,6 +220,8 @@ public class Am extends BaseCommand { "\n" + "am stack info: display the information about activity stack <STACK_ID>.\n" + "\n" + + "am lock-task: bring <TASK_ID> to the front and don't allow other tasks to run\n" + + "\n" + "<INTENT> specifications include these flags and arguments:\n" + " [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]\n" + " [-c <CATEGORY> [-c <CATEGORY>] ...]\n" + @@ -309,6 +313,8 @@ public class Am extends BaseCommand { runStopUser(); } else if (op.equals("stack")) { runStack(); + } else if (op.equals("lock-task")) { + runLockTask(); } else { showError("Error: unknown command '" + op + "'"); } @@ -1641,4 +1647,19 @@ public class Am extends BaseCommand { } catch (RemoteException e) { } } + + private void runLockTask() throws Exception { + String taskIdStr = nextArgRequired(); + try { + if (taskIdStr.equals("stop")) { + mAm.stopLockTaskMode(); + } else { + int taskId = Integer.valueOf(taskIdStr); + mAm.startLockTaskMode(taskId); + } + System.err.println("Activity manager is " + (mAm.isInLockTaskMode() ? "" : "not ") + + "in lockTaskMode"); + } catch (RemoteException e) { + } + } } |