Merge changes I2f464b39,Iba887b06,I20fbf998 into main

* changes:
  Remove flag dependency of `status_bar_connected_displays`
  Fix status bar crashing on connected displays
  Introduce PrivacyDotViewControllerStore for multiple displays
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/core/StatusBarInitializerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/core/StatusBarInitializerTest.kt
index e312d00..20a19a9 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/core/StatusBarInitializerTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/core/StatusBarInitializerTest.kt
@@ -98,9 +98,9 @@
 
     @Test
     @DisableFlags(Flags.FLAG_STATUS_BAR_SIMPLE_FRAGMENT)
-    fun flagOff_doesNotInitializeViaCoreStartable() {
+    fun flagOff_startCalled_stillInitializes() {
         underTest.start()
-        assertThat(underTest.initialized).isFalse()
+        assertThat(underTest.initialized).isTrue()
     }
 
     @Test
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/core/StatusBarOrchestratorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/core/StatusBarOrchestratorTest.kt
index ab8e878..7923097 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/core/StatusBarOrchestratorTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/core/StatusBarOrchestratorTest.kt
@@ -52,7 +52,7 @@
 import org.mockito.kotlin.times
 import org.mockito.kotlin.verify
 
-@EnableFlags(StatusBarSimpleFragment.FLAG_NAME)
+@EnableFlags(StatusBarConnectedDisplays.FLAG_NAME)
 @SmallTest
 @RunWith(AndroidJUnit4::class)
 class StatusBarOrchestratorTest : SysuiTestCase() {
diff --git a/packages/SystemUI/src/com/android/systemui/flags/FlagDependencies.kt b/packages/SystemUI/src/com/android/systemui/flags/FlagDependencies.kt
index 47f0ecf..3cc184d 100644
--- a/packages/SystemUI/src/com/android/systemui/flags/FlagDependencies.kt
+++ b/packages/SystemUI/src/com/android/systemui/flags/FlagDependencies.kt
@@ -34,8 +34,6 @@
 import com.android.systemui.keyguard.MigrateClocksToBlueprint
 import com.android.systemui.scene.shared.flag.SceneContainerFlag
 import com.android.systemui.shade.shared.flag.DualShade
-import com.android.systemui.statusbar.core.StatusBarConnectedDisplays
-import com.android.systemui.statusbar.core.StatusBarSimpleFragment
 import com.android.systemui.statusbar.notification.collection.SortBySectionTimeFlag
 import com.android.systemui.statusbar.notification.emptyshade.shared.ModesEmptyShadeFix
 import com.android.systemui.statusbar.notification.footer.shared.FooterViewRefactor
@@ -75,8 +73,6 @@
         // Status bar chip dependencies
         statusBarCallChipNotificationIconToken dependsOn statusBarUseReposForCallChipToken
         statusBarCallChipNotificationIconToken dependsOn statusBarScreenSharingChipsToken
-
-        StatusBarConnectedDisplays.token dependsOn StatusBarSimpleFragment.token
     }
 
     private inline val politeNotifications
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/core/StatusBarInitializer.kt b/packages/SystemUI/src/com/android/systemui/statusbar/core/StatusBarInitializer.kt
index 6201ca5..3abbc6e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/core/StatusBarInitializer.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/core/StatusBarInitializer.kt
@@ -103,9 +103,7 @@
         }
 
     override fun start() {
-        if (StatusBarSimpleFragment.isEnabled) {
-            doStart()
-        }
+        doStart()
     }
 
     override fun initializeStatusBar() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/core/StatusBarOrchestrator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/core/StatusBarOrchestrator.kt
