From 354c56590e75c4f47531c1195fccc4cd6f49364c Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Wed, 14 Apr 2021 10:05:58 -0700 Subject: [PATCH] View: Expose gatherTransparentRegion Recently exposed ViewRoot API requires requestTransparentRegion for many of the use cases we want to support. requestTransparentRegion is already public API, however the documentation and definition is a little confusing and arguably it shouldn't do anything unless we also implement gatherTransparentRegion. gatherTransparentRegion is already made public through SurfaceView, and so exposing it properly on View seems like a non disruptive option. Bug: 179647628 Test: android.view.cts.ViewRootSyncTest Change-Id: I72fb2744bc03cdd26d64547dbebeb12751a33a2a --- core/api/current.txt | 3 +-- core/java/android/view/View.java | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index 0639d7273dda7..b47012ccd5cea 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -48326,7 +48326,6 @@ package android.view { ctor public SurfaceView(android.content.Context, android.util.AttributeSet); ctor public SurfaceView(android.content.Context, android.util.AttributeSet, int); ctor public SurfaceView(android.content.Context, android.util.AttributeSet, int, int); - method public boolean gatherTransparentRegion(android.graphics.Region); method public android.view.SurfaceHolder getHolder(); method @Nullable public android.os.IBinder getHostToken(); method public android.view.SurfaceControl getSurfaceControl(); @@ -48527,6 +48526,7 @@ package android.view { method public android.view.View focusSearch(int); method public void forceHasOverlappingRendering(boolean); method public void forceLayout(); + method public boolean gatherTransparentRegion(@Nullable android.graphics.Region); method public void generateDisplayHash(@NonNull String, @Nullable android.graphics.Rect, @NonNull java.util.concurrent.Executor, @NonNull android.view.displayhash.DisplayHashResultCallback); method public static int generateViewId(); method public CharSequence getAccessibilityClassName(); @@ -49508,7 +49508,6 @@ package android.view { method public void endViewTransition(android.view.View); method public android.view.View focusSearch(android.view.View, int); method public void focusableViewAvailable(android.view.View); - method public boolean gatherTransparentRegion(android.graphics.Region); method protected android.view.ViewGroup.LayoutParams generateDefaultLayoutParams(); method public android.view.ViewGroup.LayoutParams generateLayoutParams(android.util.AttributeSet); method protected android.view.ViewGroup.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams); diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index bed5eea2d199b..afba492ba1926 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -26115,7 +26115,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** - * This is used by the RootView to perform an optimization when + * This is used by the ViewRoot to perform an optimization when * the view hierarchy contains one or several SurfaceView. * SurfaceView is always considered transparent, but its children are not, * therefore all View objects remove themselves from the global transparent @@ -26127,10 +26127,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * point is opaque, regardless of the transparent region; returns false * if it is possible for underlying windows to be seen behind the view. * - * {@hide} */ - @UnsupportedAppUsage - public boolean gatherTransparentRegion(Region region) { + public boolean gatherTransparentRegion(@Nullable Region region) { final AttachInfo attachInfo = mAttachInfo; if (region != null && attachInfo != null) { final int pflags = mPrivateFlags;