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

Commit 16974702 authored by Chris Li's avatar Chris Li
Browse files

Do not start change transition when the bounds size is not changed

Before, we take screenshot if the organized TaskFragment bounds is
changed. Now, we only take screenshot if the bounds size is changed.

Fix: 242666263
Test: testStartChangeTransition_doNotFreezeWhenSizeNotChanged
Change-Id: I30230024ce85482732374b57dd666d1f902b4fc3
parent fe1eba3a
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -2333,7 +2333,10 @@ class TaskFragment extends WindowContainer<WindowContainer> {
            return false;
            return false;
        }
        }


        return !startBounds.equals(getBounds());
        // Only take snapshot if the bounds are resized.
        final Rect endBounds = getConfiguration().windowConfiguration.getBounds();
        return endBounds.width() != startBounds.width()
                || endBounds.height() != startBounds.height();
    }
    }


    boolean canHaveEmbeddingActivityTransition(@NonNull ActivityRecord child) {
    boolean canHaveEmbeddingActivityTransition(@NonNull ActivityRecord child) {
+17 −0
Original line number Original line Diff line number Diff line
@@ -132,6 +132,23 @@ public class TaskFragmentTest extends WindowTestsBase {
        verify(mTransaction).setWindowCrop(mLeash, 500, 500);
        verify(mTransaction).setWindowCrop(mLeash, 500, 500);
    }
    }


    @Test
    public void testStartChangeTransition_doNotFreezeWhenOnlyMoved() {
        final Rect startBounds = new Rect(0, 0, 1000, 1000);
        final Rect endBounds = new Rect(startBounds);
        endBounds.offset(500, 0);
        mTaskFragment.setBounds(startBounds);
        doReturn(true).when(mTaskFragment).isVisible();
        doReturn(true).when(mTaskFragment).isVisibleRequested();

        clearInvocations(mTransaction);
        mTaskFragment.setBounds(endBounds);

        // No change transition, but update the organized surface position.
        verify(mTaskFragment, never()).initializeChangeTransition(any(), any());
        verify(mTransaction).setPosition(mLeash, endBounds.left, endBounds.top);
    }

    @Test
    @Test
    public void testNotOkToAnimate_doNotStartChangeTransition() {
    public void testNotOkToAnimate_doNotStartChangeTransition() {
        mockSurfaceFreezerSnapshot(mTaskFragment.mSurfaceFreezer);
        mockSurfaceFreezerSnapshot(mTaskFragment.mSurfaceFreezer);