From 623c9801d0f16f3f0f943e6c1d29b5df945412b9 Mon Sep 17 00:00:00 2001 From: Ben Lin Date: Fri, 2 Apr 2021 15:05:39 -0700 Subject: [PATCH] PiP: Null-check menu view when dispatching touch events to the menu. Although this should not happen, it is possible that sometimes touch events can be dispatched to the menu controller when the menu is not around (SystemUI crash, perhaps). Bug: 170707099 Test: None Change-Id: I0d0c9826b10bf9071902075f0ad51051a5009d17 --- .../android/wm/shell/pip/phone/PhonePipMenuController.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java index 65f3d3a924769..4cf8ab4768650 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java @@ -526,6 +526,10 @@ public class PhonePipMenuController implements PipMenuController { * Handles a pointer event sent from pip input consumer. */ void handlePointerEvent(MotionEvent ev) { + if (mPipMenuView == null) { + return; + } + if (ev.isTouchEvent()) { mPipMenuView.dispatchTouchEvent(ev); } else {