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

Commit 4e69955c authored by Jorim Jaggi's avatar Jorim Jaggi Committed by android-build-merger
Browse files

Merge "Fix minimized dock stack for translucent activity over home task" into nyc-dev

am: 424d35c0

* commit '424d35c0':
  Fix minimized dock stack for translucent activity over home task

Change-Id: I28a5bda6e140744ceafce31837aac6d3ac6923a7
parents f176a29d 424d35c0
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -372,7 +372,7 @@ public class AppTransition implements Dump {
                topOpeningAppAnimator != null ? topOpeningAppAnimator.animation : null,
                topOpeningAppAnimator != null ? topOpeningAppAnimator.animation : null,
                topClosingAppAnimator != null ? topClosingAppAnimator.animation : null);
                topClosingAppAnimator != null ? topClosingAppAnimator.animation : null);
        mService.getDefaultDisplayContentLocked().getDockedDividerController()
        mService.getDefaultDisplayContentLocked().getDockedDividerController()
                .notifyAppTransitionStarting(openingApps, closingApps);
                .notifyAppTransitionStarting();


        // Prolong the start for the transition when docking a task from recents, unless recents
        // Prolong the start for the transition when docking a task from recents, unless recents
        // ended it already then we don't need to wait.
        // ended it already then we don't need to wait.
+21 −35
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server.wm;
package com.android.server.wm;