index 9619607..f33b76b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/core/StatusBarOrchestrator.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/core/StatusBarOrchestrator.kt
@@ -139,7 +139,7 @@
             }
 
     override fun start() {
-        StatusBarSimpleFragment.assertInNewMode()
+        StatusBarConnectedDisplays.assertInNewMode()
         coroutineScope
             .launch {
                 dumpManager.registerCriticalDumpable(dumpableName, this@StatusBarOrchestrator)
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/data/StatusBarDataLayerModule.kt b/packages/SystemUI/src/com/android/systemui/statusbar/data/StatusBarDataLayerModule.kt
index c416bf7..8a850b0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/data/StatusBarDataLayerModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/data/StatusBarDataLayerModule.kt
@@ -16,6 +16,7 @@
 package com.android.systemui.statusbar.data
 
 import com.android.systemui.statusbar.data.repository.KeyguardStatusBarRepositoryModule
+import com.android.systemui.statusbar.data.repository.PrivacyDotViewControllerStoreModule
 import com.android.systemui.statusbar.data.repository.RemoteInputRepositoryModule
 import com.android.systemui.statusbar.data.repository.StatusBarConfigurationControllerModule
 import com.android.systemui.statusbar.data.repository.StatusBarContentInsetsProviderStoreModule
@@ -27,6 +28,7 @@
     includes =
         [
             KeyguardStatusBarRepositoryModule::class,
+            PrivacyDotViewControllerStoreModule::class,
             RemoteInputRepositoryModule::class,
             StatusBarConfigurationControllerModule::class,
             StatusBarContentInsetsProviderStoreModule::class,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/data/repository/PrivacyDotViewControllerStore.kt b/packages/SystemUI/src/com/android/systemui/statusbar/data/repository/PrivacyDotViewControllerStore.kt
new file mode 100644
index 0000000..bd61c44
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/data/repository/PrivacyDotViewControllerStore.kt
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.statusbar.data.repository
+
+import com.android.systemui.CoreStartable
+import com.android.systemui.dagger.SysUISingleton
+import com.android.systemui.dagger.qualifiers.Background
+import com.android.systemui.display.data.repository.DisplayRepository
+import com.android.systemui.display.data.repository.DisplayScopeRepository
+import com.android.systemui.display.data.repository.PerDisplayStore
+import com.android.systemui.display.data.repository.PerDisplayStoreImpl
+import com.android.systemui.display.data.repository.SingleDisplayStore
+import com.android.systemui.statusbar.core.StatusBarConnectedDisplays
+import com.android.systemui.statusbar.events.PrivacyDotViewController
+import com.android.systemui.statusbar.events.PrivacyDotViewControllerImpl
+import dagger.Lazy
+import dagger.Module
+import dagger.Provides
+import dagger.multibindings.ClassKey
+import dagger.multibindings.IntoMap
+import javax.inject.Inject
+import kotlinx.coroutines.CoroutineScope
+
+/** Provides per display instances of [PrivacyDotViewController]. */
+interface PrivacyDotViewControllerStore : PerDisplayStore<PrivacyDotViewController>
+
+@SysUISingleton
+class MultiDisplayPrivacyDotViewControllerStore
+@Inject
+constructor(
+    @Background backgroundApplicationScope: CoroutineScope,
+    displayRepository: DisplayRepository,
+    private val factory: PrivacyDotViewControllerImpl.Factory,
+    private val displayScopeRepository: DisplayScopeRepository,
+    private val statusBarConfigurationControllerStore: StatusBarConfigurationControllerStore,
+    private val contentInsetsProviderStore: StatusBarContentInsetsProviderStore,
+) :
+    PrivacyDotViewControllerStore,
+    PerDisplayStoreImpl<PrivacyDotViewController>(backgroundApplicationScope, displayRepository) {
+
+    override fun createInstanceForDisplay(displayId: Int): PrivacyDotViewController {
+        return factory.create(
+            displayScopeRepository.scopeForDisplay(displayId),
+            statusBarConfigurationControllerStore.forDisplay(displayId),
+            contentInsetsProviderStore.forDisplay(displayId),
+        )
+    }
+
+    override suspend fun onDisplayRemovalAction(instance: PrivacyDotViewController) {
+        instance.stop()
+    }
+
+    override val instanceClass = PrivacyDotViewController::class.java
+}
+
+@SysUISingleton
+class SingleDisplayPrivacyDotViewControllerStore
+@Inject
+constructor(defaultController: PrivacyDotViewController) :
+    PrivacyDotViewControllerStore,
+    PerDisplayStore<PrivacyDotViewController> by SingleDisplayStore(
+        defaultInstance = defaultController
+    )
+
+@Module
+object PrivacyDotViewControllerStoreModule {
+
+    @Provides
+    @SysUISingleton
+    fun store(
+        singleDisplayLazy: Lazy<SingleDisplayPrivacyDotViewControllerStore>,
+        multiDisplayLazy: Lazy<MultiDisplayPrivacyDotViewControllerStore>,
+    ): PrivacyDotViewControllerStore {
+        return if (StatusBarConnectedDisplays.isEnabled) {
+            multiDisplayLazy.get()
+        } else {
+            singleDisplayLazy.get()
+        }
+    }
+
+    @Provides
+    @SysUISingleton
+    @IntoMap
+    @ClassKey(PrivacyDotViewControllerStore::class)
+    fun storeAsCoreStartable(
+        multiDisplayLazy: Lazy<MultiDisplayPrivacyDotViewControllerStore>
+    ): CoreStartable {
+        return if (StatusBarConnectedDisplays.isEnabled) {
+            multiDisplayLazy.get()
+        } else {
+            CoreStartable.NOP
+        }
+    }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/events/PrivacyDotViewController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/events/PrivacyDotViewController.kt
index 8a2e939..914cc50 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/events/PrivacyDotViewController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/events/PrivacyDotViewController.kt
@@ -34,6 +34,7 @@
 import com.android.systemui.shade.domain.interactor.ShadeInteractor
 import com.android.systemui.statusbar.StatusBarState.SHADE
 import com.android.systemui.statusbar.StatusBarState.SHADE_LOCKED
+import com.android.systemui.statusbar.core.StatusBarConnectedDisplays
 import com.android.systemui.statusbar.data.repository.StatusBarContentInsetsProviderStore
 import com.android.systemui.statusbar.phone.StatusBarContentInsetsChangedListener
 import com.android.systemui.statusbar.phone.StatusBarContentInsetsProvider
@@ -70,6 +71,11 @@
  */
 interface PrivacyDotViewController {
 
+    /**
+     * Called when the [PrivacyDotViewController] should stop doing any work and clean up if needed.
+     */
+    fun stop()
+
     // Only can be modified on @UiThread
     var currentViewState: ViewState
 
@@ -138,45 +144,45 @@
 
     override var showingListener: PrivacyDotViewController.ShowingListener? = null
 
-    init {
-        contentInsetsProvider.addCallback(
-            object : StatusBarContentInsetsChangedListener {
-                override fun onStatusBarContentInsetsChanged() {
-                    dlog("onStatusBarContentInsetsChanged: ")
-                    setNewLayoutRects()
-                }
+    private val insetsChangedListener =
+        object : StatusBarContentInsetsChangedListener {
+            override fun onStatusBarContentInsetsChanged() {
+                dlog("onStatusBarContentInsetsChanged: ")
+                setNewLayoutRects()
             }
-        )
+        }
 
-        configurationController.addCallback(
-            object : ConfigurationController.ConfigurationListener {
-                override fun onLayoutDirectionChanged(isRtl: Boolean) {
-                    uiExecutor?.execute {
-                        // If rtl changed, hide all dotes until the next state resolves
-                        setCornerVisibilities(View.INVISIBLE)
+    private val configurationListener =
+        object : ConfigurationController.ConfigurationListener {
+            override fun onLayoutDirectionChanged(isRtl: Boolean) {
+                uiExecutor?.execute {
+                    // If rtl changed, hide all dots until the next state resolves
+                    setCornerVisibilities(View.INVISIBLE)
 
-                        synchronized(this) {
-                            val corner = selectDesignatedCorner(nextViewState.rotation, isRtl)
-                            nextViewState =
-                                nextViewState.copy(layoutRtl = isRtl, designatedCorner = corner)
-                        }
+                    synchronized(this) {
+                        val corner = selectDesignatedCorner(nextViewState.rotation, isRtl)
+                        nextViewState =
+                            nextViewState.copy(layoutRtl = isRtl, designatedCorner = corner)
                     }
                 }
             }
-        )
+        }
 
-        stateController.addCallback(
-            object : StatusBarStateController.StateListener {
-                override fun onExpandedChanged(isExpanded: Boolean) {
-                    updateStatusBarState()
-                }
-
-                override fun onStateChanged(newState: Int) {
-                    updateStatusBarState()
-                }
+    private val statusBarStateListener =
+        object : StatusBarStateController.StateListener {
+            override fun onExpandedChanged(isExpanded: Boolean) {
+                updateStatusBarState()
             }
-        )
 
+            override fun onStateChanged(newState: Int) {
+                updateStatusBarState()
+            }
+        }
+
+    init {
+        contentInsetsProvider.addCallback(insetsChangedListener)
+        configurationController.addCallback(configurationListener)
+        stateController.addCallback(statusBarStateListener)
         scope.launch {
             shadeInteractor?.isQsExpanded?.collect { isQsExpanded ->
                 dlog("setQsExpanded $isQsExpanded")
@@ -185,6 +191,13 @@
         }
     }
 
+    override fun stop() {
+        StatusBarConnectedDisplays.assertInNewMode()
+        contentInsetsProvider.removeCallback(insetsChangedListener)
+        configurationController.removeCallback(configurationListener)
+        stateController.removeCallback(statusBarStateListener)
+    }
+
     override fun setUiExecutor(e: DelayableExecutor) {
         uiExecutor = e
     }
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
index afa5a78..b469e3d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
@@ -199,6 +199,7 @@
 import com.android.systemui.statusbar.PulseExpansionHandler;
 import com.android.systemui.statusbar.StatusBarState;
 import com.android.systemui.statusbar.SysuiStatusBarStateController;
+import com.android.systemui.statusbar.core.StatusBarConnectedDisplays;
 import com.android.systemui.statusbar.core.StatusBarInitializer;
 import com.android.systemui.statusbar.core.StatusBarSimpleFragment;
 import com.android.systemui.statusbar.data.model.StatusBarMode;
@@ -808,7 +809,7 @@
         mStartingSurfaceOptional = startingSurfaceOptional;
         mDreamManager = dreamManager;
         lockscreenShadeTransitionController.setCentralSurfaces(this);
-        if (!StatusBarSimpleFragment.isEnabled()) {
+        if (!StatusBarConnectedDisplays.isEnabled()) {
             statusBarWindowStateController.addListener(this::onStatusBarWindowStateChanged);
         }
         mScreenOffAnimationController = screenOffAnimationController;
@@ -896,7 +897,7 @@
         mWallpaperSupported = mWallpaperManager.isWallpaperSupported();
 
         RegisterStatusBarResult result = null;
-        if (!StatusBarSimpleFragment.isEnabled()) {
+        if (!StatusBarConnectedDisplays.isEnabled()) {
             try {
                 result = mBarService.registerStatusBar(mCommandQueue);
             } catch (RemoteException ex) {
@@ -909,9 +910,9 @@
         // Set up the initial notification state. This needs to happen before CommandQueue.disable()
         setUpPresenter();
 
-        // When the StatusBarSimpleFragment flag is enabled, this logic will be done in
+        // When the StatusBarConnectedDisplays flag is enabled, this logic will be done in
         // StatusBarOrchestrator
-        if (!StatusBarSimpleFragment.isEnabled()) {
+        if (!StatusBarConnectedDisplays.isEnabled()) {
             if ((result.mTransientBarTypes & WindowInsets.Type.statusBars()) != 0) {
                 mStatusBarModeRepository.getDefaultDisplay().showTransient();
             }
@@ -1010,9 +1011,9 @@
 
         mAccessibilityFloatingMenuController.init();
 
-        // When the StatusBarSimpleFragment flag is enabled, this logic will be done in
+        // When the StatusBarConnectedDisplays flag is enabled, this logic will be done in
         // StatusBarOrchestrator
-        if (!StatusBarSimpleFragment.isEnabled()) {
+        if (!StatusBarConnectedDisplays.isEnabled()) {
             // set the initial view visibility
             int disabledFlags1 = result.mDisabledFlags1;
             int disabledFlags2 = result.mDisabledFlags2;
@@ -1179,9 +1180,9 @@
         mWallpaperController.setRootView(getNotificationShadeWindowView());
 
         mDemoModeController.addCallback(mDemoModeCallback);
-        // When the StatusBarSimpleFragment flag is enabled, this logic will be done in
+        // When the StatusBarConnectedDisplays flag is enabled, this logic will be done in
         // StatusBarOrchestrator.
-        if (!StatusBarSimpleFragment.isEnabled()) {
+        if (!StatusBarConnectedDisplays.isEnabled()) {
             mJavaAdapter.alwaysCollectFlow(
                     mStatusBarModeRepository.getDefaultDisplay().isTransientShown(),
                     this::onTransientShownChanged);
@@ -1198,9 +1199,9 @@
                 mShadeExpansionStateManager.addExpansionListener(mWakeUpCoordinator);
         mWakeUpCoordinator.onPanelExpansionChanged(currentState);
 
-        // When the StatusBarSimpleFragment flag is enabled, all this logic will be done in
+        // When the StatusBarConnectedDisplays flag is enabled, all this logic will be done in
         // StatusBarOrchestrator.
-        if (!StatusBarSimpleFragment.isEnabled()) {
+        if (!StatusBarConnectedDisplays.isEnabled()) {
             // Allow plugins to reference DarkIconDispatcher and StatusBarStateController
             mPluginDependencyProvider.allowPluginDependency(DarkIconDispatcher.class);
             mPluginDependencyProvider.allowPluginDependency(StatusBarStateController.class);
@@ -1222,6 +1223,8 @@
                         setBouncerShowingForStatusBarComponents(mBouncerShowing);
                         checkBarModes();
                     });
+        }
+        if (!StatusBarSimpleFragment.isEnabled() && !StatusBarConnectedDisplays.isEnabled()) {
             // When the flag is on, we register the fragment as a core startable and this is not
             // needed
             mStatusBarInitializer.initializeStatusBar();
@@ -1229,16 +1232,16 @@
 
         mStatusBarTouchableRegionManager.setup(getNotificationShadeWindowView());
 
-        if (!StatusBarSimpleFragment.isEnabled()) {
+        if (!StatusBarConnectedDisplays.isEnabled()) {
             createNavigationBar(result);
         }
 
         mAmbientIndicationContainer = getNotificationShadeWindowView().findViewById(
                 R.id.ambient_indication_container);
 
-        // When the StatusBarSimpleFragment flag is enabled, all this logic will be done in
+        // When the StatusBarConnectedDisplays flag is enabled, all this logic will be done in
         // StatusBarOrchestrator.
-        if (!StatusBarSimpleFragment.isEnabled()) {
+        if (!StatusBarConnectedDisplays.isEnabled()) {
             mAutoHideController.setStatusBar(
                     new AutoHideUiElement() {
                         @Override
@@ -1498,14 +1501,14 @@
      * @param state2 disable2 flags
      */
     protected void setUpDisableFlags(int state1, int state2) {
-        StatusBarSimpleFragment.assertInLegacyMode();
+        StatusBarConnectedDisplays.assertInLegacyMode();
         mCommandQueue.disable(mDisplayId, state1, state2, false /* animate */);
     }
 
     // TODO(b/117478341): This was left such that CarStatusBar can override this method.
     // Try to remove this.
     protected void createNavigationBar(@Nullable RegisterStatusBarResult result) {
-        StatusBarSimpleFragment.assertInLegacyMode();
+        StatusBarConnectedDisplays.assertInLegacyMode();
         mNavigationBarController.createNavigationBars(true /* includeDefaultDisplay */, result);
     }
 
@@ -1718,9 +1721,9 @@
     @Override
     public void checkBarModes() {
         if (mDemoModeController.isInDemoMode()) return;
-        // When the StatusBarSimpleFragment flag is enabled, this logic will be done in
+        // When the StatusBarConnectedDisplays flag is enabled, this logic will be done in
         // StatusBarOrchestrator.
-        if (!StatusBarSimpleFragment.isEnabled() && mStatusBarTransitions != null) {
+        if (!StatusBarConnectedDisplays.isEnabled() && mStatusBarTransitions != null) {
             checkBarMode(
                     mStatusBarModeRepository.getDefaultDisplay().getStatusBarMode().getValue(),
                     mStatusBarWindowState,
@@ -1751,9 +1754,9 @@
     }
 
     private void finishBarAnimations() {
-        // When the StatusBarSimpleFragment flag is enabled, this logic will be done in
+        // When the StatusBarConnectedDisplays flag is enabled, this logic will be done in
         // StatusBarOrchestrator.
-        if (!StatusBarSimpleFragment.isEnabled() && mStatusBarTransitions != null) {
+        if (!StatusBarConnectedDisplays.isEnabled() && mStatusBarTransitions != null) {
             mStatusBarTransitions.finishAnimations();
         }
         mNavigationBarController.finishBarAnimations(mDisplayId);
@@ -1795,14 +1798,14 @@
         }
 
         pw.print("  mInteractingWindows="); pw.println(mInteractingWindows);
-        if (!StatusBarSimpleFragment.isEnabled()) {
+        if (!StatusBarConnectedDisplays.isEnabled()) {
             pw.print("  mStatusBarWindowState=");
             pw.println(windowStateToString(mStatusBarWindowState));
         }
         pw.print("  mDozing="); pw.println(mDozing);
         pw.print("  mWallpaperSupported= "); pw.println(mWallpaperSupported);
 
-        if (!StatusBarSimpleFragment.isEnabled()) {
+        if (!StatusBarConnectedDisplays.isEnabled()) {
             CentralSurfaces.dumpBarTransitions(
                     pw, "PhoneStatusBarTransitions", mStatusBarTransitions);
         }
@@ -1878,9 +1881,9 @@
     private void createAndAddWindows(@Nullable RegisterStatusBarResult result) {
         makeStatusBarView(result);
         mNotificationShadeWindowController.attach();
-        // When the StatusBarSimpleFragment flag is enabled, this logic will be done in
+        // When the StatusBarConnectedDisplays flag is enabled, this logic will be done in
         // StatusBarOrchestrator
-        if (!StatusBarSimpleFragment.isEnabled()) {
+        if (!StatusBarConnectedDisplays.isEnabled()) {
             mStatusBarWindowControllerStore.getDefaultDisplay().attach();
         }
     }
@@ -2507,7 +2510,7 @@
         int importance = bouncerShowing
                 ? IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS
                 : IMPORTANT_FOR_ACCESSIBILITY_AUTO;
-        if (!StatusBarSimpleFragment.isEnabled() && mPhoneStatusBarViewController != null) {
+        if (!StatusBarConnectedDisplays.isEnabled() && mPhoneStatusBarViewController != null) {
             mPhoneStatusBarViewController.setImportantForAccessibility(importance);
         }
         mShadeSurface.setImportantForAccessibility(importance);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.kt
index 92d0ebe..99f25bd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/dagger/StatusBarPhoneModule.kt
@@ -78,8 +78,11 @@
             return if (StatusBarConnectedDisplays.isEnabled) {
                 // Will be started through MultiDisplayStatusBarStarter
                 CoreStartable.NOP
-            } else {
+            } else if (StatusBarSimpleFragment.isEnabled) {
                 defaultInitializerLazy.get()
+            } else {
+                // Will be started through CentralSurfaces
+                CoreStartable.NOP
             }
         }
 
@@ -119,24 +122,6 @@
         @Provides
         @SysUISingleton
         @IntoMap
-        @ClassKey(StatusBarOrchestrator::class)
-        fun orchestratorCoreStartable(
-            @Default orchestratorLazy: Lazy<StatusBarOrchestrator>
-        ): CoreStartable {
-            return if (StatusBarConnectedDisplays.isEnabled) {
-                // Will be started through MultiDisplayStatusBarStarter
-                CoreStartable.NOP
-            } else if (StatusBarSimpleFragment.isEnabled) {
-                orchestratorLazy.get()
-            } else {
-                // Will be started through CentralSurfacesImpl
-                CoreStartable.NOP
-            }
-        }
-
-        @Provides
-        @SysUISingleton
-        @IntoMap
         @ClassKey(MultiDisplayStatusBarStarter::class)
         fun multiDisplayStarter(
             multiDisplayStatusBarStarterLazy: Lazy<MultiDisplayStatusBarStarter>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java
index 37c8c63..013141b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/fragment/CollapsedStatusBarFragment.java
@@ -57,6 +57,7 @@
 import com.android.systemui.statusbar.OperatorNameViewController;
 import com.android.systemui.statusbar.StatusBarState;
 import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifChips;
+import com.android.systemui.statusbar.core.StatusBarConnectedDisplays;
 import com.android.systemui.statusbar.core.StatusBarSimpleFragment;
 import com.android.systemui.statusbar.disableflags.DisableFlagsLogger;
 import com.android.systemui.statusbar.events.SystemStatusAnimationCallback;
@@ -711,8 +712,14 @@
     private boolean shouldHideStatusBar() {
         StatusBarSimpleFragment.assertInLegacyMode();
 
+        boolean isDefaultDisplay = getContext().getDisplayId() == Display.DEFAULT_DISPLAY;
+        boolean shouldHideForCurrentDisplay =
+                !StatusBarConnectedDisplays.isEnabled() || isDefaultDisplay;
         if (!mShadeExpansionStateManager.isClosed()
-                && mPanelExpansionInteractor.shouldHideStatusBarIconsWhenExpanded()) {
+                && mPanelExpansionInteractor.shouldHideStatusBarIconsWhenExpanded()
+                //TODO(b/373310629): for now the shade only shows on the main display.
+                // Remove this once there is a display aware API for the shade.
+                && shouldHideForCurrentDisplay) {
             return true;
         }
 
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/composable/StatusBarRoot.kt b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/composable/StatusBarRoot.kt
index 4684f61e..a472318 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/composable/StatusBarRoot.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/pipeline/shared/ui/composable/StatusBarRoot.kt
@@ -16,6 +16,7 @@
 
 package com.android.systemui.statusbar.pipeline.shared.ui.composable
 
+import android.view.Display
 import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
@@ -152,8 +153,14 @@
                         phoneStatusBarView.requireViewById<NotificationIconContainer>(
                             R.id.notificationIcons
                         )
-                    scope.launch {
-                        notificationIconsBinder.bindWhileAttached(notificationIconContainer)
+
+                    // TODO(b/369337701): implement notification icons for all displays.
+                    //  Currently if we try to bind for all displays, there is a crash, because the
+                    //  same notification icon view can't have multiple parents.
+                    if (context.displayId == Display.DEFAULT_DISPLAY) {
+                        scope.launch {
+                            notificationIconsBinder.bindWhileAttached(notificationIconContainer)
+                        }
                     }
 
                     // This binder handles everything else
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
index 1e88215..f472fd1 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CentralSurfacesImplTest.java
@@ -172,9 +172,9 @@
 import com.android.systemui.statusbar.PulseExpansionHandler;
 import com.android.systemui.statusbar.StatusBarState;
 import com.android.systemui.statusbar.StatusBarStateControllerImpl;
+import com.android.systemui.statusbar.core.StatusBarConnectedDisplays;
 import com.android.systemui.statusbar.core.StatusBarInitializerImpl;
 import com.android.systemui.statusbar.core.StatusBarOrchestrator;
-import com.android.systemui.statusbar.core.StatusBarSimpleFragment;
 import com.android.systemui.statusbar.data.repository.FakeStatusBarModeRepository;
 import com.android.systemui.statusbar.notification.NotifPipelineFlags;
 import com.android.systemui.statusbar.notification.NotificationActivityStarter;
@@ -1135,7 +1135,7 @@
     }
 
     @Test
-    @DisableFlags(StatusBarSimpleFragment.FLAG_NAME)
+    @DisableFlags(StatusBarConnectedDisplays.FLAG_NAME)
     public void bubbleBarVisibility() {
         createCentralSurfaces();
         mCentralSurfaces.onStatusBarWindowStateChanged(WINDOW_STATE_HIDDEN);