From 16e58e7322fdc48d37767d155c332b15c508cfbb Mon Sep 17 00:00:00 2001 From: Yunfan Chen Date: Thu, 31 Mar 2022 17:04:21 +0900 Subject: [PATCH] Provide gesture and tappable element insets for caption Caption is covering the app region and will take gesture and tap events when the user interact with the caption. This change will make sure the app can receive the caption as a part of the tappable element insets and gesture insets to avoid the caption overlaps with interactive elements inside the window. Bug: 219987804 Bug: 209717743 Test: atest, see the bugs Change-Id: I6e48f8df6eb8f73a2f62f34109f4d80d09021929 --- core/java/android/view/InsetsState.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/java/android/view/InsetsState.java b/core/java/android/view/InsetsState.java index 75b69cb12d32..d15d7c7045e9 100644 --- a/core/java/android/view/InsetsState.java +++ b/core/java/android/view/InsetsState.java @@ -391,6 +391,17 @@ public class InsetsState implements Parcelable { processSourceAsPublicType(source, typeInsetsMap, typeSideMap, typeVisibilityMap, insets, Type.SYSTEM_GESTURES); } + if (type == Type.CAPTION_BAR) { + // Caption should also be gesture and tappable elements. This should not be needed when + // the caption is added from the shell, as the shell can add other types at the same + // time. + processSourceAsPublicType(source, typeInsetsMap, typeSideMap, typeVisibilityMap, + insets, Type.SYSTEM_GESTURES); + processSourceAsPublicType(source, typeInsetsMap, typeSideMap, typeVisibilityMap, + insets, Type.MANDATORY_SYSTEM_GESTURES); + processSourceAsPublicType(source, typeInsetsMap, typeSideMap, typeVisibilityMap, + insets, Type.TAPPABLE_ELEMENT); + } } private void processSourceAsPublicType(InsetsSource source, Insets[] typeInsetsMap,