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

Commit 15ead903 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Some code clean-up in WindowManager.

- Renamed DisplayContent.findTaskForControlPoint to
DisplayContent.findTaskForResizePoint as it is trying to find a task
from the resize point.
- Renamed DisplayContent.checkForDeferredActions to
DisplayContent.onCompleteDeferredRemoval as the method removes containers
whose removal were deferred.
- Added methods TaskStack.hasMultipleTaskWithHomeTaskNotTop() and
topTaskIsOnTopLauncher()
- And some other minor clean-up relating to me trying to break-up a big CL.

Change-Id: I64d03cbd9ee69bf8fa0013a49283cd434b7c8fbe
parent de72d8cb
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -383,8 +383,8 @@ public class AppWindowAnimator {
            return false;
        }

        mAnimator.setAppLayoutChanges(this, WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM,
                "AppWindowToken", displayId);
        mAppToken.setAppLayoutChanges(
                WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM, "AppWindowToken", displayId);

        clearAnimation();
        animating = false;
@@ -397,8 +397,7 @@ public class AppWindowAnimator {
            mService.moveInputMethodWindowsIfNeededLocked(true);
        }

        if (DEBUG_ANIM) Slog.v(TAG,
                "Animation done in " + mAppToken
        if (DEBUG_ANIM) Slog.v(TAG, "Animation done in " + mAppToken
                + ": reportedVisible=" + mAppToken.reportedVisible);

        transformation.clear();
+2 −2
Original line number Diff line number Diff line
@@ -331,7 +331,7 @@ class DisplayContent {
     * Find the task whose outside touch area (for resizing) (x, y) falls within.
     * Returns null if the touch doesn't fall into a resizing area.
     */
    Task findTaskForControlPoint(int x, int y) {
    Task findTaskForResizePoint(int x, int y) {
        final int delta = mService.dipToPixel(RESIZE_HANDLE_WIDTH_IN_DP, mDisplayMetrics);
        for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
            TaskStack stack = mStacks.get(stackNdx);
@@ -498,7 +498,7 @@ class DisplayContent {
        return false;
    }

    void checkForDeferredActions() {
    void onCompleteDeferredRemoval() {
        boolean animating = false;
        for (int stackNdx = mStacks.size() - 1; stackNdx >= 0; --stackNdx) {
            final TaskStack stack = mStacks.get(stackNdx);
+2 −4
Original line number Diff line number Diff line
@@ -538,15 +538,13 @@ public class DockedStackDividerController implements DimLayerUser {
        }
        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.isVisible())
                || (homeStackTasks.size() > 1 && topHomeStackTask != homeTask);
                || (homeStack.hasMultipleTaskWithHomeTaskNotTop());
        // If the home task is an on-top launcher, we don't want to minimize the docked stack.
        // Instead we want everything underneath that was visible to remain visible.
        // See android.R.attr#onTopLauncher.
        final boolean isOnTopLauncher = topHomeStackTask.isOnTopLauncher();
        final boolean isOnTopLauncher = homeStack.topTaskIsOnTopLauncher();
        setMinimizedDockedStack(homeVisible && !homeBehind && !isOnTopLauncher, animate);
    }

+8 −0
Original line number Diff line number Diff line
@@ -161,6 +161,14 @@ public class TaskStack implements DimLayer.DimLayerUser,
        return null;
    }

    boolean hasMultipleTaskWithHomeTaskNotTop() {
        return mTasks.size() > 1 && !mTasks.get(mTasks.size() - 1).isHomeTask();
    }

    boolean topTaskIsOnTopLauncher() {
        return mTasks.get(mTasks.size() - 1).isOnTopLauncher();
    }

    /**
     * Set the bounds of the stack and its containing tasks.
     * @param stackBounds New stack bounds. Passing in null sets the bounds to fullscreen.
+1 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ public class TaskTapPointerEventListener implements PointerEventListener {
            case MotionEvent.ACTION_HOVER_MOVE: {
                final int x = (int) motionEvent.getX();
                final int y = (int) motionEvent.getY();
                final Task task = mDisplayContent.findTaskForControlPoint(x, y);
                final Task task = mDisplayContent.findTaskForResizePoint(x, y);
                int iconType = TYPE_NOT_SPECIFIED;
                if (task != null) {
                    task.getDimBounds(mTmpRect);
Loading