Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec1abd3d authored by Chris Göllner's avatar Chris Göllner Committed by Chris Göllner
Browse files

Make HomeStatusBarComponent a Subcomponent of SystemUIDisplaySubcomponent

Since some SystemUI variants don't have a status bar, we create
SystemUIPhoneDisplaySubcomponent, which includes the
HomeStatusBarComponent as a Subcomponent, while the standard one doesn't.

Now, SystemUIPhoneDisplaySubcomponent is included in
ReferenceSystemUIModule, which allow other variants to include the
standard one, that doesn't include the HomeStatusBarComponent.

Test: Build all SystemUI variants
Bug: 417927751
Flag: EXEMPT Dagger change that can't be flagged
Change-Id: I22fe2e54d663eae0c5622fd7f2c7f2506f4b087d
parent 1498fecf
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -32,6 +32,9 @@ import com.android.systemui.actioncorner.ActionCornerModule;
import com.android.systemui.battery.BatterySaverModule;
import com.android.systemui.clipboardoverlay.dagger.ClipboardOverlayOverrideModule;
import com.android.systemui.communal.posturing.dagger.NoopPosturingModule;
import com.android.systemui.display.dagger.SystemUIDisplaySubcomponent;
import com.android.systemui.display.dagger.SystemUIPhoneDisplaySubcomponent;
import com.android.systemui.display.data.repository.DisplayPhoneModule;
import com.android.systemui.display.ui.viewmodel.ConnectingDisplayViewModel;
import com.android.systemui.dock.DockManager;
import com.android.systemui.dock.DockManagerImpl;
@@ -138,6 +141,7 @@ import javax.inject.Named;
        ConnectingDisplayViewModel.StartableModule.class,
        DefaultBlueprintModule.class,
        DeviceStateAutoRotateModule.class,
        DisplayPhoneModule.class,
        EmergencyGestureModule.class,
        GestureModule.class,
        HeadsUpModule.class,
@@ -179,9 +183,15 @@ import javax.inject.Named;
        ShortcutHelperModule.class,
        ContextualEducationModule.class,
        ActionCornerModule.class,
}, subcomponents = {
        SystemUIPhoneDisplaySubcomponent.class
})
public abstract class ReferenceSystemUIModule {

    @Binds
    abstract SystemUIDisplaySubcomponent.Factory systemUIDisplaySubcomponentFactory(
            SystemUIPhoneDisplaySubcomponent.Factory factory);

    @SysUISingleton
    @Provides
    @Named(LEAK_REPORT_EMAIL_NAME)
+0 −2
Original line number Diff line number Diff line
@@ -67,7 +67,6 @@ import com.android.systemui.demomode.dagger.DemoModeModule;
import com.android.systemui.desktop.dagger.DesktopModule;
import com.android.systemui.deviceentry.DeviceEntryModule;
import com.android.systemui.display.DisplayModule;
import com.android.systemui.display.dagger.SystemUIDisplaySubcomponent;
import com.android.systemui.doze.dagger.DozeComponent;
import com.android.systemui.dreams.dagger.DreamModule;
import com.android.systemui.flags.FeatureFlags;
@@ -312,7 +311,6 @@ import javax.inject.Named;
                NavigationBarComponent.class,
                NotificationRowComponent.class,
                WindowRootViewComponent.class,
                SystemUIDisplaySubcomponent.class,
                BundleRowComponent.class,
        })
public abstract class SystemUIModule {
+2 −1
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import com.android.systemui.display.data.repository.DisplayStateRepository
import com.android.systemui.display.data.repository.DisplayStateRepositoryImpl
import com.android.systemui.display.domain.interactor.DisplayStateInteractor
import com.android.systemui.display.domain.interactor.DisplayStateInteractorImpl
import com.android.systemui.statusbar.dagger.StatusBarPerDisplayModule
import dagger.Binds
import dagger.Module
import dagger.Provides
@@ -37,7 +38,7 @@ import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope

/** Module providing common dependencies for per-display singletons. */
@Module
@Module(includes = [StatusBarPerDisplayModule::class])
interface PerDisplayCommonModule {

    @Multibinds
+43 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 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.display.dagger

import com.android.systemui.display.dagger.SystemUIDisplaySubcomponent.DisplayAware
import com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment
import com.android.systemui.statusbar.phone.fragment.dagger.HomeStatusBarComponent
import dagger.Binds
import dagger.Module

/**
 * "Phone" specific module for SysUI classes that should be instantiated once per display.
 *
 * If the classes are common to all SysUI flavors, they should be added to
 * [PerDisplayCommonModule] instead.
 */
@Module(subcomponents = [HomeStatusBarComponent::class])
interface PerDisplayPhoneModule {

    @Binds
    @DisplayAware
    fun homeStatusBarComponentFactory(
        factory: HomeStatusBarComponent.Factory
    ): HomeStatusBarComponent.Factory

    @Binds
    @DisplayAware
    fun statusBarFragmentProvider(fragment: CollapsedStatusBarFragment): CollapsedStatusBarFragment
}
+1 −2
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.systemui.display.dagger
import com.android.systemui.display.dagger.SystemUIDisplaySubcomponent.PerDisplaySingleton
import com.android.systemui.display.data.repository.DisplayStateRepository
import com.android.systemui.display.domain.interactor.DisplayStateInteractor
import com.android.systemui.statusbar.dagger.StatusBarPerDisplayModule
import com.android.systemui.statusbar.domain.interactor.StatusBarIconRefreshInteractor
import dagger.BindsInstance
import dagger.Subcomponent
@@ -37,7 +36,7 @@ import kotlinx.coroutines.CoroutineScope
 * thread is not feasible as it would cause jank.
 */
@PerDisplaySingleton
@Subcomponent(modules = [PerDisplayCommonModule::class, StatusBarPerDisplayModule::class])
@Subcomponent(modules = [PerDisplayCommonModule::class])
interface SystemUIDisplaySubcomponent {

    @get:DisplayAware val displayCoroutineScope: CoroutineScope
Loading