From 065c12c764f402724a5c6a325a9d44ed3140eaec Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Mon, 5 Jun 2023 18:33:14 -0400 Subject: [PATCH] Update BubbleViewInfoTask to verify that the state hasn't changed after the task was scheduled or while it is running. Without this there is a race condition that causes the task to inflate a bubble incorrectly, e.g. without a dot path, which then leads to an NPE trying to render the dot. Bug: 269670598 Test: Tested on a physical device Change-Id: Ib2cbd4ef0fd2a33766620a0997f130eb4b8bb86f --- .../wm/shell/bubbles/BubbleViewInfoTask.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewInfoTask.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewInfoTask.java index 3a46797d4a3d1..80e29998e8d3d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewInfoTask.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewInfoTask.java @@ -104,7 +104,11 @@ public class BubbleViewInfoTask extends AsyncTask { + if (!verifyState()) { + return; + } mBubble.setViewInfo(viewInfo); if (mCallback != null) { mCallback.onBubbleViewsReady(mBubble); @@ -126,6 +134,14 @@ public class BubbleViewInfoTask extends AsyncTask