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

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

Merge "Avoid flicker by finishing recents animation with config change" into rvc-dev

parents f3772755 72d6dc3b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -3209,7 +3209,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
            if (mode == UPDATE_FOCUS_PLACING_SURFACES) {
                performLayout(true /*initial*/, updateInputWindows);
            } else if (mode == UPDATE_FOCUS_REMOVING_FOCUS) {
                mWmService.mRoot.performSurfacePlacement(false);
                mWmService.mRoot.performSurfacePlacement();
            }
        }

@@ -3846,7 +3846,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
    }

    // TODO: Super crazy long method that should be broken down...
    void applySurfaceChangesTransaction(boolean recoveringMemory) {
    void applySurfaceChangesTransaction() {
        final WindowSurfacePlacer surfacePlacer = mWmService.mWindowPlacerLocked;

        mTmpUpdateAllDrawn.clear();
+6 −0
Original line number Diff line number Diff line
@@ -400,6 +400,12 @@ class RecentsAnimation implements RecentsAnimationCallbacks,
                    throw e;
                } finally {
                    mService.continueWindowLayout();
                    // Make sure the surfaces are updated with the latest state. Sometimes the
                    // surface placement may be skipped if display configuration is changed (i.e.
                    // {@link DisplayContent#mWaitingForConfig} is true).
                    if (mWindowManager.mRoot.isLayoutNeeded()) {
                        mWindowManager.mRoot.performSurfacePlacement();
                    }
                    Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
                }
            });
+6 −6
Original line number Diff line number Diff line
@@ -796,10 +796,10 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
        return leakedSurface || killedApps;
    }

    void performSurfacePlacement(boolean recoveringMemory) {
    void performSurfacePlacement() {
        Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "performSurfacePlacement");
        try {
            performSurfacePlacementNoTrace(recoveringMemory);
            performSurfacePlacementNoTrace();
        } finally {
            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
        }
@@ -807,7 +807,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>

    // "Something has changed!  Let's make it correct now."
    // TODO: Super crazy long method that should be broken down...
    void performSurfacePlacementNoTrace(boolean recoveringMemory) {
    void performSurfacePlacementNoTrace() {
        if (DEBUG_WINDOW_TRACE) Slog.v(TAG, "performSurfacePlacementInner: entry. Called by "
                + Debug.getCallers(3));

@@ -842,7 +842,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
        Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "applySurfaceChanges");
        mWmService.openSurfaceTransaction();
        try {
            applySurfaceChangesTransaction(recoveringMemory);
            applySurfaceChangesTransaction();
        } catch (RuntimeException e) {
            Slog.wtf(TAG, "Unhandled exception in Window Manager", e);
        } finally {
@@ -1042,7 +1042,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
        }
    }

    private void applySurfaceChangesTransaction(boolean recoveringMemory) {
    private void applySurfaceChangesTransaction() {
        mHoldScreenWindow = null;
        mObscuringWindow = null;

@@ -1065,7 +1065,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
        final int count = mChildren.size();
        for (int j = 0; j < count; ++j) {
            final DisplayContent dc = mChildren.get(j);
            dc.applySurfaceChangesTransaction(recoveringMemory);
            dc.applySurfaceChangesTransaction();
        }

        // Give the display manager a chance to adjust properties like display rotation if it needs
+1 −3
Original line number Diff line number Diff line
@@ -157,9 +157,7 @@ class WindowSurfacePlacer {

        mInLayout = true;

        boolean recoveringMemory = false;
        if (!mService.mForceRemoves.isEmpty()) {
            recoveringMemory = true;
            // Wait a little bit for things to settle down, and off we go.
            while (!mService.mForceRemoves.isEmpty()) {
                final WindowState ws = mService.mForceRemoves.remove(0);
@@ -177,7 +175,7 @@ class WindowSurfacePlacer {
        }

        try {
            mService.mRoot.performSurfacePlacement(recoveringMemory);
            mService.mRoot.performSurfacePlacement();

            mInLayout = false;

+1 −3
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import static android.view.WindowManager.TRANSIT_KEYGUARD_UNOCCLUDE;

import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;

import static com.android.dx.mockito.inline.extended.ExtendedMockito.anyBoolean;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;

@@ -38,7 +37,6 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;

import android.graphics.Rect;
import android.os.IBinder;
import android.os.RemoteException;
import android.platform.test.annotations.Presubmit;
@@ -70,7 +68,7 @@ public class AppTransitionTests extends WindowTestsBase {

    @Before
    public void setUp() throws Exception {
        doNothing().when(mWm.mRoot).performSurfacePlacement(anyBoolean());
        doNothing().when(mWm.mRoot).performSurfacePlacement();
        mDc = mWm.getDefaultDisplayContentLocked();
    }

Loading