import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.FULLSCREEN_WORKSPACE_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.view.WindowManager.DOCKED_BOTTOM;
import static android.view.WindowManager.DOCKED_BOTTOM;
import static android.view.WindowManager.DOCKED_LEFT;
import static android.view.WindowManager.DOCKED_LEFT;
@@ -24,7 +25,6 @@ import static android.view.WindowManager.DOCKED_RIGHT;
import static android.view.WindowManager.DOCKED_TOP;
import static android.view.WindowManager.DOCKED_TOP;
import static com.android.server.wm.AppTransition.DEFAULT_APP_TRANSITION_DURATION;
import static com.android.server.wm.AppTransition.DEFAULT_APP_TRANSITION_DURATION;
import static com.android.server.wm.AppTransition.TOUCH_RESPONSE_INTERPOLATOR;
import static com.android.server.wm.AppTransition.TOUCH_RESPONSE_INTERPOLATOR;
import static com.android.server.wm.DragResizeMode.DRAG_RESIZE_MODE_DOCKED_DIVIDER;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerService.H.NOTIFY_DOCKED_STACK_MINIMIZED_CHANGED;
import static com.android.server.wm.WindowManagerService.H.NOTIFY_DOCKED_STACK_MINIMIZED_CHANGED;
@@ -33,7 +33,6 @@ import android.content.Context;
import android.graphics.Rect;
import android.graphics.Rect;
import android.os.RemoteCallbackList;
import android.os.RemoteCallbackList;
import android.os.RemoteException;
import android.os.RemoteException;
import android.util.ArraySet;
import android.util.Slog;
import android.util.Slog;
import android.view.DisplayInfo;
import android.view.DisplayInfo;
import android.view.IDockedStackListener;
import android.view.IDockedStackListener;
@@ -369,44 +368,31 @@ public class DockedStackDividerController implements DimLayerUser {
     * Notifies the docked stack divider controller of a visibility change that happens without
     * Notifies the docked stack divider controller of a visibility change that happens without
     * an animation.
     * an animation.
     */
     */
    void notifyAppVisibilityChanged(AppWindowToken wtoken, boolean visible) {
    void notifyAppVisibilityChanged() {
        final Task task = wtoken.mTask;
        checkMinimizeChanged(false /* animate */);
        if (!task.isHomeTask() || !task.isVisibleForUser()) {
            return;
        }

        // If the app that having visibility change is not the top visible one in the task,
        // it does not affect whether the docked stack is minimized, ignore it.
        if (task.getTopAppToken() == null || task.getTopAppToken() != wtoken) {
            return;
    }
    }


        // If the stack is completely offscreen, this might just be an intermediate state when
    void notifyAppTransitionStarting() {
        // docking a task/launching recents at the same time, but home doesn't actually get
        checkMinimizeChanged(true /* animate */);
        // visible after the state settles in.
        if (isWithinDisplay(task)
                && mDisplayContent.getDockedStackVisibleForUserLocked() != null) {
            setMinimizedDockedStack(visible, false /* animate */);
        }
    }
    }


    void notifyAppTransitionStarting(ArraySet<AppWindowToken> openingApps,
    private void checkMinimizeChanged(boolean animate) {
            ArraySet<AppWindowToken> closingApps) {
        final TaskStack homeStack = mDisplayContent.getHomeStack();
        if (containsHomeTaskWithinDisplay(openingApps)) {
        if (homeStack == null) {
            setMinimizedDockedStack(true /* minimized */, true /* animate */);
            return;
        } else if (containsHomeTaskWithinDisplay(closingApps)) {
            setMinimizedDockedStack(false /* minimized */, true /* animate */);
        }
    }

    private boolean containsHomeTaskWithinDisplay(ArraySet<AppWindowToken> apps) {
        for (int i = apps.size() - 1; i >= 0; i--) {
            final Task task = apps.valueAt(i).mTask;
            if (task != null && task.isHomeTask()) {
                return isWithinDisplay(task);
        }
        }
        final Task homeTask = homeStack.findHomeTask();
        if (homeTask == null || !isWithinDisplay(homeTask)) {
            return;
        }
        }
        return false;
        final TaskStack fullscreenStack
                = mService.mStackIdToStack.get(FULLSCREEN_WORKSPACE_STACK_ID);
        final ArrayList<Task> homeStackTasks = homeStack.getTasks();
        final Task topHomeStackTask = homeStackTasks.get(homeStackTasks.size() - 1);
        final boolean homeVisible = homeTask.getTopVisibleAppToken() != null;
        final boolean homeBehind = (fullscreenStack != null && fullscreenStack.isVisibleLocked())
                || (homeStackTasks.size() > 1 && topHomeStackTask != homeTask);
        setMinimizedDockedStack(homeVisible && !homeBehind, animate);
    }
    }


    private boolean isWithinDisplay(Task task) {
    private boolean isWithinDisplay(Task task) {
+14 −0
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.server.wm;


import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
import static android.app.ActivityManager.DOCKED_STACK_CREATE_MODE_TOP_OR_LEFT;
import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.HOME_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
import static android.content.res.Configuration.DENSITY_DPI_UNDEFINED;
import static android.content.res.Configuration.DENSITY_DPI_UNDEFINED;
import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
@@ -155,6 +156,19 @@ public class TaskStack implements DimLayer.DimLayerUser,
        return mTasks;
        return mTasks;
    }
    }


    Task findHomeTask() {
        if (mStackId != HOME_STACK_ID) {
            return null;
        }

        for (int i = mTasks.size() - 1; i >= 0; i--) {
            if (mTasks.get(i).isHomeTask()) {
                return mTasks.get(i);
            }
        }
        return null;
    }

    /**
    /**
     * Set the bounds of the stack and its containing tasks.
     * Set the bounds of the stack and its containing tasks.
     * @param stackBounds New stack bounds. Passing in null sets the bounds to fullscreen.
     * @param stackBounds New stack bounds. Passing in null sets the bounds to fullscreen.
+1 −1
Original line number Original line Diff line number Diff line
@@ -4348,7 +4348,7 @@ public class WindowManagerService extends IWindowManager.Stub
                // doesn't mean that it goes through the normal app transition cycle so we have
                // doesn't mean that it goes through the normal app transition cycle so we have
                // to inform the docked controller about visibility change.
                // to inform the docked controller about visibility change.
                getDefaultDisplayContentLocked().getDockedDividerController()
                getDefaultDisplayContentLocked().getDockedDividerController()
                        .notifyAppVisibilityChanged(wtoken, visible);
                        .notifyAppVisibilityChanged();
            }
            }
        }
        }