From 4f031ef692c152252cdee4ed5ceb82a22b0cfe4b Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Tue, 11 Mar 2025 16:30:39 -0700 Subject: Fix some crashes when going between fold / unfold with bubble bar There were two issues here: 1 - that the current task view listener could be unset, so check for that and use the value on the bubbleTaskView in that case. 2 - the post delay call we have assumes that we'll have stackview, which is the case in prod, but not with bubble bar. Flag: EXEMPT trivial bug fixesi Test: atest BubbleExpandedViewTest Test: manual - expand a bubble while folded, unfold => observe nothing crashes Bug: 402550443 Change-Id: I4aa35c7cc29dbec052a082232636cc862d1e2608 --- .../Shell/src/com/android/wm/shell/bubbles/BubbleController.java | 6 +++++- .../src/com/android/wm/shell/bubbles/BubbleExpandedView.java | 9 ++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java index 60573965208a..81eff6f7399a 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java @@ -1306,7 +1306,11 @@ public class BubbleController implements ConfigurationChangeListener, // TODO b/392893178: Merge the unfold and the task view transition so that we don't // have to post a delayed runnable to the looper to update the bounds if (mStackView.isExpanded()) { - mStackView.postDelayed(() -> mStackView.updateExpandedView(), 500); + mStackView.postDelayed(() -> { + if (mStackView != null) { + mStackView.updateExpandedView(); + } + } , 500); } } if (newConfig.fontScale != mFontScale) { diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java index cbd1e9671825..426c3ee5b853 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleExpandedView.java @@ -468,9 +468,12 @@ public class BubbleExpandedView extends LinearLayout { public void onTaskCreated() { // The taskId is saved to use for removeTask, // preventing appearance in recent tasks. - mTaskId = ((BubbleTaskViewListener) mCurrentTaskViewListener) - .getTaskId(); - + BubbleTaskViewListener listener = mCurrentTaskViewListener != null + ? ((BubbleTaskViewListener) mCurrentTaskViewListener) + : null; + mTaskId = listener != null + ? listener.getTaskId() + : bubbleTaskView.getTaskId(); setContentVisibility(true); } -- cgit v1.2.3-59-g8ed1b