Remove Dependency.get(MAIN_HANDLER) from NavigationBarFragment
Bug: 144503618
Test: atest SystemUITests
Change-Id: Ifeaf037898ec0e20dd056d87468cea9cbb6c65a6
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
index 2674db4..116162d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
@@ -89,11 +89,11 @@
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.util.LatencyTracker;
import com.android.internal.view.AppearanceRegion;
-import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.assist.AssistHandleViewController;
import com.android.systemui.assist.AssistManager;
import com.android.systemui.broadcast.BroadcastDispatcher;
+import com.android.systemui.dagger.qualifiers.MainHandler;
import com.android.systemui.fragments.FragmentHostManager;
import com.android.systemui.fragments.FragmentHostManager.FragmentListener;
import com.android.systemui.model.SysUiState;
@@ -196,7 +196,7 @@
@Nullable
private AssistHandleViewController mAssistHandlerViewController;
- private Handler mHandler = Dependency.get(Dependency.MAIN_HANDLER);
+ private final Handler mHandler;
private final OverviewProxyListener mOverviewProxyListener = new OverviewProxyListener() {
@Override
@@ -271,7 +271,8 @@
SysUiState sysUiFlagsContainer,
BroadcastDispatcher broadcastDispatcher,
CommandQueue commandQueue, Divider divider,
- Optional<Recents> recentsOptional, Lazy<StatusBar> statusBarLazy) {
+ Optional<Recents> recentsOptional, Lazy<StatusBar> statusBarLazy,
+ @MainHandler Handler mainHandler) {
mAccessibilityManagerWrapper = accessibilityManagerWrapper;
mDeviceProvisionedController = deviceProvisionedController;
mStatusBarStateController = statusBarStateController;
@@ -287,6 +288,7 @@
mCommandQueue = commandQueue;
mDivider = divider;
mRecentsOptional = recentsOptional;
+ mHandler = mainHandler;
}
// ----- Fragment Lifecycle Callbacks -----
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarFragmentTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarFragmentTest.java
index 4e5ec1d..0df2ebc8 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarFragmentTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NavigationBarFragmentTest.java
@@ -253,7 +253,8 @@
mCommandQueue,
mDivider,
Optional.of(mRecents),
- () -> mock(StatusBar.class));
+ () -> mock(StatusBar.class),
+ mHandler);
}
private class HostCallbacksForExternalDisplay extends