Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d9de3ab authored by Chong Zhang's avatar Chong Zhang Committed by Android (Google) Code Review
Browse files

Merge "Don't change resize mode if AM didn't dock the task as requested" into nyc-dev

parents 27d68bb2 e4fbd328
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -792,8 +792,9 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            if (hasBounds) {
                bounds = Rect.CREATOR.createFromParcel(data);
            }
            moveTaskToDockedStack(taskId, createMode, toTop, animate, bounds);
            boolean res = moveTaskToDockedStack(taskId, createMode, toTop, animate, bounds);
            reply.writeNoException();
            reply.writeInt(res ? 1 : 0);
            return true;
        }

@@ -3809,7 +3810,7 @@ class ActivityManagerProxy implements IActivityManager
        reply.recycle();
    }
    @Override
    public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
    public boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
            Rect initialBounds) throws RemoteException
    {
        Parcel data = Parcel.obtain();
@@ -3827,8 +3828,10 @@ class ActivityManagerProxy implements IActivityManager
        }
        mRemote.transact(MOVE_TASK_TO_DOCKED_STACK_TRANSACTION, data, reply, 0);
        reply.readException();
        boolean res = reply.readInt() > 0;
        data.recycle();
        reply.recycle();
        return res;
    }
    @Override
    public boolean moveTopActivityToPinnedStack(int stackId, Rect r)
+1 −1
Original line number Diff line number Diff line
@@ -143,7 +143,7 @@ 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, boolean animate,
    public boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
            Rect initialBounds) throws RemoteException;
    public boolean moveTopActivityToPinnedStack(int stackId, Rect bounds) throws RemoteException;
    public void resizeStack(int stackId, Rect bounds, boolean allowResizeInDockedMode,
+8 −5
Original line number Diff line number Diff line
@@ -568,12 +568,15 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener

        // Make sure we inform DividerView before we actually start the activity so we can change
        // the resize mode already.
        if (ssp.moveTaskToDockedStack(topTaskId, stackCreateMode, initialBounds)) {
            EventBus.getDefault().send(new DockingTopTaskEvent(dragMode));
        ssp.moveTaskToDockedStack(topTaskId, stackCreateMode, initialBounds);
        showRecents(false /* triggeredFromAltTab */,
                dragMode == NavigationBarGestureHelper.DRAG_MODE_RECENTS, false /* animate */,
            showRecents(
                    false /* triggeredFromAltTab */,
                    dragMode == NavigationBarGestureHelper.DRAG_MODE_RECENTS,
                    false /* animate */,
                    true /* reloadTasks*/);
        }
    }

    /**
     * Returns the preloaded load plan and invalidates it.
+7 −4
Original line number Diff line number Diff line
@@ -338,15 +338,18 @@ public class SystemServicesProxy {
    }

    /** Docks an already resumed task to the side of the screen. */
    public void moveTaskToDockedStack(int taskId, int createMode, Rect initialBounds) {
        if (mIam == null) return;
    public boolean moveTaskToDockedStack(int taskId, int createMode, Rect initialBounds) {
        if (mIam == null) {
            return false;
        }

        try {
            mIam.moveTaskToDockedStack(taskId, createMode, true /* onTop */, false /* animate */,
                    initialBounds);
            return mIam.moveTaskToDockedStack(
                    taskId, createMode, true /* onTop */, false /* animate */, initialBounds);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        return false;
    }

    /** Returns the focused stack id. */
+3 −2
Original line number Diff line number Diff line
@@ -9493,7 +9493,7 @@ public final class ActivityManagerService extends ActivityManagerNative
     *                      docked stack. Pass {@code null} to use default bounds.
     */
    @Override
    public void moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
    public boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
            Rect initialBounds) {
        enforceCallingPermission(MANAGE_ACTIVITY_STACKS, "moveTaskToDockedStack()");
        synchronized (this) {
@@ -9502,7 +9502,8 @@ public final class ActivityManagerService extends ActivityManagerNative
                if (DEBUG_STACK) Slog.d(TAG_STACK, "moveTaskToDockedStack: moving task=" + taskId
                        + " to createMode=" + createMode + " toTop=" + toTop);
                mWindowManager.setDockedStackCreateState(createMode, initialBounds);
                mStackSupervisor.moveTaskToStackLocked(taskId, DOCKED_STACK_ID, toTop, !FORCE_FOCUS,
                return mStackSupervisor.moveTaskToStackLocked(
                        taskId, DOCKED_STACK_ID, toTop, !FORCE_FOCUS,
                        "moveTaskToDockedStack", animate);
            } finally {
                Binder.restoreCallingIdentity(ident);
Loading