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. Change-Id: Ic2d87278e5c60509c39062437b548ae76959b169
This commit is contained in:
@@ -90,6 +90,9 @@ public class TouchInsetManager {
|
|||||||
final Region cumulativeRegion = Region.obtain();
|
final Region cumulativeRegion = Region.obtain();
|
||||||
|
|
||||||
mTrackedViews.stream().forEach(view -> {
|
mTrackedViews.stream().forEach(view -> {
|
||||||
|
if (!view.isAttachedToWindow()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final Rect boundaries = new Rect();
|
final Rect boundaries = new Rect();
|
||||||
view.getDrawingRect(boundaries);
|
view.getDrawingRect(boundaries);
|
||||||
((ViewGroup) view.getRootView()).offsetDescendantRectToMyCoords(view, boundaries);
|
((ViewGroup) view.getRootView()).offsetDescendantRectToMyCoords(view, boundaries);
|
||||||
|
|||||||
Reference in New Issue
Block a user