use of android.app.ActivityManager.StackInfo in project android_frameworks_base by DirtyUnicorns.
the class ActivityStackSupervisor method getStackInfoLocked.
private StackInfo getStackInfoLocked(ActivityStack stack) {
final ActivityDisplay display = mActivityDisplays.get(Display.DEFAULT_DISPLAY);
StackInfo info = new StackInfo();
mWindowManager.getStackBounds(stack.mStackId, info.bounds);
info.displayId = Display.DEFAULT_DISPLAY;
info.stackId = stack.mStackId;
info.userId = stack.mCurrentUser;
info.visible = stack.getStackVisibilityLocked(null) == STACK_VISIBLE;
info.position = display != null ? display.mStacks.indexOf(stack) : 0;
ArrayList<TaskRecord> tasks = stack.getAllTasks();
final int numTasks = tasks.size();
int[] taskIds = new int[numTasks];
String[] taskNames = new String[numTasks];
Rect[] taskBounds = new Rect[numTasks];
int[] taskUserIds = new int[numTasks];
for (int i = 0; i < numTasks; ++i) {
final TaskRecord task = tasks.get(i);
taskIds[i] = task.taskId;
taskNames[i] = task.origActivity != null ? task.origActivity.flattenToString() : task.realActivity != null ? task.realActivity.flattenToString() : task.getTopActivity() != null ? task.getTopActivity().packageName : "unknown";
taskBounds[i] = new Rect();
mWindowManager.getTaskBounds(task.taskId, taskBounds[i]);
taskUserIds[i] = task.userId;
}
info.taskIds = taskIds;
info.taskNames = taskNames;
info.taskBounds = taskBounds;
info.taskUserIds = taskUserIds;
final ActivityRecord top = stack.topRunningActivityLocked();
info.topActivity = top != null ? top.intent.getComponent() : null;
return info;
}
use of android.app.ActivityManager.StackInfo in project android_frameworks_base by ResurrectionRemix.
the class Am method runStackInfo.
private void runStackInfo() throws Exception {
try {
String stackIdStr = nextArgRequired();
int stackId = Integer.parseInt(stackIdStr);
StackInfo info = mAm.getStackInfo(stackId);
System.out.println(info);
} catch (RemoteException e) {
}
}
use of android.app.ActivityManager.StackInfo in project android_frameworks_base by ResurrectionRemix.
the class Am method runTaskDragTaskTest.
private void runTaskDragTaskTest() {
final int taskId = Integer.parseInt(nextArgRequired());
final int stepSize = Integer.parseInt(nextArgRequired());
final String delayStr = nextArg();
final int delay_ms = (delayStr != null) ? Integer.parseInt(delayStr) : 0;
final StackInfo stackInfo;
Rect taskBounds;
try {
stackInfo = mAm.getStackInfo(mAm.getFocusedStackId());
taskBounds = mAm.getTaskBounds(taskId);
} catch (RemoteException e) {
System.err.println("Error getting focus stack info or task bounds: " + e);
return;
}
final Rect stackBounds = stackInfo.bounds;
int travelRight = stackBounds.width() - taskBounds.width();
int travelLeft = -travelRight;
int travelDown = stackBounds.height() - taskBounds.height();
int travelUp = -travelDown;
int passes = 0;
// We do 2 passes to get back to the original location of the task.
while (passes < 2) {
// Move right
System.out.println("Moving right...");
travelRight = moveTask(taskId, taskBounds, stackBounds, stepSize, travelRight, MOVING_FORWARD, MOVING_HORIZONTALLY, delay_ms);
System.out.println("Still need to travel right by " + travelRight);
// Move down
System.out.println("Moving down...");
travelDown = moveTask(taskId, taskBounds, stackBounds, stepSize, travelDown, MOVING_FORWARD, !MOVING_HORIZONTALLY, delay_ms);
System.out.println("Still need to travel down by " + travelDown);
// Move left
System.out.println("Moving left...");
travelLeft = moveTask(taskId, taskBounds, stackBounds, stepSize, travelLeft, !MOVING_FORWARD, MOVING_HORIZONTALLY, delay_ms);
System.out.println("Still need to travel left by " + travelLeft);
// Move up
System.out.println("Moving up...");
travelUp = moveTask(taskId, taskBounds, stackBounds, stepSize, travelUp, !MOVING_FORWARD, !MOVING_HORIZONTALLY, delay_ms);
System.out.println("Still need to travel up by " + travelUp);
try {
taskBounds = mAm.getTaskBounds(taskId);
} catch (RemoteException e) {
System.err.println("Error getting task bounds: " + e);
return;
}
passes++;
}
}
use of android.app.ActivityManager.StackInfo in project android_frameworks_base by ResurrectionRemix.
the class ActivityManagerProxy method getAllStackInfos.
@Override
public List<StackInfo> getAllStackInfos() throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
mRemote.transact(GET_ALL_STACK_INFOS_TRANSACTION, data, reply, 0);
reply.readException();
ArrayList<StackInfo> list = reply.createTypedArrayList(StackInfo.CREATOR);
data.recycle();
reply.recycle();
return list;
}
use of android.app.ActivityManager.StackInfo in project android_frameworks_base by ResurrectionRemix.
the class ActivityManagerProxy method getStackInfo.
@Override
public StackInfo getStackInfo(int stackId) throws RemoteException {
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
data.writeInt(stackId);
mRemote.transact(GET_STACK_INFO_TRANSACTION, data, reply, 0);
reply.readException();
int res = reply.readInt();
StackInfo info = null;
if (res != 0) {
info = StackInfo.CREATOR.createFromParcel(reply);
}
data.recycle();
reply.recycle();
return info;
}
Aggregations