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
This commit is contained in:
Mady Mellor
2024-06-11 14:30:01 -07:00
parent 590e662d70
commit f953c122fc

View File

@@ -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));
}