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

Commit c662d8e9 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Make sure we call reportResized exactly once when drag starting

If there was another layout happening before the app called
relayoutWindow(), we were issuing multiple reportResized calls,
leading to multiple relayoutWindow() calls, slowing everything
down.

Change-Id: I1f3da04bb7581c655567e1d1a6fe0f8c83c0ffda
parent 8e1206bf
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -1606,10 +1606,6 @@ public final class ViewRootImpl implements ViewParent,
                        frame.height() < desiredWindowHeight && frame.height() != mHeight));
        windowShouldResize |= mDragResizing && mResizeMode == RESIZE_MODE_FREEFORM;

        // If the backdrop frame doesn't equal to a frame, we are starting a resize operation, so
        // force it to be resized.
        windowShouldResize |= !mPendingBackDropFrame.equals(mWinFrame);

        // If the activity was just relaunched, it might have unfrozen the task bounds (while
        // relaunching), so we need to force a call into window manager to pick up the latest
        // bounds.
+13 −1
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ import android.view.SurfaceControl;

import com.android.server.wm.DimLayer.DimLayerUser;

import java.util.ArrayList;

import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
import static android.app.ActivityManager.StackId.INVALID_STACK_ID;
import static android.view.WindowManager.DOCKED_BOTTOM;
@@ -77,7 +79,17 @@ public class DockedStackDividerController implements DimLayerUser {
    }

    void setResizing(boolean resizing) {
        if (mResizing != resizing) {
            mResizing = resizing;
            resetDragResizingChangeReported();
        }
    }

    private void resetDragResizingChangeReported() {
        final WindowList windowList = mDisplayContent.getWindowList();
        for (int i = windowList.size() - 1; i >= 0; i--) {
            windowList.get(i).resetDragResizingChangeReported();
        }
    }

    void setWindow(WindowState window) {
+14 −1
Original line number Diff line number Diff line
@@ -536,7 +536,20 @@ class Task implements DimLayer.DimLayerUser {
    }

    void setDragResizing(boolean dragResizing) {
        if (mDragResizing != dragResizing) {
            mDragResizing = dragResizing;
            resetDragResizingChangeReported();
        }
    }

    void resetDragResizingChangeReported() {
        for (int activityNdx = mAppTokens.size() - 1; activityNdx >= 0; --activityNdx) {
            final ArrayList<WindowState> windows = mAppTokens.get(activityNdx).allAppWindows;
            for (int winNdx = windows.size() - 1; winNdx >= 0; --winNdx) {
                final WindowState win = windows.get(winNdx);
                win.resetDragResizingChangeReported();
            }
        }
    }

    boolean isDragResizing() {
+13 −3
Original line number Diff line number Diff line
@@ -919,6 +919,16 @@ public class TaskStack implements DimLayer.DimLayerUser,
        return mDragResizing;
    }

    private void setDragResizingLocked(boolean resizing) {
        if (mDragResizing == resizing) {
            return;
        }
        mDragResizing = resizing;
        for (int i = mTasks.size() - 1; i >= 0 ; i--) {
            mTasks.get(i).resetDragResizingChangeReported();
        }
    }

    @Override  // AnimatesBounds
    public boolean setSize(Rect bounds) {
        synchronized (mService.mWindowMap) {
@@ -936,14 +946,14 @@ public class TaskStack implements DimLayer.DimLayerUser,
    @Override  // AnimatesBounds
    public void onAnimationStart() {
        synchronized (mService.mWindowMap) {
            mDragResizing = true;
            setDragResizingLocked(true);
        }
    }

    @Override  // AnimatesBounds
    public void onAnimationEnd() {
        synchronized (mService.mWindowMap) {
            mDragResizing = false;
            setDragResizingLocked(false);
            mService.requestTraversal();
        }
        if (mStackId == PINNED_STACK_ID) {
+2 −1
Original line number Diff line number Diff line
@@ -8839,7 +8839,8 @@ public class WindowManagerService extends IWindowManager.Stub
                Slog.v(TAG_WM, "Win " + w + " config changed: "
                        + mCurConfiguration);
            }
            final boolean dragResizingChanged = w.isDragResizeChanged();
            final boolean dragResizingChanged = w.isDragResizeChanged()
                    && !w.isDragResizingChangeReported();
            if (localLOGV) Slog.v(TAG_WM, "Resizing " + w
                    + ": configChanged=" + configChanged
                    + " dragResizingChanged=" + dragResizingChanged
Loading