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

Commit 8416d1e5 authored by Dave Mankoff's avatar Dave Mankoff
Browse files

2/N: Introduce WMComponent and SysUIComponent.

This creates the primary subcompents that will divide WindowManager
from SystemUI Core.

Bug: 162923491
Test: manual
Change-Id: I43f88d5356f023bd2785cf76635bfc9aec0c82b6
parent 91274b91
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ import com.android.keyguard.ViewMediatorCallback;
import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.dagger.DaggerGlobalRootComponent;
import com.android.systemui.dagger.GlobalRootComponent;
import com.android.systemui.dagger.SysUIComponent;
import com.android.systemui.dagger.WMComponent;
import com.android.systemui.keyguard.DismissCallbackRegistry;
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
@@ -54,6 +56,8 @@ public class SystemUIFactory {

    static SystemUIFactory mFactory;
    private GlobalRootComponent mRootComponent;
    private WMComponent mWMComponent;
    private SysUIComponent mSysUIComponent;

    public static <T extends SystemUIFactory> T getInstance() {
        return (T) mFactory;
@@ -89,6 +93,9 @@ public class SystemUIFactory {

    private void init(Context context) {
        mRootComponent = buildGlobalRootComponent(context);
        mWMComponent = mRootComponent.getWMComponentBuilder().build();
        // TODO: use WMComponent to pass APIs into the SysUIComponent.
        mSysUIComponent = mRootComponent.getSysUIComponent().build();

        // Every other part of our codebase currently relies on Dependency, so we
        // really need to ensure the Dependency gets initialized early on.
+13 −1
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import dagger.Component;
/**
 * Root component for Dagger injection.
 */
// TODO(b/162923491): Move most of these modules to SysUIComponent.
@Singleton
@Component(modules = {
        DefaultComponentBinder.class,
@@ -52,7 +53,8 @@ import dagger.Component;
        SystemServicesModule.class,
        SystemUIBinder.class,
        SystemUIModule.class,
        SystemUIDefaultModule.class})
        SystemUIDefaultModule.class,
        WMModule.class})
public interface GlobalRootComponent {

    /**
@@ -66,6 +68,16 @@ public interface GlobalRootComponent {
        GlobalRootComponent build();
    }

    /**
     * Builder for a WMComponent.
     */
    WMComponent.Builder getWMComponentBuilder();

    /**
     * Builder for a SysuiComponent.
     */
    SysUIComponent.Builder getSysUIComponent();

    /**
     * Provides a BootCompleteCache.
     */
+35 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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.dagger;

import dagger.Subcomponent;

/**
 * Dagger Subcomponent for Core SysUI.
 */
@SysUISingleton
@Subcomponent(modules = {})
public interface SysUIComponent {

    /**
     * Builder for a SysUIComponent.
     */
    @Subcomponent.Builder
    interface Builder {
        SysUIComponent build();
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ import java.lang.annotation.Retention;
import javax.inject.Scope;

/**
 * Scope annotation for singleton items within the StatusBarComponent.
 * Scope annotation for singleton items within the SysUIComponent.
 */
@Documented
@Retention(RUNTIME)
+8 −1
Original line number Diff line number Diff line
@@ -72,7 +72,14 @@ import dagger.Provides;
 * A dagger module for injecting default implementations of components of System UI that may be
 * overridden by the System UI implementation.
 */
@Module(includes = {DividerModule.class, QSModule.class, WindowManagerShellModule.class})
@Module(includes = {
            DividerModule.class,
            QSModule.class,
            WindowManagerShellModule.class
        },
        subcomponents = {
            SysUIComponent.class
        })
public abstract class SystemUIDefaultModule {

    @Singleton
Loading