diff options
| author | 2019-09-04 00:49:17 -0700 | |
|---|---|---|
| committer | 2019-09-04 00:49:17 -0700 | |
| commit | b3bd7b19bd21b4e1b3c1fa17cac44abdeee52f2c (patch) | |
| tree | 7ccd134142793a1159d604047797fd48443ee554 | |
| parent | 87617a9b164ed036a57f0c62154d5880ef781ea9 (diff) | |
| parent | 368b3679d4b260cb9ebdc31f50409d3eed48f6a3 (diff) | |
Merge "Fix regression in updating gesture exclusion rects" into qt-qpr1-dev am: b85d750900
am: 368b3679d4
Change-Id: I0ec22203b34b8e6a2ede43c97fa8b9fdbfbc7456
| -rw-r--r-- | core/java/android/view/GestureExclusionTracker.java | 4 | ||||
| -rw-r--r-- | core/java/android/view/View.java | 14 |
2 files changed, 14 insertions, 4 deletions
diff --git a/core/java/android/view/GestureExclusionTracker.java b/core/java/android/view/GestureExclusionTracker.java index fcc14c196730..fffb323e6d50 100644 --- a/core/java/android/view/GestureExclusionTracker.java +++ b/core/java/android/view/GestureExclusionTracker.java @@ -44,7 +44,7 @@ class GestureExclusionTracker { while (i.hasNext()) { final GestureExclusionViewInfo info = i.next(); final View v = info.getView(); - if (v == null || !v.isAttachedToWindow() || !v.isShown()) { + if (v == null || !v.isAttachedToWindow() || !v.isAggregatedVisible()) { mGestureExclusionViewsChanged = true; i.remove(); continue; @@ -123,7 +123,7 @@ class GestureExclusionTracker { public int update() { final View excludedView = getView(); if (excludedView == null || !excludedView.isAttachedToWindow() - || !excludedView.isShown()) return GONE; + || !excludedView.isAggregatedVisible()) return GONE; final List<Rect> localRects = excludedView.getSystemGestureExclusionRects(); final List<Rect> newRects = new ArrayList<>(localRects.size()); for (Rect src : localRects) { diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 6ce712061db0..8c8b9d34f876 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -14324,6 +14324,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } /** + * @return true if this view and all ancestors are visible as of the last + * {@link #onVisibilityAggregated(boolean)} call. + */ + boolean isAggregatedVisible() { + return (mPrivateFlags3 & PFLAG3_AGGREGATED_VISIBLE) != 0; + } + + /** * Internal dispatching method for {@link #onVisibilityAggregated}. Overridden by * ViewGroup. Intended to only be called when {@link #isAttachedToWindow()}, * {@link #getWindowVisibility()} is {@link #VISIBLE} and this view's parent {@link #isShown()}. @@ -14351,7 +14359,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, @CallSuper public void onVisibilityAggregated(boolean isVisible) { // Update our internal visibility tracking so we can detect changes - boolean oldVisible = (mPrivateFlags3 & PFLAG3_AGGREGATED_VISIBLE) != 0; + boolean oldVisible = isAggregatedVisible(); mPrivateFlags3 = isVisible ? (mPrivateFlags3 | PFLAG3_AGGREGATED_VISIBLE) : (mPrivateFlags3 & ~PFLAG3_AGGREGATED_VISIBLE); if (isVisible && mAttachInfo != null) { @@ -14403,7 +14411,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } notifyAppearedOrDisappearedForContentCaptureIfNeeded(isVisible); - updateSystemGestureExclusionRects(); + if (isVisible != oldVisible) { + updateSystemGestureExclusionRects(); + } } /** |