Merge "Do not start change transition when the bounds size is not changed" into tm-qpr-dev

This commit is contained in:
Chris Li
2022-08-19 00:22:56 +00:00
committed by Android (Google) Code Review
2 changed files with 21 additions and 1 deletions

View File

@@ -2340,7 +2340,10 @@ class TaskFragment extends WindowContainer<WindowContainer> {
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) {

View File

@@ -133,6 +133,23 @@ public class TaskFragmentTest extends WindowTestsBase {
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
public void testNotOkToAnimate_doNotStartChangeTransition() {
mockSurfaceFreezerSnapshot(mTaskFragment.mSurfaceFreezer);