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

Commit e4fbd328 authored by Chong Zhang's avatar Chong Zhang
Browse files

Don't change resize mode if AM didn't dock the task as requested

AM may not docked the task as requested if the task is not resizeable.
Setting resizing in this case would cause unnecessary drag-resizing,
and the resize mode will go out of sync.

bug: 27390258
Change-Id: I72d671ac015f93fde5aaa025fbade93acd9d9ca7
parent 1db8850b
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;
        }

@@ -3808,7 +3809,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();
@@ -3826,8 +3827,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
@@ -9486,7 +9486,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) {
@@ -9495,7 +9495,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