Merge "Don’t relaunch activity in fullscreen stack when entering split screen mode" into nyc-dev

This commit is contained in:
TreeHugger Robot
2016-05-02 19:13:43 +00:00
committed by Android (Google) Code Review
5 changed files with 20 additions and 10 deletions

View File

@@ -794,7 +794,9 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
if (hasBounds) { if (hasBounds) {
bounds = Rect.CREATOR.createFromParcel(data); 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.writeNoException();
reply.writeInt(res ? 1 : 0); reply.writeInt(res ? 1 : 0);
return true; return true;
@@ -3865,7 +3867,7 @@ class ActivityManagerProxy implements IActivityManager
} }
@Override @Override
public boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate, 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 data = Parcel.obtain();
Parcel reply = Parcel.obtain(); Parcel reply = Parcel.obtain();
@@ -3880,6 +3882,7 @@ class ActivityManagerProxy implements IActivityManager
} else { } else {
data.writeInt(0); data.writeInt(0);
} }
data.writeInt(moveHomeStackFront ? 1 : 0);
mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0); mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
reply.readException(); reply.readException();
boolean res = reply.readInt() > 0; boolean res = reply.readInt() > 0;

View File

@@ -147,7 +147,7 @@ public interface IActivityManager extends IInterface {
public void moveTaskBackwards(int task) throws RemoteException; public void moveTaskBackwards(int task) throws RemoteException;
public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException; public void moveTaskToStack(int taskId, int stackId, boolean toTop) throws RemoteException;
public boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate, 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; public boolean moveTopActivityToPinnedStack(int stackId, Rect bounds) throws RemoteException;
/** /**

View File

@@ -414,8 +414,8 @@ public class SystemServicesProxy {
} }
try { try {
return mIam.moveTaskToDockedStack( return mIam.moveTaskToDockedStack(taskId, createMode, true /* onTop */,
taskId, createMode, true /* onTop */, false /* animate */, initialBounds); false /* animate */, initialBounds, true /* moveHomeStackFront */ );
} catch (RemoteException e) { } catch (RemoteException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@@ -9700,7 +9700,7 @@ public final class ActivityManagerService extends ActivityManagerNative
*/ */
@Override @Override
public boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate, public boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
Rect initialBounds) { Rect initialBounds, boolean moveHomeStackFront) {
enforceCallingPermission(MANAGE_ACTIVITY_STACKS, "moveTaskToDockedStack()"); enforceCallingPermission(MANAGE_ACTIVITY_STACKS, "moveTaskToDockedStack()");
synchronized (this) { synchronized (this) {
long ident = Binder.clearCallingIdentity(); long ident = Binder.clearCallingIdentity();
@@ -9708,9 +9708,16 @@ public final class ActivityManagerService extends ActivityManagerNative
if (DEBUG_STACK) Slog.d(TAG_STACK, "moveTaskToDockedStack: moving task=" + taskId if (DEBUG_STACK) Slog.d(TAG_STACK, "moveTaskToDockedStack: moving task=" + taskId
+ " to createMode=" + createMode + " toTop=" + toTop); + " to createMode=" + createMode + " toTop=" + toTop);
mWindowManager.setDockedStackCreateState(createMode, initialBounds); mWindowManager.setDockedStackCreateState(createMode, initialBounds);
return mStackSupervisor.moveTaskToStackLocked( final boolean moved = mStackSupervisor.moveTaskToStackLocked(
taskId, DOCKED_STACK_ID, toTop, !FORCE_FOCUS, taskId, DOCKED_STACK_ID, toTop, !FORCE_FOCUS, "moveTaskToDockedStack",
"moveTaskToDockedStack", animate); animate, DEFER_RESUME);
if (moved) {
if (moveHomeStackFront) {
mStackSupervisor.moveHomeStackToFront("moveTaskToDockedStack");
}
mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS);
}
return moved;
} finally { } finally {
Binder.restoreCallingIdentity(ident); Binder.restoreCallingIdentity(ident);
} }

View File

@@ -204,7 +204,7 @@ class TaskPositioner implements DimLayer.DimLayerUser {
: DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT; : DOCKED_STACK_CREATE_MODE_BOTTOM_OR_RIGHT;
mService.mActivityManager.moveTaskToDockedStack( mService.mActivityManager.moveTaskToDockedStack(
mTask.mTaskId, createMode, true /*toTop*/, true /* animate */, mTask.mTaskId, createMode, true /*toTop*/, true /* animate */,
null /* initialBounds */); null /* initialBounds */, false /* moveHomeStackFront */);
} }
} catch(RemoteException e) {} } catch(RemoteException e) {}