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

Commit ecfbd9b3 authored by Dave Mankoff's avatar Dave Mankoff
Browse files

6/N Move everything into SysUIComponent.

It is far easier to move _everything_ into SysUIComponent, and then
selectively promote things back to GlobalScope and/or WMScope than
it is to try to do it one at a time. With this change, though lots
of files are touched, very little actually changes structurally.

After this change goes in, folks should stop using @Singleton quite
so freely. Most things should live in @SysuiSingleton. @Singleton
is due to quickly be replaced by @GlobalScope.

Bug: 162923491
Test: atest SystemUITests && manual
Change-Id: Idc31d3d83b030581fb1fa869f7fafc4f2d3a8828
parent 509f1c79
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
-keep class com.android.systemui.CarSystemUIFactory
-keep class com.android.car.notification.headsup.animationhelper.**

-keep class com.android.systemui.CarGlobalRootComponent { *; }
-keep class com.android.systemui.DaggerCarGlobalRootComponent { *; }
-keep class com.android.systemui.DaggerCarGlobalRootComponent$CarSysUIComponentImpl { *; }

-include ../SystemUI/proguard.flags
+1 −15
Original line number Diff line number Diff line
@@ -16,13 +16,7 @@

package com.android.systemui;

import com.android.systemui.dagger.DependencyBinder;
import com.android.systemui.dagger.DependencyProvider;
import com.android.systemui.dagger.GlobalRootComponent;
import com.android.systemui.dagger.SystemServicesModule;
import com.android.systemui.dagger.SystemUIModule;
import com.android.systemui.onehanded.dagger.OneHandedModule;
import com.android.systemui.pip.phone.dagger.PipModule;

import javax.inject.Singleton;

@@ -32,15 +26,7 @@ import dagger.Component;
@Singleton
@Component(
        modules = {
                CarComponentBinder.class,
                DependencyProvider.class,
                DependencyBinder.class,
                PipModule.class,
                OneHandedModule.class,
                SystemServicesModule.class,
                SystemUIModule.class,
                CarSystemUIModule.class,
                CarSystemUIBinder.class
                CarSysUIComponentModule.class
        })
public interface CarGlobalRootComponent extends GlobalRootComponent {
    /**
+16 −1
Original line number Diff line number Diff line
@@ -16,8 +16,14 @@

package com.android.systemui;

import com.android.systemui.dagger.DependencyBinder;
import com.android.systemui.dagger.DependencyProvider;
import com.android.systemui.dagger.SysUIComponent;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.SystemServicesModule;
import com.android.systemui.dagger.SystemUIModule;
import com.android.systemui.onehanded.dagger.OneHandedModule;
import com.android.systemui.pip.phone.dagger.PipModule;

import dagger.Subcomponent;

@@ -25,7 +31,16 @@ import dagger.Subcomponent;
 * Dagger Subcomponent for Core SysUI.
 */
@SysUISingleton
@Subcomponent(modules = {})
@Subcomponent(modules = {
        CarComponentBinder.class,
        DependencyProvider.class,
        DependencyBinder.class,
        PipModule.class,
        OneHandedModule.class,
        SystemServicesModule.class,
        SystemUIModule.class,
        CarSystemUIModule.class,
        CarSystemUIBinder.class})
public interface CarSysUIComponent extends SysUIComponent {

    /**
+28 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2020 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;

import dagger.Module;

/**
 * Dagger module for including the CarSysUIComponent.
 *
 * TODO(b/162923491): Remove or otherwise refactor this module. This is a stop gap.
 */
@Module(subcomponents = {CarSysUIComponent.class})
public abstract class CarSysUIComponentModule {
}
+12 −15
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import com.android.systemui.car.notification.NotificationShadeWindowControllerIm
import com.android.systemui.car.statusbar.DozeServiceHost;
import com.android.systemui.car.volume.CarVolumeDialogComponent;
import com.android.systemui.dagger.GlobalRootComponent;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dagger.qualifiers.Background;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.demomode.DemoModeController;
@@ -74,7 +75,6 @@ import com.android.wm.shell.common.SystemWindows;
import com.android.wm.shell.common.TransactionPool;

import javax.inject.Named;
import javax.inject.Singleton;

import dagger.Binds;
import dagger.Module;
@@ -84,20 +84,17 @@ import dagger.Provides;
        includes = {
                DividerModule.class,
                QSModule.class
        },
        subcomponents = {
                CarSysUIComponent.class
        })
abstract class CarSystemUIModule {

    @Singleton
    @SysUISingleton
    @Provides
    @Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME)
    static boolean provideAllowNotificationLongPress() {
        return false;
    }

    @Singleton
    @SysUISingleton
    @Provides
    static HeadsUpManagerPhone provideHeadsUpManagerPhone(
            Context context,
@@ -109,7 +106,7 @@ abstract class CarSystemUIModule {
                groupManager, configurationController);
    }

    @Singleton
    @SysUISingleton
    @Provides
    @Named(LEAK_REPORT_EMAIL_NAME)
    static String provideLeakReportEmail() {
@@ -117,33 +114,33 @@ abstract class CarSystemUIModule {
    }

    @Provides
    @Singleton
    @SysUISingleton
    static Recents provideRecents(Context context, RecentsImplementation recentsImplementation,
            CommandQueue commandQueue) {
        return new Recents(context, recentsImplementation, commandQueue);
    }

    @Singleton
    @SysUISingleton
    @Provides
    static TransactionPool provideTransactionPool() {
        return new TransactionPool();
    }

    @Singleton
    @SysUISingleton
    @Provides
    static DisplayController providerDisplayController(Context context, @Main Handler handler,
            IWindowManager wmService) {
        return new DisplayController(context, handler, wmService);
    }

    @Singleton
    @SysUISingleton
    @Provides
    static SystemWindows provideSystemWindows(DisplayController displayController,
            IWindowManager wmService) {
        return new SystemWindows(displayController, wmService);
    }

    @Singleton
    @SysUISingleton
    @Provides
    static DisplayImeController provideDisplayImeController(Context context,
            IWindowManager wmService, DisplayController displayController,
@@ -152,7 +149,7 @@ abstract class CarSystemUIModule {
                mainHandler, transactionPool).build();
    }

    @Singleton
    @SysUISingleton
    @PipMenuActivityClass
    @Provides
    static Class<?> providePipMenuActivityClass() {
@@ -170,7 +167,7 @@ abstract class CarSystemUIModule {
            NotificationLockscreenUserManagerImpl notificationLockscreenUserManager);

    @Provides
    @Singleton
    @SysUISingleton
    static BatteryController provideBatteryController(Context context,
            EnhancedEstimates enhancedEstimates, PowerManager powerManager,
            BroadcastDispatcher broadcastDispatcher, DemoModeController demoModeController,
@@ -183,7 +180,7 @@ abstract class CarSystemUIModule {
    }

    @Binds
    @Singleton
    @SysUISingleton
    public abstract QSFactory bindQSFactory(QSFactoryImpl qsFactoryImpl);

    @Binds
Loading