Added support for static vs. dynamic stacks

Now that stacks represent workspaces we can define static
stacks which help shape the characteristics of the tasks
they contain. For example, fullscreen tasks/activities will
normally be launched in the stack with id
FULLSCREEN_WORKSPACE_STACK_ID, while freeform tasks/activities
will normally be launched in the stack with id
FREEFORM_WORKSPACE_STACK_ID.

Also, added ability to position a task at any index in a stack.

Bug: 22068114
Change-Id: Ib6c62a84b5f204fbf072755264c5c5eda6184f97
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index facaee4..abfe215 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -752,6 +752,16 @@
             return true;
         }
 
+        case POSITION_TASK_IN_STACK_TRANSACTION: {
+            data.enforceInterface(IActivityManager.descriptor);
+            int taskId = data.readInt();
+            int stackId = data.readInt();
+            int position = data.readInt();
+            positionTaskInStack(taskId, stackId, position);
+            reply.writeNoException();
+            return true;
+        }
+
         case GET_ALL_STACK_INFOS_TRANSACTION: {
             data.enforceInterface(IActivityManager.descriptor);
             List<StackInfo> list = getAllStackInfos();
@@ -3469,6 +3479,20 @@
         reply.recycle();
     }
     @Override
+    public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException
+    {
+        Parcel data = Parcel.obtain();
+        Parcel reply = Parcel.obtain();
+        data.writeInterfaceToken(IActivityManager.descriptor);
+        data.writeInt(taskId);
+        data.writeInt(stackId);
+        data.writeInt(position);
+        mRemote.transact(POSITION_TASK_IN_STACK_TRANSACTION, data, reply, 0);
+        reply.readException();
+        data.recycle();
+        reply.recycle();
+    }
+    @Override
     public List<StackInfo> getAllStackInfos() throws RemoteException
     {
         Parcel data = Parcel.obtain();