Provide mandatory gesture insets from the shell caption

This change let the shell caption provide the mandatory gesture insets.
However, note that, due to the lack of relavant insets support for the
shell insets yet, the insets may be unstable during drag-resizing or
drag-moving. Though as the caption insets is there, it should not be a
big issue, and for long term we can get rid of the hack to let the
insets be stable during drag events. This change doesn't contain the
hack for mandatory gesture insets.

Bug: 197277883
Test: WindowInsetsPolicyTest with CAPTION_ON_SHELL enabled
Change-Id: Ifb482311162ef167b4e2d8a375974b7696f9d28c
This commit is contained in:
Yunfan Chen
2023-05-23 17:30:53 +09:00
parent dfb4a448e6
commit 37bff76c4a
2 changed files with 7 additions and 1 deletions

View File

@@ -248,6 +248,9 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer>
mCaptionInsetsRect.bottom = mCaptionInsetsRect.top + captionHeight + params.mCaptionY;
wct.addInsetsSource(mTaskInfo.token,
mOwner, 0 /* index */, WindowInsets.Type.captionBar(), mCaptionInsetsRect);
wct.addInsetsSource(mTaskInfo.token,
mOwner, 0 /* index */, WindowInsets.Type.mandatorySystemGestures(),
mCaptionInsetsRect);
} else {
startT.hide(mCaptionContainerSurface);
}
@@ -345,6 +348,8 @@ public abstract class WindowDecoration<T extends View & TaskFocusStateConsumer>
final WindowContainerTransaction wct = mWindowContainerTransactionSupplier.get();
wct.removeInsetsSource(mTaskInfo.token,
mOwner, 0 /* index */, WindowInsets.Type.captionBar());
wct.removeInsetsSource(mTaskInfo.token,
mOwner, 0 /* index */, WindowInsets.Type.mandatorySystemGestures());
mTaskOrganizer.applyTransaction(wct);
}

View File

@@ -316,7 +316,8 @@ public class WindowDecorationTests extends ShellTestCase {
releaseOrder.verify(t).remove(captionContainerSurface);
releaseOrder.verify(t).remove(decorContainerSurface);
releaseOrder.verify(t).apply();
verify(mMockWindowContainerTransaction)
// Expect to remove two insets sources, the caption insets and the mandatory gesture insets.
verify(mMockWindowContainerTransaction, Mockito.times(2))
.removeInsetsSource(eq(taskInfo.token), any(), anyInt(), anyInt());
}