Merge "Don’t relaunch activity in fullscreen stack when entering split screen mode" into nyc-dev
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index a3f3b2b3..1a7c746 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -794,7 +794,9 @@
if (hasBounds) {
bounds = Rect.CREATOR.createFromParcel(data);
}
- boolean res = moveTaskToDockedStack(taskId, createMode, toTop, animate, bounds);
+ final boolean moveHomeStackFront = data.readInt() != 0;
+ final boolean res = moveTaskToDockedStack(
+ taskId, createMode, toTop, animate, bounds, moveHomeStackFront);
reply.writeNoException();
reply.writeInt(res ? 1 : 0);
return true;
@@ -3865,7 +3867,7 @@
}
@Override
public boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
- Rect initialBounds) throws RemoteException
+ Rect initialBounds, boolean moveHomeStackFront) throws RemoteException
{
Parcel data = Parcel.obtain();
Parcel reply = Parcel.obtain();
@@ -3880,6 +3882,7 @@
} else {
data.writeInt(0);
}
+ data.writeInt(moveHomeStackFront ? 1 : 0);
mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
reply.readException();
boolean res = reply.readInt() > 0;
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index 66b4fcf..55ce6c2 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -147,7 +147,7 @@
public void moveTaskBackwards(int task) throws RemoteException;
public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException;
public boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
- Rect initialBounds) throws RemoteException;
+ Rect initialBounds, boolean moveHomeStackFront) throws RemoteException;
public boolean moveTopActivityToPinnedStack(int stackId, Rect bounds) throws RemoteException;
/**
diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
index be06ad0..46b2612 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
@@ -414,8 +414,8 @@
}
try {
- return mIam.moveTaskToDockedStack(
- taskId, createMode, true /* onTop */, false /* animate */, initialBounds);
+ return mIam.moveTaskToDockedStack(taskId, createMode, true /* onTop */,
+ false /* animate */, initialBounds, true /* moveHomeStackFront */ );
} catch (RemoteException e) {
e.printStackTrace();
}
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index ddb9b8a..07f7e29 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -9700,7 +9700,7 @@
*/
@Override
public boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
- Rect initialBounds) {
+ Rect initialBounds, boolean moveHomeStackFront) {
enforceCallingPermission(MANAGE_ACTIVITY_STACKS, "moveTaskToDockedStack()");
synchronized (this) {
long ident = Binder.clearCallingIdentity();
@@ -9708,9 +9708,16 @@
if (DEBUG_STACK) Slog.d(TAG_STACK, "moveTaskToDockedStack: moving task=" + taskId
+ " to createMode=" + createMode + " toTop=" + toTop);
mWindowManager.setDockedStackCreateState(createMode, initialBounds);
- return mStackSupervisor.moveTaskToStackLocked(
- taskId, DOCKED_STACK_ID, toTop, !FORCE_FOCUS,
- "moveTaskToDockedStack", animate);
+ final boolean moved = mStackSupervisor.moveTaskToStackLocked(
+ taskId, DOCKED_STACK_ID, toTop, !FORCE_FOCUS, "moveTaskToDockedStack",
+ animate, DEFER_RESUME);
+ if (moved) {
+ if (moveHomeStackFront) {
+ mStackSupervisor.moveHomeStackToFront("moveTaskToDockedStack");
+ }
+ mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS);
+ }
+ return moved;
} finally {
Binder.restoreCallingIdentity(ident);
}
diff --git a/services/core/java/com/android/server/wm/TaskPositioner.java b/services/core/java/com/android/server/wm/TaskPositioner.java
index ae70aa8..222087d 100644
--- a/services/core/java/com/android/server/wm/TaskPositioner.java
+++ b/services/core/java/com/android/server/wm/TaskPositioner.java
@@ -204,7 +204,7 @@
: DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT;
mService.mActivityManager.moveTaskToDockedStack(
mTask.mTaskId, createMode, true /*toTop*/, true /* animate */,
- null /* initialBounds */);
+ null /* initialBounds */, false /* moveHomeStackFront */);
}
} catch(RemoteException e) {}