From a028cd11bad2941eb73559d616a51cd2ddf4429a Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Mon, 23 Oct 2023 13:02:30 -0400 Subject: [PATCH] Fix NPE in overview action buttons Flag: N/A Fixes: 305894735 Test: pressed screenshot overview action button shortly before/after dismissing the current task Change-Id: Ife93fa9af5416af60cf8ae24275f14bd6857901a --- .../com/android/quickstep/TaskOverlayFactory.java | 12 +++++++----- .../src/com/android/quickstep/views/TaskView.java | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java index cf74b7d46a..312cdc97a5 100644 --- a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java +++ b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java @@ -190,11 +190,11 @@ public class TaskOverlayFactory implements ResourceBasedOverride { */ public void endLiveTileMode(@NonNull Runnable callback) { RecentsView recentsView = mThumbnailView.getTaskView().getRecentsView(); - if (recentsView != null) { - recentsView.switchToScreenshot( - () -> recentsView.finishRecentsAnimation(true /* toRecents */, - false /* shouldPip */, callback)); - } + // Task has already been dismissed + if (recentsView == null) return; + recentsView.switchToScreenshot( + () -> recentsView.finishRecentsAnimation(true /* toRecents */, + false /* shouldPip */, callback)); } /** @@ -212,6 +212,8 @@ public class TaskOverlayFactory implements ResourceBasedOverride { private void enterSplitSelect() { RecentsView overviewPanel = mThumbnailView.getTaskView().getRecentsView(); + // Task has already been dismissed + if (overviewPanel == null) return; overviewPanel.initiateSplitSelect(mThumbnailView.getTaskView()); } diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index beb10ef82d..fec17b44a2 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -1677,6 +1677,7 @@ public class TaskView extends FrameLayout implements Reusable { return super.performAccessibilityAction(action, arguments); } + @Nullable public RecentsView getRecentsView() { return (RecentsView) getParent(); }