From 59eaf312d5f0ec250adfe7aa60b79ee2cbdddb2c Mon Sep 17 00:00:00 2001 From: "sai.gairuboina-IN009276" Date: Sat, 24 Jun 2023 22:32:51 +0530 Subject: [PATCH] Avoid CalledFromWrongThreadException in BubbleController Problem: { 1.CalledFromWrongThreadException can happen if OneHandedTransitionCallback is called from another thread } Solution: { 1. Update the views in UI thread to avoid CalledFromWrongThreadException } Bug: 288588813 Change-Id: I23f535f89be9a14491d19dd16ec844d946dc486a --- .../wm/shell/bubbles/BubbleController.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 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 dd8afff0df2cf..805d1efead578 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 @@ -277,16 +277,20 @@ public class BubbleController implements ConfigurationChangeListener { new OneHandedTransitionCallback() { @Override public void onStartFinished(Rect bounds) { - if (mStackView != null) { - mStackView.onVerticalOffsetChanged(bounds.top); - } + mMainExecutor.execute(() -> { + if (mStackView != null) { + mStackView.onVerticalOffsetChanged(bounds.top); + } + }); } @Override public void onStopFinished(Rect bounds) { - if (mStackView != null) { - mStackView.onVerticalOffsetChanged(bounds.top); - } + mMainExecutor.execute(() -> { + if (mStackView != null) { + mStackView.onVerticalOffsetChanged(bounds.top); + } + }); } }); }