diff options
author | Craig Mautner <cmautner@google.com> | 2013-06-18 01:35:30 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-06-18 01:35:31 +0000 |
commit | 3b7e6b95c251cb42d0e0bdc8876c35b3f1582aca (patch) | |
tree | ba3f4870cafaeafd63b6e1664f641f4ae723dea6 | |
parent | 94c747db09033e24188e79c7e0e2cfef8402b48f (diff) | |
parent | fd1ce8d5a7aa1ec6c7324b171f7e7a15a95f8759 (diff) | |
download | frameworks_base-3b7e6b95c251cb42d0e0bdc8876c35b3f1582aca.zip frameworks_base-3b7e6b95c251cb42d0e0bdc8876c35b3f1582aca.tar.gz frameworks_base-3b7e6b95c251cb42d0e0bdc8876c35b3f1582aca.tar.bz2 |
Merge "Add new API getStackBoxInfo"
-rw-r--r-- | cmds/am/src/com/android/commands/am/Am.java | 25 | ||||
-rw-r--r-- | core/java/android/app/ActivityManagerNative.java | 32 | ||||
-rw-r--r-- | core/java/android/app/IActivityManager.java | 2 | ||||
-rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 16 |
4 files changed, 72 insertions, 3 deletions
diff --git a/cmds/am/src/com/android/commands/am/Am.java b/cmds/am/src/com/android/commands/am/Am.java index afedd42..3bbdc48 100644 --- a/cmds/am/src/com/android/commands/am/Am.java +++ b/cmds/am/src/com/android/commands/am/Am.java @@ -103,10 +103,11 @@ public class Am extends BaseCommand { " am to-intent-uri [INTENT]\n" + " am switch-user <USER_ID>\n" + " am stop-user <USER_ID>\n" + - " am stack create <TASK_ID> <RELATIVE_STACK_ID> <POSITION> <WEIGHT>\n" + + " am stack create <TASK_ID> <RELATIVE_STACK_BOX_ID> <POSITION> <WEIGHT>\n" + " am stack movetask <STACK_ID> <TASK_ID> [true|false]\n" + " am stack resize <STACK_ID> <WEIGHT>\n" + " am stack boxes\n" + + " am stack box <STACK_BOX_ID>\n" + "\n" + "am start: start an Activity. Options are:\n" + " -D: enable debugging\n" + @@ -194,8 +195,12 @@ public class Am extends BaseCommand { "\n" + "am stack create: create a new stack relative to an existing one.\n" + " <TASK_ID>: the task to populate the new stack with. Must exist.\n" + - " <RELATIVE_STACK_ID>: existing stack's id.\n" + - " <POSITION>: 0: to left of, 1: to right of, 2: above, 3: below\n" + + " <RELATIVE_STACK_BOX_ID>: existing stack box's id.\n" + + " <POSITION>: 0: before <RELATIVE_STACK_BOX_ID>, per RTL/LTR configuration,\n" + + " 1: after <RELATIVE_STACK_BOX_ID>, per RTL/LTR configuration,\n" + + " 2: to left of <RELATIVE_STACK_BOX_ID>,\n" + + " 3: to right of <RELATIVE_STACK_BOX_ID>," + + " 4: above <RELATIVE_STACK_BOX_ID>, 5: below <RELATIVE_STACK_BOX_ID>\n" + " <WEIGHT>: float between 0.2 and 0.8 inclusive.\n" + "\n" + "am stack movetask: move <TASK_ID> from its current stack to the top (true) or" + @@ -205,6 +210,8 @@ public class Am extends BaseCommand { "\n" + "am stack boxes: list the hierarchy of stack boxes and their contents.\n" + "\n" + + "am stack box: list the hierarchy of stack boxes rooted at <STACK_BOX_ID>.\n" + + "\n" + "<INTENT> specifications include these flags and arguments:\n" + " [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]\n" + " [-c <CATEGORY> [-c <CATEGORY>] ...]\n" + @@ -1488,6 +1495,8 @@ public class Am extends BaseCommand { runStackBoxResize(); } else if (op.equals("boxes")) { runStackBoxes(); + } else if (op.equals("box")) { + runStackBoxInfo(); } else { showError("Error: unknown command '" + op + "'"); return; @@ -1554,4 +1563,14 @@ public class Am extends BaseCommand { } catch (RemoteException e) { } } + + private void runStackBoxInfo() throws Exception { + try { + String stackBoxIdStr = nextArgRequired(); + int stackBoxId = Integer.valueOf(stackBoxIdStr); + StackBoxInfo stackBoxInfo = mAm.getStackBoxInfo(stackBoxId); + System.out.println(stackBoxInfo); + } catch (RemoteException e) { + } + } } diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index 27e20b9..1573398 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -648,6 +648,20 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } + case GET_STACK_BOX_INFO_TRANSACTION: { + data.enforceInterface(IActivityManager.descriptor); + int stackBoxId = data.readInt(); + StackBoxInfo info = getStackBoxInfo(stackBoxId); + reply.writeNoException(); + if (info != null) { + reply.writeInt(1); + info.writeToParcel(reply, 0); + } else { + reply.writeInt(0); + } + return true; + } + case SET_FOCUSED_STACK_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int stackId = data.readInt(); @@ -2672,6 +2686,24 @@ class ActivityManagerProxy implements IActivityManager return list; } @Override + public StackBoxInfo getStackBoxInfo(int stackBoxId) throws RemoteException + { + Parcel data = Parcel.obtain(); + Parcel reply = Parcel.obtain(); + data.writeInterfaceToken(IActivityManager.descriptor); + data.writeInt(stackBoxId); + mRemote.transact(GET_STACK_BOX_INFO_TRANSACTION, data, reply, 0); + reply.readException(); + int res = reply.readInt(); + StackBoxInfo info = null; + if (res != 0) { + info = StackBoxInfo.CREATOR.createFromParcel(reply); + } + data.recycle(); + reply.recycle(); + return info; + } + @Override public void setFocusedStack(int stackId) throws RemoteException { Parcel data = Parcel.obtain(); diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index b48eed2..c8791a4 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -120,6 +120,7 @@ public interface IActivityManager extends IInterface { public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException; public void resizeStackBox(int stackBoxId, float weight) throws RemoteException; public List<StackBoxInfo> getStackBoxes() throws RemoteException; + public StackBoxInfo getStackBoxInfo(int stackBoxId) throws RemoteException; public void setFocusedStack(int stackId) throws RemoteException; public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException; /* oneway */ @@ -664,4 +665,5 @@ public interface IActivityManager extends IInterface { int RESIZE_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+169; int GET_STACK_BOXES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+170; int SET_FOCUSED_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+171; + int GET_STACK_BOX_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+172; } diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 21c752b..62520d5 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -6450,6 +6450,22 @@ public final class ActivityManagerService extends ActivityManagerNative } @Override + public StackBoxInfo getStackBoxInfo(int stackBoxId) { + List<StackBoxInfo> stackBoxInfos = mWindowManager.getStackBoxInfos(); + StackBoxInfo info = null; + synchronized (this) { + List<StackInfo> stackInfos = getStacks(); + for (StackBoxInfo stackBoxInfo : stackBoxInfos) { + addStackInfoToStackBoxInfo(stackBoxInfo, stackInfos); + if (stackBoxInfo.stackBoxId == stackBoxId) { + info = stackBoxInfo; + } + } + } + return info; + } + + @Override public int getTaskForActivity(IBinder token, boolean onlyRoot) { synchronized(this) { return ActivityRecord.getTaskForActivityLocked(token, onlyRoot); |