diff options
author | Lucas Silva <lusilva@google.com> | 2023-04-12 11:51:19 -0400 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-04-14 01:02:54 +0000 |
commit | adb11edb1a2bbed69798a67ed3509da6f75d578c (patch) | |
tree | c0ceeaff47eb6e8895a267914a3f1bbbd2e6b288 | |
parent | 8c57a52b1ca570133b09f12fcfc063a7fdae28ed (diff) | |
download | base-adb11edb1a2bbed69798a67ed3509da6f75d578c.tar.gz |
DO NOT MERGE Fix crash related to getting the root of an unattached view
view.getRootView returns itself when unattached, which may not be a
ViewGroup instance. Therefore trying to cast to a ViewGroup will cause a
ClassCastException. This fix avoids the exception by ensuring that the
view is attached before trying to cast the root view.
Fixes: 277637573
Test: mp droid and verified touch gestures on dream work correctly by
swiping up the bouncer, and swiping down the notification shade.
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:68cb239bb0e7129d0f415d7a3b77609ab1326a79)
Merged-In: Ic2d87278e5c60509c39062437b548ae76959b169
Change-Id: Ic2d87278e5c60509c39062437b548ae76959b169
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/touch/TouchInsetManager.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/touch/TouchInsetManager.java b/packages/SystemUI/src/com/android/systemui/touch/TouchInsetManager.java index a4f1ef4fa756..ef0fa012d56d 100644 --- a/packages/SystemUI/src/com/android/systemui/touch/TouchInsetManager.java +++ b/packages/SystemUI/src/com/android/systemui/touch/TouchInsetManager.java @@ -90,6 +90,9 @@ public class TouchInsetManager { final Region cumulativeRegion = Region.obtain(); mTrackedViews.stream().forEach(view -> { + if (!view.isAttachedToWindow()) { + return; + } final Rect boundaries = new Rect(); view.getDrawingRect(boundaries); ((ViewGroup) view.getRootView()).offsetDescendantRectToMyCoords(view, boundaries); |