diff options
| author | 2021-02-04 12:40:12 +0000 | |
|---|---|---|
| committer | 2021-02-04 12:40:12 +0000 | |
| commit | 9093da8884a46a01db8c7e9fe1985c7a282bf8c1 (patch) | |
| tree | 1afb4c986a54b813439dcac3f24d73c80cb5ff60 | |
| parent | 4c7adf634946d577f55518588a0a8e567c2dc0a3 (diff) | |
| parent | d84643adcc2dbbfdbe0ca92c9000b226bdbd7210 (diff) | |
Merge "Avoid detecting WebView as TYPE_RECYCLING" into sc-dev
| -rw-r--r-- | core/java/com/android/internal/view/ScrollCaptureInternal.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/core/java/com/android/internal/view/ScrollCaptureInternal.java b/core/java/com/android/internal/view/ScrollCaptureInternal.java index ae1a815910ed..4b9a1606975b 100644 --- a/core/java/com/android/internal/view/ScrollCaptureInternal.java +++ b/core/java/com/android/internal/view/ScrollCaptureInternal.java @@ -59,6 +59,11 @@ public class ScrollCaptureInternal { 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: * 1. If scrolling is possible * 2. What mechanisms are used for scrolling. @@ -95,8 +100,15 @@ public class ScrollCaptureInternal { } 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) { - 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. if (view.getScrollY() != 0) { |