Loading cmds/am/src/com/android/commands/am/Am.java +36 −43 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ package com.android.commands.am; import android.app.ActivityManager; import android.app.ActivityManager.StackBoxInfo; import android.app.ActivityManager.StackInfo; import android.app.ActivityManagerNative; import android.app.IActivityController; import android.app.IActivityManager; Loading @@ -31,6 +31,7 @@ import android.content.IIntentReceiver; import android.content.Intent; import android.content.pm.IPackageManager; import android.content.pm.ResolveInfo; import android.graphics.Rect; import android.net.Uri; import android.os.Binder; import android.os.Bundle; Loading Loading @@ -106,11 +107,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_BOX_ID> <POSITION> <WEIGHT>\n" + " am stack create <TASK_ID>\n" + " am stack movetask <TASK_ID> <STACK_ID> [true|false]\n" + " am stack resize <STACK_ID> <WEIGHT>\n" + " am stack boxes\n" + " am stack box <STACK_BOX_ID>\n" + " am stack resize <STACK_ID> <LEFT,TOP,RIGHT,BOTTOM>\n" + " am stack list\n" + " am stack info <STACK_ID>\n" + "\n" + "am start: start an Activity. Options are:\n" + " -D: enable debugging\n" + Loading Loading @@ -204,24 +205,16 @@ 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 relative to an existing one.\n" + " <TASK_ID>: the task to populate the new stack with. Must exist.\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" + "am stack create: create a new stack containing <TASK_ID> which must exist\n" + "\n" + "am stack movetask: move <TASK_ID> from its current stack to the top (true) or" + " bottom (false) of <STACK_ID>.\n" + "\n" + "am stack resize: change <STACK_ID> relative size to new <WEIGHT>.\n" + "am stack resize: change <STACK_ID> size and position to <LEFT,TOP,RIGHT,BOTTOM>.\n" + "\n" + "am stack boxes: list the hierarchy of stack boxes and their contents.\n" + "am stack list: list all of the activity stacks and their sizes.\n" + "\n" + "am stack box: list the hierarchy of stack boxes rooted at <STACK_BOX_ID>.\n" + "am stack info: display the information about activity stack <STACK_ID>.\n" + "\n" + "<INTENT> specifications include these flags and arguments:\n" + " [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]\n" + Loading Loading @@ -1551,11 +1544,11 @@ public class Am extends BaseCommand { } else if (op.equals("movetask")) { runStackMoveTask(); } else if (op.equals("resize")) { runStackBoxResize(); } else if (op.equals("boxes")) { runStackBoxes(); } else if (op.equals("box")) { runStackBoxInfo(); runStackResize(); } else if (op.equals("list")) { runStackList(); } else if (op.equals("info")) { runStackInfo(); } else { showError("Error: unknown command '" + op + "'"); return; Loading @@ -1565,15 +1558,9 @@ public class Am extends BaseCommand { private void runStackCreate() throws Exception { String taskIdStr = nextArgRequired(); int taskId = Integer.valueOf(taskIdStr); String relativeToStr = nextArgRequired(); int relativeTo = Integer.valueOf(relativeToStr); String positionStr = nextArgRequired(); int position = Integer.valueOf(positionStr); String weightStr = nextArgRequired(); float weight = Float.valueOf(weightStr); try { int stackId = mAm.createStack(taskId, relativeTo, position, weight); int stackId = mAm.createStack(taskId); System.out.println("createStack returned new stackId=" + stackId + "\n\n"); } catch (RemoteException e) { } Loading Loading @@ -1601,34 +1588,40 @@ public class Am extends BaseCommand { } } private void runStackBoxResize() throws Exception { String stackBoxIdStr = nextArgRequired(); int stackBoxId = Integer.valueOf(stackBoxIdStr); String weightStr = nextArgRequired(); float weight = Float.valueOf(weightStr); private void runStackResize() throws Exception { String stackIdStr = nextArgRequired(); int stackId = Integer.valueOf(stackIdStr); String leftStr = nextArgRequired(); int left = Integer.valueOf(leftStr); String topStr = nextArgRequired(); int top = Integer.valueOf(topStr); String rightStr = nextArgRequired(); int right = Integer.valueOf(rightStr); String bottomStr = nextArgRequired(); int bottom = Integer.valueOf(bottomStr); try { mAm.resizeStackBox(stackBoxId, weight); mAm.resizeStack(stackId, new Rect(left, top, right, bottom)); } catch (RemoteException e) { } } private void runStackBoxes() throws Exception { private void runStackList() throws Exception { try { List<StackBoxInfo> stackBoxes = mAm.getStackBoxes(); for (StackBoxInfo info : stackBoxes) { List<StackInfo> stacks = mAm.getAllStackInfos(); for (StackInfo info : stacks) { System.out.println(info); } } catch (RemoteException e) { } } private void runStackBoxInfo() throws Exception { private void runStackInfo() throws Exception { try { String stackBoxIdStr = nextArgRequired(); int stackBoxId = Integer.valueOf(stackBoxIdStr); StackBoxInfo stackBoxInfo = mAm.getStackBoxInfo(stackBoxId); System.out.println(stackBoxInfo); String stackIdStr = nextArgRequired(); int stackId = Integer.valueOf(stackIdStr); StackInfo info = mAm.getStackInfo(stackId); System.out.println(info); } catch (RemoteException e) { } } Loading core/java/android/app/ActivityManager.java +7 −94 Original line number Diff line number Diff line Loading @@ -1288,107 +1288,16 @@ public class ActivityManager { } } /** * Information you can retrieve about the WindowManager StackBox hierarchy. * @hide */ public static class StackBoxInfo implements Parcelable { public int stackBoxId; public float weight; public boolean vertical; public Rect bounds; public StackBoxInfo[] children; public int stackId; public StackInfo stack; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(stackBoxId); dest.writeFloat(weight); dest.writeInt(vertical ? 1 : 0); bounds.writeToParcel(dest, flags); dest.writeInt(stackId); if (children != null) { children[0].writeToParcel(dest, flags); children[1].writeToParcel(dest, flags); } else { stack.writeToParcel(dest, flags); } } public void readFromParcel(Parcel source) { stackBoxId = source.readInt(); weight = source.readFloat(); vertical = source.readInt() == 1; bounds = Rect.CREATOR.createFromParcel(source); stackId = source.readInt(); if (stackId == -1) { children = new StackBoxInfo[2]; children[0] = StackBoxInfo.CREATOR.createFromParcel(source); children[1] = StackBoxInfo.CREATOR.createFromParcel(source); } else { stack = StackInfo.CREATOR.createFromParcel(source); } } public static final Creator<StackBoxInfo> CREATOR = new Creator<ActivityManager.StackBoxInfo>() { @Override public StackBoxInfo createFromParcel(Parcel source) { return new StackBoxInfo(source); } @Override public StackBoxInfo[] newArray(int size) { return new StackBoxInfo[size]; } }; public StackBoxInfo() { } public StackBoxInfo(Parcel source) { readFromParcel(source); } public String toString(String prefix) { StringBuilder sb = new StringBuilder(256); sb.append(prefix); sb.append("Box id=" + stackBoxId); sb.append(" weight=" + weight); sb.append(" vertical=" + vertical); sb.append(" bounds=" + bounds.toShortString()); sb.append("\n"); if (children != null) { sb.append(prefix); sb.append("First child=\n"); sb.append(children[0].toString(prefix + " ")); sb.append(prefix); sb.append("Second child=\n"); sb.append(children[1].toString(prefix + " ")); } else { sb.append(prefix); sb.append("Stack=\n"); sb.append(stack.toString(prefix + " ")); } return sb.toString(); } @Override public String toString() { return toString(""); } } /** * Information you can retrieve about an ActivityStack in the system. * @hide */ public static class StackInfo implements Parcelable { public int stackId; public Rect bounds; public Rect bounds = new Rect(); public int[] taskIds; public String[] taskNames; public int displayId; @Override public int describeContents() { Loading @@ -1404,6 +1313,7 @@ public class ActivityManager { dest.writeInt(bounds.bottom); dest.writeIntArray(taskIds); dest.writeStringArray(taskNames); dest.writeInt(displayId); } public void readFromParcel(Parcel source) { Loading @@ -1412,6 +1322,7 @@ public class ActivityManager { source.readInt(), source.readInt(), source.readInt(), source.readInt()); taskIds = source.createIntArray(); taskNames = source.createStringArray(); displayId = source.readInt(); } public static final Creator<StackInfo> CREATOR = new Creator<StackInfo>() { Loading @@ -1435,7 +1346,9 @@ public class ActivityManager { public String toString(String prefix) { StringBuilder sb = new StringBuilder(256); sb.append(prefix); sb.append("Stack id="); sb.append(stackId); sb.append(" bounds="); sb.append(bounds.toShortString()); sb.append("\n"); sb.append(" bounds="); sb.append(bounds.toShortString()); sb.append(" displayId="); sb.append(displayId); sb.append("\n"); prefix = prefix + " "; for (int i = 0; i < taskIds.length; ++i) { sb.append(prefix); sb.append("taskId="); sb.append(taskIds[i]); Loading core/java/android/app/ActivityManagerNative.java +22 −27 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package android.app; import android.app.ActivityManager.StackBoxInfo; import android.app.ActivityManager.StackInfo; import android.content.ComponentName; import android.content.IIntentReceiver; import android.content.IIntentSender; Loading @@ -31,6 +31,7 @@ import android.content.pm.ParceledListSlice; import android.content.pm.UserInfo; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Rect; import android.net.Uri; import android.os.Binder; import android.os.Bundle; Loading Loading @@ -614,10 +615,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM case CREATE_STACK_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int taskId = data.readInt(); int relativeStackId = data.readInt(); int position = data.readInt(); float weight = data.readFloat(); int res = createStack(taskId, relativeStackId, position, weight); int res = createStack(taskId); reply.writeNoException(); reply.writeInt(res); return true; Loading @@ -635,25 +633,26 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM case RESIZE_STACK_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int stackBoxId = data.readInt(); int stackId = data.readInt(); float weight = data.readFloat(); resizeStackBox(stackBoxId, weight); Rect r = Rect.CREATOR.createFromParcel(data); resizeStack(stackId, r); reply.writeNoException(); return true; } case GET_STACK_BOXES_TRANSACTION: { case GET_ALL_STACK_INFOS_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); List<StackBoxInfo> list = getStackBoxes(); List<StackInfo> list = getAllStackInfos(); reply.writeNoException(); reply.writeTypedList(list); return true; } case GET_STACK_BOX_INFO_TRANSACTION: { case GET_STACK_INFO_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int stackBoxId = data.readInt(); StackBoxInfo info = getStackBoxInfo(stackBoxId); int stackId = data.readInt(); StackInfo info = getStackInfo(stackId); reply.writeNoException(); if (info != null) { reply.writeInt(1); Loading Loading @@ -2715,16 +2714,12 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); } @Override public int createStack(int taskId, int relativeStackBoxId, int position, float weight) throws RemoteException public int createStack(int taskId) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeInt(taskId); data.writeInt(relativeStackBoxId); data.writeInt(position); data.writeFloat(weight); mRemote.transact(CREATE_STACK_TRANSACTION, data, reply, 0); reply.readException(); int res = reply.readInt(); Loading @@ -2747,44 +2742,44 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); } @Override public void resizeStackBox(int stackBoxId, float weight) throws RemoteException public void resizeStack(int stackBoxId, Rect r) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeInt(stackBoxId); data.writeFloat(weight); r.writeToParcel(data, 0); mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); reply.readException(); data.recycle(); reply.recycle(); } @Override public List<StackBoxInfo> getStackBoxes() throws RemoteException public List<StackInfo> getAllStackInfos() throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); mRemote.transact(GET_STACK_BOXES_TRANSACTION, data, reply, 0); mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0); reply.readException(); ArrayList<StackBoxInfo> list = reply.createTypedArrayList(StackBoxInfo.CREATOR); ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR); data.recycle(); reply.recycle(); return list; } @Override public StackBoxInfo getStackBoxInfo(int stackBoxId) throws RemoteException public StackInfo getStackInfo(int stackId) 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); data.writeInt(stackId); mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0); reply.readException(); int res = reply.readInt(); StackBoxInfo info = null; StackInfo info = null; if (res != 0) { info = StackBoxInfo.CREATOR.createFromParcel(reply); info = StackInfo.CREATOR.createFromParcel(reply); } data.recycle(); reply.recycle(); Loading core/java/android/app/IActivityManager.java +8 −8 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ package android.app; import android.app.ActivityManager.RunningTaskInfo; import android.app.ActivityManager.RunningServiceInfo; import android.app.ActivityManager.StackBoxInfo; import android.app.ActivityManager.StackInfo; import android.content.ComponentName; import android.content.ContentProviderNative; import android.content.IContentProvider; Loading @@ -36,6 +36,7 @@ import android.content.pm.ProviderInfo; import android.content.pm.UserInfo; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Rect; import android.net.Uri; import android.os.Bundle; import android.os.Debug; Loading Loading @@ -117,12 +118,11 @@ public interface IActivityManager extends IInterface { public void moveTaskToBack(int task) throws RemoteException; public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot) throws RemoteException; public void moveTaskBackwards(int task) throws RemoteException; public int createStack(int taskId, int relativeStackBoxId, int position, float weight) throws RemoteException; public int createStack(int taskId) throws RemoteException; 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 resizeStack(int stackId, Rect bounds) throws RemoteException; public List<StackInfo> getAllStackInfos() throws RemoteException; public StackInfo getStackInfo(int stackId) throws RemoteException; public void setFocusedStack(int stackId) throws RemoteException; public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException; /* oneway */ Loading Loading @@ -681,9 +681,9 @@ public interface IActivityManager extends IInterface { int CREATE_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+167; int MOVE_TASK_TO_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+168; int RESIZE_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+169; int GET_STACK_BOXES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+170; int GET_ALL_STACK_INFOS_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; int GET_STACK_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+172; int CONVERT_FROM_TRANSLUCENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+173; int CONVERT_TO_TRANSLUCENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+174; int NOTIFY_ACTIVITY_DRAWN_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+175; Loading services/java/com/android/server/am/ActivityManagerService.java +13 −73 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
cmds/am/src/com/android/commands/am/Am.java +36 −43 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ package com.android.commands.am; import android.app.ActivityManager; import android.app.ActivityManager.StackBoxInfo; import android.app.ActivityManager.StackInfo; import android.app.ActivityManagerNative; import android.app.IActivityController; import android.app.IActivityManager; Loading @@ -31,6 +31,7 @@ import android.content.IIntentReceiver; import android.content.Intent; import android.content.pm.IPackageManager; import android.content.pm.ResolveInfo; import android.graphics.Rect; import android.net.Uri; import android.os.Binder; import android.os.Bundle; Loading Loading @@ -106,11 +107,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_BOX_ID> <POSITION> <WEIGHT>\n" + " am stack create <TASK_ID>\n" + " am stack movetask <TASK_ID> <STACK_ID> [true|false]\n" + " am stack resize <STACK_ID> <WEIGHT>\n" + " am stack boxes\n" + " am stack box <STACK_BOX_ID>\n" + " am stack resize <STACK_ID> <LEFT,TOP,RIGHT,BOTTOM>\n" + " am stack list\n" + " am stack info <STACK_ID>\n" + "\n" + "am start: start an Activity. Options are:\n" + " -D: enable debugging\n" + Loading Loading @@ -204,24 +205,16 @@ 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 relative to an existing one.\n" + " <TASK_ID>: the task to populate the new stack with. Must exist.\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" + "am stack create: create a new stack containing <TASK_ID> which must exist\n" + "\n" + "am stack movetask: move <TASK_ID> from its current stack to the top (true) or" + " bottom (false) of <STACK_ID>.\n" + "\n" + "am stack resize: change <STACK_ID> relative size to new <WEIGHT>.\n" + "am stack resize: change <STACK_ID> size and position to <LEFT,TOP,RIGHT,BOTTOM>.\n" + "\n" + "am stack boxes: list the hierarchy of stack boxes and their contents.\n" + "am stack list: list all of the activity stacks and their sizes.\n" + "\n" + "am stack box: list the hierarchy of stack boxes rooted at <STACK_BOX_ID>.\n" + "am stack info: display the information about activity stack <STACK_ID>.\n" + "\n" + "<INTENT> specifications include these flags and arguments:\n" + " [-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]\n" + Loading Loading @@ -1551,11 +1544,11 @@ public class Am extends BaseCommand { } else if (op.equals("movetask")) { runStackMoveTask(); } else if (op.equals("resize")) { runStackBoxResize(); } else if (op.equals("boxes")) { runStackBoxes(); } else if (op.equals("box")) { runStackBoxInfo(); runStackResize(); } else if (op.equals("list")) { runStackList(); } else if (op.equals("info")) { runStackInfo(); } else { showError("Error: unknown command '" + op + "'"); return; Loading @@ -1565,15 +1558,9 @@ public class Am extends BaseCommand { private void runStackCreate() throws Exception { String taskIdStr = nextArgRequired(); int taskId = Integer.valueOf(taskIdStr); String relativeToStr = nextArgRequired(); int relativeTo = Integer.valueOf(relativeToStr); String positionStr = nextArgRequired(); int position = Integer.valueOf(positionStr); String weightStr = nextArgRequired(); float weight = Float.valueOf(weightStr); try { int stackId = mAm.createStack(taskId, relativeTo, position, weight); int stackId = mAm.createStack(taskId); System.out.println("createStack returned new stackId=" + stackId + "\n\n"); } catch (RemoteException e) { } Loading Loading @@ -1601,34 +1588,40 @@ public class Am extends BaseCommand { } } private void runStackBoxResize() throws Exception { String stackBoxIdStr = nextArgRequired(); int stackBoxId = Integer.valueOf(stackBoxIdStr); String weightStr = nextArgRequired(); float weight = Float.valueOf(weightStr); private void runStackResize() throws Exception { String stackIdStr = nextArgRequired(); int stackId = Integer.valueOf(stackIdStr); String leftStr = nextArgRequired(); int left = Integer.valueOf(leftStr); String topStr = nextArgRequired(); int top = Integer.valueOf(topStr); String rightStr = nextArgRequired(); int right = Integer.valueOf(rightStr); String bottomStr = nextArgRequired(); int bottom = Integer.valueOf(bottomStr); try { mAm.resizeStackBox(stackBoxId, weight); mAm.resizeStack(stackId, new Rect(left, top, right, bottom)); } catch (RemoteException e) { } } private void runStackBoxes() throws Exception { private void runStackList() throws Exception { try { List<StackBoxInfo> stackBoxes = mAm.getStackBoxes(); for (StackBoxInfo info : stackBoxes) { List<StackInfo> stacks = mAm.getAllStackInfos(); for (StackInfo info : stacks) { System.out.println(info); } } catch (RemoteException e) { } } private void runStackBoxInfo() throws Exception { private void runStackInfo() throws Exception { try { String stackBoxIdStr = nextArgRequired(); int stackBoxId = Integer.valueOf(stackBoxIdStr); StackBoxInfo stackBoxInfo = mAm.getStackBoxInfo(stackBoxId); System.out.println(stackBoxInfo); String stackIdStr = nextArgRequired(); int stackId = Integer.valueOf(stackIdStr); StackInfo info = mAm.getStackInfo(stackId); System.out.println(info); } catch (RemoteException e) { } } Loading
core/java/android/app/ActivityManager.java +7 −94 Original line number Diff line number Diff line Loading @@ -1288,107 +1288,16 @@ public class ActivityManager { } } /** * Information you can retrieve about the WindowManager StackBox hierarchy. * @hide */ public static class StackBoxInfo implements Parcelable { public int stackBoxId; public float weight; public boolean vertical; public Rect bounds; public StackBoxInfo[] children; public int stackId; public StackInfo stack; @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeInt(stackBoxId); dest.writeFloat(weight); dest.writeInt(vertical ? 1 : 0); bounds.writeToParcel(dest, flags); dest.writeInt(stackId); if (children != null) { children[0].writeToParcel(dest, flags); children[1].writeToParcel(dest, flags); } else { stack.writeToParcel(dest, flags); } } public void readFromParcel(Parcel source) { stackBoxId = source.readInt(); weight = source.readFloat(); vertical = source.readInt() == 1; bounds = Rect.CREATOR.createFromParcel(source); stackId = source.readInt(); if (stackId == -1) { children = new StackBoxInfo[2]; children[0] = StackBoxInfo.CREATOR.createFromParcel(source); children[1] = StackBoxInfo.CREATOR.createFromParcel(source); } else { stack = StackInfo.CREATOR.createFromParcel(source); } } public static final Creator<StackBoxInfo> CREATOR = new Creator<ActivityManager.StackBoxInfo>() { @Override public StackBoxInfo createFromParcel(Parcel source) { return new StackBoxInfo(source); } @Override public StackBoxInfo[] newArray(int size) { return new StackBoxInfo[size]; } }; public StackBoxInfo() { } public StackBoxInfo(Parcel source) { readFromParcel(source); } public String toString(String prefix) { StringBuilder sb = new StringBuilder(256); sb.append(prefix); sb.append("Box id=" + stackBoxId); sb.append(" weight=" + weight); sb.append(" vertical=" + vertical); sb.append(" bounds=" + bounds.toShortString()); sb.append("\n"); if (children != null) { sb.append(prefix); sb.append("First child=\n"); sb.append(children[0].toString(prefix + " ")); sb.append(prefix); sb.append("Second child=\n"); sb.append(children[1].toString(prefix + " ")); } else { sb.append(prefix); sb.append("Stack=\n"); sb.append(stack.toString(prefix + " ")); } return sb.toString(); } @Override public String toString() { return toString(""); } } /** * Information you can retrieve about an ActivityStack in the system. * @hide */ public static class StackInfo implements Parcelable { public int stackId; public Rect bounds; public Rect bounds = new Rect(); public int[] taskIds; public String[] taskNames; public int displayId; @Override public int describeContents() { Loading @@ -1404,6 +1313,7 @@ public class ActivityManager { dest.writeInt(bounds.bottom); dest.writeIntArray(taskIds); dest.writeStringArray(taskNames); dest.writeInt(displayId); } public void readFromParcel(Parcel source) { Loading @@ -1412,6 +1322,7 @@ public class ActivityManager { source.readInt(), source.readInt(), source.readInt(), source.readInt()); taskIds = source.createIntArray(); taskNames = source.createStringArray(); displayId = source.readInt(); } public static final Creator<StackInfo> CREATOR = new Creator<StackInfo>() { Loading @@ -1435,7 +1346,9 @@ public class ActivityManager { public String toString(String prefix) { StringBuilder sb = new StringBuilder(256); sb.append(prefix); sb.append("Stack id="); sb.append(stackId); sb.append(" bounds="); sb.append(bounds.toShortString()); sb.append("\n"); sb.append(" bounds="); sb.append(bounds.toShortString()); sb.append(" displayId="); sb.append(displayId); sb.append("\n"); prefix = prefix + " "; for (int i = 0; i < taskIds.length; ++i) { sb.append(prefix); sb.append("taskId="); sb.append(taskIds[i]); Loading
core/java/android/app/ActivityManagerNative.java +22 −27 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package android.app; import android.app.ActivityManager.StackBoxInfo; import android.app.ActivityManager.StackInfo; import android.content.ComponentName; import android.content.IIntentReceiver; import android.content.IIntentSender; Loading @@ -31,6 +31,7 @@ import android.content.pm.ParceledListSlice; import android.content.pm.UserInfo; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Rect; import android.net.Uri; import android.os.Binder; import android.os.Bundle; Loading Loading @@ -614,10 +615,7 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM case CREATE_STACK_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int taskId = data.readInt(); int relativeStackId = data.readInt(); int position = data.readInt(); float weight = data.readFloat(); int res = createStack(taskId, relativeStackId, position, weight); int res = createStack(taskId); reply.writeNoException(); reply.writeInt(res); return true; Loading @@ -635,25 +633,26 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM case RESIZE_STACK_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int stackBoxId = data.readInt(); int stackId = data.readInt(); float weight = data.readFloat(); resizeStackBox(stackBoxId, weight); Rect r = Rect.CREATOR.createFromParcel(data); resizeStack(stackId, r); reply.writeNoException(); return true; } case GET_STACK_BOXES_TRANSACTION: { case GET_ALL_STACK_INFOS_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); List<StackBoxInfo> list = getStackBoxes(); List<StackInfo> list = getAllStackInfos(); reply.writeNoException(); reply.writeTypedList(list); return true; } case GET_STACK_BOX_INFO_TRANSACTION: { case GET_STACK_INFO_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); int stackBoxId = data.readInt(); StackBoxInfo info = getStackBoxInfo(stackBoxId); int stackId = data.readInt(); StackInfo info = getStackInfo(stackId); reply.writeNoException(); if (info != null) { reply.writeInt(1); Loading Loading @@ -2715,16 +2714,12 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); } @Override public int createStack(int taskId, int relativeStackBoxId, int position, float weight) throws RemoteException public int createStack(int taskId) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeInt(taskId); data.writeInt(relativeStackBoxId); data.writeInt(position); data.writeFloat(weight); mRemote.transact(CREATE_STACK_TRANSACTION, data, reply, 0); reply.readException(); int res = reply.readInt(); Loading @@ -2747,44 +2742,44 @@ class ActivityManagerProxy implements IActivityManager reply.recycle(); } @Override public void resizeStackBox(int stackBoxId, float weight) throws RemoteException public void resizeStack(int stackBoxId, Rect r) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); data.writeInt(stackBoxId); data.writeFloat(weight); r.writeToParcel(data, 0); mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, IBinder.FLAG_ONEWAY); reply.readException(); data.recycle(); reply.recycle(); } @Override public List<StackBoxInfo> getStackBoxes() throws RemoteException public List<StackInfo> getAllStackInfos() throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); data.writeInterfaceToken(IActivityManager.descriptor); mRemote.transact(GET_STACK_BOXES_TRANSACTION, data, reply, 0); mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0); reply.readException(); ArrayList<StackBoxInfo> list = reply.createTypedArrayList(StackBoxInfo.CREATOR); ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR); data.recycle(); reply.recycle(); return list; } @Override public StackBoxInfo getStackBoxInfo(int stackBoxId) throws RemoteException public StackInfo getStackInfo(int stackId) 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); data.writeInt(stackId); mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0); reply.readException(); int res = reply.readInt(); StackBoxInfo info = null; StackInfo info = null; if (res != 0) { info = StackBoxInfo.CREATOR.createFromParcel(reply); info = StackInfo.CREATOR.createFromParcel(reply); } data.recycle(); reply.recycle(); Loading
core/java/android/app/IActivityManager.java +8 −8 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ package android.app; import android.app.ActivityManager.RunningTaskInfo; import android.app.ActivityManager.RunningServiceInfo; import android.app.ActivityManager.StackBoxInfo; import android.app.ActivityManager.StackInfo; import android.content.ComponentName; import android.content.ContentProviderNative; import android.content.IContentProvider; Loading @@ -36,6 +36,7 @@ import android.content.pm.ProviderInfo; import android.content.pm.UserInfo; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.Rect; import android.net.Uri; import android.os.Bundle; import android.os.Debug; Loading Loading @@ -117,12 +118,11 @@ public interface IActivityManager extends IInterface { public void moveTaskToBack(int task) throws RemoteException; public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot) throws RemoteException; public void moveTaskBackwards(int task) throws RemoteException; public int createStack(int taskId, int relativeStackBoxId, int position, float weight) throws RemoteException; public int createStack(int taskId) throws RemoteException; 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 resizeStack(int stackId, Rect bounds) throws RemoteException; public List<StackInfo> getAllStackInfos() throws RemoteException; public StackInfo getStackInfo(int stackId) throws RemoteException; public void setFocusedStack(int stackId) throws RemoteException; public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException; /* oneway */ Loading Loading @@ -681,9 +681,9 @@ public interface IActivityManager extends IInterface { int CREATE_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+167; int MOVE_TASK_TO_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+168; int RESIZE_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+169; int GET_STACK_BOXES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+170; int GET_ALL_STACK_INFOS_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; int GET_STACK_INFO_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+172; int CONVERT_FROM_TRANSLUCENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+173; int CONVERT_TO_TRANSLUCENT_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+174; int NOTIFY_ACTIVITY_DRAWN_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+175; Loading
services/java/com/android/server/am/ActivityManagerService.java +13 −73 File changed.Preview size limit exceeded, changes collapsed. Show changes