Support creating docked stack at top/left/bottom/right half of screen

Change-Id: Id8d6f639ed67baadb856ce84a20af8929e04cb2e
This commit is contained in:
Wale Ogunwale
2015-09-14 12:54:50 -07:00
parent 228d40474d
commit 59a73ca331
7 changed files with 121 additions and 35 deletions

View File

@@ -452,6 +452,22 @@ public class ActivityManager {
*/
public static final int FIRST_DYNAMIC_STACK_ID = LAST_STATIC_STACK_ID + 1;
/**
* Input parameter to {@link android.app.IActivityManager#moveTaskToDockedStack} which
* specifies the position of the created docked stack at the top half of the screen if
* in portrait mode or at the left half of the screen if in landscape mode.
* @hide
*/
public static final int DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT = 0;
/**
* Input parameter to {@link android.app.IActivityManager#moveTaskToDockedStack} which
* specifies the position of the created docked stack at the bottom half of the screen if
* in portrait mode or at the right half of the screen if in landscape mode.
* @hide
*/
public static final int DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT = 1;
/** @hide */
public int getFrontActivityScreenCompatMode() {
try {

View File

@@ -743,6 +743,16 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
return true;
}
case MOVE_TASK_TO_DOCKED_STACK_TRANSACTION: {
data.enforceInterface(IActivityManager.descriptor);
int taskId = data.readInt();
int createMode = data.readInt();
boolean toTop = data.readInt() != 0;
moveTaskToDockedStack(taskId, createMode, toTop);
reply.writeNoException();
return true;
}
case RESIZE_STACK_TRANSACTION: {
data.enforceInterface(IActivityManager.descriptor);
int stackId = data.readInt();
@@ -3510,6 +3520,21 @@ class ActivityManagerProxy implements IActivityManager
reply.recycle();
}
@Override
public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop)
throws RemoteException
{
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
data.writeInterfaceToken(IActivityManager.descriptor);
data.writeInt(taskId);
data.writeInt(createMode);
data.writeInt(toTop ? 1 : 0);
mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
reply.readException();
data.recycle();
reply.recycle();
}
@Override
public void resizeStack(int stackId, Rect r) throws RemoteException
{
Parcel data = Parcel.obtain();

View File

@@ -140,6 +140,8 @@ public interface IActivityManager extends IInterface {
public boolean moveActivityTaskToBack(IBinder token, boolean nonRoot) throws RemoteException;
public void moveTaskBackwards(int task) throws RemoteException;
public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException;
public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop)
throws RemoteException;
public void resizeStack(int stackId, Rect bounds) throws RemoteException;
public void positionTaskInStack(int taskId, int stackId, int position) throws RemoteException;
public List<StackInfo> getAllStackInfos() throws RemoteException;
@@ -888,4 +890,5 @@ public interface IActivityManager extends IInterface {
int GET_ACTIVITY_STACK_ID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 343;
int MOVE_ACTIVITY_TO_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 344;
int REPORT_SIZE_CONFIGURATIONS = IBinder.FIRST_CALL_TRANSACTION + 345;
int MOVE_TASK_TO_DOCKED_STACK_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION + 346;
}