From 8b62e317efc090e91212fad6731d33c2e7fde126 Mon Sep 17 00:00:00 2001 From: Kevin Date: Tue, 14 May 2019 14:46:35 -0700 Subject: [PATCH] Fix legacy recents crash on Go devices Go does not have PIP enabled and thus does not put the PipUI component when starting up System UI service componenets. However, as part of moving things to legacy recents, we are now always listening to PIP menu events even with the feature disabled and we hit a NPE since we get a null component. This CL adds a simple null check and backs out if we don't have the component. Bug: 132703125 Test: No longer crashes on KB3 Go device Change-Id: I55e4fc30dc392a8052850a726e756b03fd4c91f6 --- .../src/com/android/systemui/recents/LegacyRecentsImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/LegacyRecentsImpl.java b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/LegacyRecentsImpl.java index b7bb751c1582c..a150de95fcf0f 100644 --- a/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/LegacyRecentsImpl.java +++ b/packages/SystemUI/legacy/recents/src/com/android/systemui/recents/LegacyRecentsImpl.java @@ -662,11 +662,17 @@ public class LegacyRecentsImpl implements RecentsImplementation { public final void onBusEvent(ExpandPipEvent event) { PipUI pipUi = getComponent(PipUI.class); + if (pipUi == null) { + return; + } pipUi.expandPip(); } public final void onBusEvent(HidePipMenuEvent event) { PipUI pipUi = getComponent(PipUI.class); + if (pipUi == null) { + return; + } event.getAnimationTrigger().increment(); pipUi.hidePipMenu(() -> { event.getAnimationTrigger().increment();