Start moving Tasks from DisplayContent to TaskStack
- Create new classes for Stacks on WindowManager.
- Stop using DisplayContent methods and members:
addAppToken(),
removeAppToken(),
setAppTaskId(),
removeTask(),
mTaskIdToDisplayContents,
mTaskIdToTask.
- Start using WindowManagerService.createTask().
- Establish hierarchy of references: AppWindowToken=>Task=>
TaskStack=>StackBox=>DisplayContent.
- Clean up StackBox, TaskStack, and Task.
Change-Id: I798990aa7966784d22f4a43822087d8bb0404dd6
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index aca4f9c..83be92b 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -609,6 +609,36 @@
return true;
}
+ case CREATE_STACK_TRANSACTION: {
+ data.enforceInterface(IActivityManager.descriptor);
+ int position = data.readInt();
+ int relativeStackId = data.readInt();
+ float weight = data.readFloat();
+ int res = createStack(position, relativeStackId, weight);
+ reply.writeNoException();
+ reply.writeInt(res);
+ return true;
+ }
+
+ case MOVE_TASK_TO_STACK_TRANSACTION: {
+ data.enforceInterface(IActivityManager.descriptor);
+ int taskId = data.readInt();
+ int stackId = data.readInt();
+ boolean toTop = data.readInt() != 0;
+ moveTaskToStack(taskId, stackId, toTop);
+ reply.writeNoException();
+ return true;
+ }
+
+ case RESIZE_STACK_TRANSACTION: {
+ data.enforceInterface(IActivityManager.descriptor);
+ int stackId = data.readInt();
+ float weight = data.readFloat();
+ resizeStack(stackId, weight);
+ reply.writeNoException();
+ return true;
+ }
+
case GET_TASK_FOR_ACTIVITY_TRANSACTION: {
data.enforceInterface(IActivityManager.descriptor);
IBinder token = data.readStrongBinder();
@@ -2539,6 +2569,46 @@
data.recycle();
reply.recycle();
}
+ @Override
+ public int createStack(int position, int relativeStackId, float weight) throws RemoteException
+ {
+ Parcel data = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ data.writeInt(position);
+ data.writeInt(relativeStackId);
+ data.writeFloat(weight);
+ mRemote.transact(CREATE_STACK_TRANSACTION, data, reply, 0);
+ reply.readException();
+ int res = reply.readInt();
+ data.recycle();
+ reply.recycle();
+ return res;
+ }
+ @Override
+ public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException
+ {
+ Parcel data = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ data.writeInt(taskId);
+ data.writeInt(stackId);
+ data.writeInt(toTop ? 1 : 0);
+ mRemote.transact(MOVE_TASK_TO_STACK_TRANSACTION, data, reply, 0);
+ reply.readException();
+ data.recycle();
+ reply.recycle();
+ }
+ @Override
+ public void resizeStack(int stackId, float weight) throws RemoteException
+ {
+ Parcel data = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ data.writeInt(stackId);
+ data.writeFloat(weight);
+ mRemote.transact(RESIZE_STACK_TRANSACTION, data, reply, 0);
+ reply.readException();
+ data.recycle();
+ reply.recycle();
+ }
public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException
{
Parcel data = Parcel.obtain();
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index cf4c729..5340f95 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -16,6 +16,8 @@
package android.app;
+import android.app.ActivityManager.RunningTaskInfo;
+import android.app.ActivityManager.RunningServiceInfo;
import android.content.ComponentName;
import android.content.ContentProviderNative;
import android.content.IContentProvider;
@@ -99,19 +101,22 @@
public void activityDestroyed(IBinder token) throws RemoteException;
public String getCallingPackage(IBinder token) throws RemoteException;
public ComponentName getCallingActivity(IBinder token) throws RemoteException;
- public List getTasks(int maxNum, int flags,
+ public List<RunningTaskInfo> getTasks(int maxNum, int flags,
IThumbnailReceiver receiver) throws RemoteException;
public List<ActivityManager.RecentTaskInfo> getRecentTasks(int maxNum,
int flags, int userId) throws RemoteException;
public ActivityManager.TaskThumbnails getTaskThumbnails(int taskId) throws RemoteException;
public Bitmap getTaskTopThumbnail(int taskId) throws RemoteException;
- public List getServices(int maxNum, int flags) throws RemoteException;
+ public List<RunningServiceInfo> getServices(int maxNum, int flags) throws RemoteException;
public List<ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState()
throws RemoteException;
public void moveTaskToFront(int task, int flags, Bundle options) throws RemoteException;
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 position, int relativeStackId, float weight) throws RemoteException;
+ public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException;
+ public void resizeStack(int stackId, float weight) throws RemoteException;
public int getTaskForActivity(IBinder token, boolean onlyRoot) throws RemoteException;
/* oneway */
public void reportThumbnail(IBinder token,
@@ -632,4 +637,7 @@
int GET_TOP_ACTIVITY_EXTRAS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+161;
int REPORT_TOP_ACTIVITY_EXTRAS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+162;
int GET_LAUNCHED_FROM_PACKAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+163;
+ int CREATE_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+164;
+ int MOVE_TASK_TO_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+165;
+ int RESIZE_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+166;
}
diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl
index e4ecb5c..8044b51 100644
--- a/core/java/android/view/IWindowManager.aidl
+++ b/core/java/android/view/IWindowManager.aidl
@@ -76,8 +76,8 @@
void setEventDispatching(boolean enabled);
void addWindowToken(IBinder token, int type);
void removeWindowToken(IBinder token);
- void addAppToken(int addPos, IApplicationToken token,
- int groupId, int requestedOrientation, boolean fullscreen, boolean showWhenLocked);
+ void addAppToken(int addPos, IApplicationToken token, int groupId, int stackId,
+ int requestedOrientation, boolean fullscreen, boolean showWhenLocked);
void setAppGroupId(IBinder token, int groupId);
void setAppOrientation(IApplicationToken token, int requestedOrientation);
int getAppOrientation(IApplicationToken token);