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

Commit af526ec9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Corrects the recents and home stacks position around docked state (1/2)"

parents c638e226 330757df
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -475,7 +475,7 @@ interface IActivityManager {
    void reportSizeConfigurations(in IBinder token, in int[] horizontalSizeConfiguration,
            in int[] verticalSizeConfigurations, in int[] smallestWidthConfigurations);
    boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
            in Rect initialBounds, boolean moveHomeStackFront);
            in Rect initialBounds);
    void suppressResizeConfigChanges(boolean suppress);
    void moveTasksToFullscreenStack(int fromStackId, boolean onTop);
    boolean moveTopActivityToPinnedStack(int stackId, in Rect bounds);
+1 −1
Original line number Diff line number Diff line
@@ -519,7 +519,7 @@ public class SystemServicesProxy {

        try {
            return mIam.moveTaskToDockedStack(taskId, createMode, true /* onTop */,
                    false /* animate */, initialBounds, true /* moveHomeStackFront */ );
                    false /* animate */, initialBounds);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
+3 −11
Original line number Diff line number Diff line
@@ -10247,13 +10247,8 @@ public class ActivityManagerService extends IActivityManager.Stub
                    mWindowManager.setDockedStackCreateState(DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT,
                            null /* initialBounds */);
                }
                final boolean successful = task.reparent(stackId, toTop,
                task.reparent(stackId, toTop,
                        REPARENT_KEEP_STACK_AT_FRONT, ANIMATE, !DEFER_RESUME, "moveTaskToStack");
                if (successful && stackId == DOCKED_STACK_ID) {
                    // If task moved to docked stack - show recents if needed.
                    mWindowManager.showRecentApps(false /* fromHome */);
                }
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
@@ -10326,7 +10321,7 @@ public class ActivityManagerService extends IActivityManager.Stub
     */
    @Override
    public boolean moveTaskToDockedStack(int taskId, int createMode, boolean toTop, boolean animate,
            Rect initialBounds, boolean moveHomeStackFront) {
            Rect initialBounds) {
        enforceCallingPermission(MANAGE_ACTIVITY_STACKS, "moveTaskToDockedStack()");
        synchronized (this) {
            long ident = Binder.clearCallingIdentity();
@@ -10343,12 +10338,9 @@ public class ActivityManagerService extends IActivityManager.Stub
                // Defer resuming until we move the home stack to the front below
                final boolean moved = task.reparent(DOCKED_STACK_ID, toTop,
                        REPARENT_KEEP_STACK_AT_FRONT, animate, DEFER_RESUME,
                        REPARENT_KEEP_STACK_AT_FRONT, animate, !DEFER_RESUME,
                        "moveTaskToDockedStack");
                if (moved) {
                    if (moveHomeStackFront) {
                        mStackSupervisor.moveHomeStackToFront("moveTaskToDockedStack");
                    }
                    mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS);
                }
                return moved;
+10 −0
Original line number Diff line number Diff line
@@ -1582,6 +1582,16 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
                    : STACK_INVISIBLE;
        }

        // Set home stack to invisible when it is below but not immediately below the docked stack
        // A case would be if recents stack exists but has no tasks and is below the docked stack
        // and home stack is below recents
        if (mStackId == HOME_STACK_ID) {
            int dockedStackIndex = mStacks.indexOf(mStackSupervisor.getStack(DOCKED_STACK_ID));
            if (dockedStackIndex > stackIndex && stackIndex != dockedStackIndex - 1) {
                return STACK_INVISIBLE;
            }
        }

        // Find the first stack behind front stack that actually got something visible.
        int stackBehindTopIndex = mStacks.indexOf(topStack) - 1;
        while (stackBehindTopIndex >= 0 &&
+13 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import static android.app.ActivityManager.StackId.HOME_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.app.ActivityManager.StackId.LAST_STATIC_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.app.ActivityManager.StackId.RECENTS_STACK_ID;
import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
@@ -670,6 +671,13 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
        mHomeStack.moveToFront(reason);
    }

    void moveRecentsStackToFront(String reason) {
        final ActivityStack recentsStack = getStack(RECENTS_STACK_ID);
        if (recentsStack != null) {
            recentsStack.moveToFront(reason);
        }
    }

    /** Returns true if the focus activity was adjusted to the home stack top activity. */
    boolean moveHomeStackTaskToTop(String reason) {
        mHomeStack.moveHomeStackTaskToTop();
@@ -2048,6 +2056,11 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
        if (!createStaticStackIfNeeded || !StackId.isStaticStack(stackId)) {
            return null;
        }
        if (stackId == DOCKED_STACK_ID) {
            // Make sure recents stack exist when creating a dock stack as it normally need to be on
            // the other side of the docked stack and we make visibility decisions based on that.
            getStack(RECENTS_STACK_ID, CREATE_IF_NEEDED, createOnTop);
        }
        return (T) createStackOnDisplay(stackId, DEFAULT_DISPLAY, createOnTop);
    }

Loading