Merge "Avoid detecting WebView as TYPE_RECYCLING" into sc-dev

This commit is contained in:
TreeHugger Robot
2021-02-04 12:40:12 +00:00
committed by Android (Google) Code Review

View File

@@ -58,6 +58,11 @@ public class ScrollCaptureInternal {
*/ */
public static final int TYPE_RECYCLING = 2; public static final int TYPE_RECYCLING = 2;
/**
* The ViewGroup scrolls, but has no child views in
*/
private static final int TYPE_OPAQUE = 3;
/** /**
* Performs tests on the given View and determines: * Performs tests on the given View and determines:
* 1. If scrolling is possible * 1. If scrolling is possible
@@ -95,8 +100,15 @@ public class ScrollCaptureInternal {
} }
return TYPE_RECYCLING; return TYPE_RECYCLING;
} }
// At least one child view is required.
if (((ViewGroup) view).getChildCount() < 1) {
if (DEBUG_VERBOSE) {
Log.v(TAG, "scrollable with no children");
}
return TYPE_OPAQUE;
}
if (DEBUG_VERBOSE) { if (DEBUG_VERBOSE) {
Log.v(TAG, "hint: less than two child views"); Log.v(TAG, "hint: single child view");
} }
//Because recycling containers don't use scrollY, a non-zero value means Scroll view. //Because recycling containers don't use scrollY, a non-zero value means Scroll view.
if (view.getScrollY() != 0) { if (view.getScrollY() != 0) {