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

Commit 8cc072a3 authored by Jorge Gil's avatar Jorge Gil
Browse files

Delay creation of ResizeVeil until it needs to be shown

Creating the resize veil when the window decoration is created is
somewhat wasteful (fullscreen/split tasks don't need it) and causes
jank.

Bug: 335975211
Test: manual - enter desktop from fullscreen from app handle drag,
handle menu button, also do freeform drag-resizing and maximize
resizing, all should show the veil as usual

Change-Id: I74a2acc1442efdc78993cf8fb9c852e2d8777b9f
parent e6e6fb89
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -1037,7 +1037,6 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel {
                        mSyncQueue,
                        mRootTaskDisplayAreaOrganizer);
        mWindowDecorByTaskId.put(taskInfo.taskId, windowDecoration);
        windowDecoration.createResizeVeil();

        final DragPositioningCallback dragPositioningCallback;
        if (!DesktopModeStatus.isVeiledResizeEnabled()) {
+4 −1
Original line number Diff line number Diff line
@@ -487,7 +487,8 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
     * Create the resize veil for this task. Note the veil's visibility is View.GONE by default
     * until a resize event calls showResizeVeil below.
     */
    void createResizeVeil() {
    private void createResizeVeilIfNeeded() {
        if (mResizeVeil != null) return;
        mResizeVeil = new ResizeVeil(mContext, mDisplayController, mAppIconBitmap, mTaskInfo,
                mTaskSurface, mSurfaceControlTransactionSupplier);
    }
@@ -496,6 +497,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
     * Show the resize veil.
     */
    public void showResizeVeil(Rect taskBounds) {
        createResizeVeilIfNeeded();
        mResizeVeil.showVeil(mTaskSurface, taskBounds);
    }

@@ -503,6 +505,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
     * Show the resize veil.
     */
    public void showResizeVeil(SurfaceControl.Transaction tx, Rect taskBounds) {
        createResizeVeilIfNeeded();
        mResizeVeil.showVeil(tx, mTaskSurface, taskBounds, false /* fadeIn */);
    }

+1 −1
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ class VeiledResizeTaskPositionerTest : ShellTestCase() {
        rectAfterEnd.top += 20
        rectAfterEnd.bottom += 20

        verify(mockDesktopWindowDecoration, never()).createResizeVeil()
        verify(mockDesktopWindowDecoration, never()).showResizeVeil(any())
        verify(mockDesktopWindowDecoration, never()).hideResizeVeil()
        verify(mockTransitions).startTransition(eq(TRANSIT_CHANGE), argThat { wct ->
            return@argThat wct.changes.any { (token, change) ->