From f953c122fc23ec82c33db7e57374768243dc7373 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Tue, 11 Jun 2024 14:30:01 -0700 Subject: [PATCH] Use main executor directly In some tests runs mMainExector could be null, using it directly resolves this. Flag: com.android.wm.shell.enable_bubble_bar Test: treehugger Bug: 347010157 Change-Id: I05879da895739087971a5bfe920d8c1b190f0b44 --- .../launcher3/taskbar/bubbles/BubbleBarController.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java index 046f5b6afe..028df34c73 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java @@ -135,7 +135,6 @@ public class BubbleBarController extends IBubblesListener.Stub { private static final Executor BUBBLE_STATE_EXECUTOR = Executors.newSingleThreadExecutor( new SimpleThreadFactory("BubbleStateUpdates-", THREAD_PRIORITY_BACKGROUND)); - private final Executor mMainExecutor; private final LauncherApps mLauncherApps; private final BubbleIconFactory mIconFactory; private final SystemUiProxy mSystemUiProxy; @@ -198,7 +197,6 @@ public class BubbleBarController extends IBubblesListener.Stub { if (sBubbleBarEnabled) { mSystemUiProxy.setBubblesListener(this); } - mMainExecutor = MAIN_EXECUTOR; mLauncherApps = context.getSystemService(LauncherApps.class); mIconFactory = new BubbleIconFactory(context, context.getResources().getDimensionPixelSize(R.dimen.bubblebar_icon_size), @@ -241,7 +239,7 @@ public class BubbleBarController extends IBubblesListener.Stub { private void createAndAddOverflowIfNeeded() { if (mOverflowBubble == null) { BubbleBarOverflow overflow = createOverflow(mContext); - mMainExecutor.execute(() -> { + MAIN_EXECUTOR.execute(() -> { // we're on the main executor now, so check that the overflow hasn't been created // again to avoid races. if (mOverflowBubble == null) { @@ -303,12 +301,12 @@ public class BubbleBarController extends IBubblesListener.Stub { } viewUpdate.currentBubbles = currentBubbles; } - mMainExecutor.execute(() -> applyViewChanges(viewUpdate)); + MAIN_EXECUTOR.execute(() -> applyViewChanges(viewUpdate)); }); } else { // No bubbles to load, immediately apply the changes. BUBBLE_STATE_EXECUTOR.execute( - () -> mMainExecutor.execute(() -> applyViewChanges(viewUpdate))); + () -> MAIN_EXECUTOR.execute(() -> applyViewChanges(viewUpdate))); } } @@ -496,7 +494,7 @@ public class BubbleBarController extends IBubblesListener.Stub { @Override public void animateBubbleBarLocation(BubbleBarLocation bubbleBarLocation) { - mMainExecutor.execute( + MAIN_EXECUTOR.execute( () -> mBubbleBarViewController.animateBubbleBarLocation(bubbleBarLocation)); }