Merge "Move EnhancedEstimates to PowerModule" into tm-dev

This commit is contained in:
Dave Mankoff
2022-05-06 15:18:08 +00:00
committed by Android (Google) Code Review
5 changed files with 30 additions and 14 deletions

View File

@@ -38,7 +38,6 @@ import com.android.systemui.media.dagger.MediaModule;
import com.android.systemui.plugins.qs.QSFactory; import com.android.systemui.plugins.qs.QSFactory;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.power.EnhancedEstimates; import com.android.systemui.power.EnhancedEstimates;
import com.android.systemui.power.EnhancedEstimatesImpl;
import com.android.systemui.power.dagger.PowerModule; import com.android.systemui.power.dagger.PowerModule;
import com.android.systemui.qs.dagger.QSModule; import com.android.systemui.qs.dagger.QSModule;
import com.android.systemui.qs.tileimpl.QSFactoryImpl; import com.android.systemui.qs.tileimpl.QSFactoryImpl;
@@ -80,8 +79,19 @@ import dagger.Module;
import dagger.Provides; import dagger.Provides;
/** /**
* A dagger module for injecting default implementations of components of System UI that may be * A dagger module for injecting default implementations of components of System UI.
* overridden by the System UI implementation. *
* Variants of SystemUI should make a copy of this, include it in their component, and customize it
* as needed.
*
* This module might alternatively be named `AospSystemUIModule`, `PhoneSystemUIModule`,
* or `BasicSystemUIModule`.
*
* Nothing in the module should be strictly required. Each piece should either be swappable with
* a different implementation or entirely removable.
*
* This is different from {@link SystemUIModule} which should be used for pieces of required
* SystemUI code that variants of SystemUI _must_ include to function correctly.
*/ */
@Module(includes = { @Module(includes = {
MediaModule.class, MediaModule.class,
@@ -90,7 +100,7 @@ import dagger.Provides;
StartCentralSurfacesModule.class, StartCentralSurfacesModule.class,
VolumeModule.class VolumeModule.class
}) })
public abstract class SystemUIDefaultModule { public abstract class ReferenceSystemUIModule {
@SysUISingleton @SysUISingleton
@Provides @Provides
@@ -100,9 +110,6 @@ public abstract class SystemUIDefaultModule {
return null; return null;
} }
@Binds
abstract EnhancedEstimates bindEnhancedEstimates(EnhancedEstimatesImpl enhancedEstimates);
@Binds @Binds
abstract NotificationLockscreenUserManager bindNotificationLockscreenUserManager( abstract NotificationLockscreenUserManager bindNotificationLockscreenUserManager(
NotificationLockscreenUserManagerImpl notificationLockscreenUserManager); NotificationLockscreenUserManagerImpl notificationLockscreenUserManager);
@@ -148,6 +155,7 @@ public abstract class SystemUIDefaultModule {
return spC; return spC;
} }
/** */
@Binds @Binds
@SysUISingleton @SysUISingleton
public abstract QSFactory bindQSFactory(QSFactoryImpl qsFactoryImpl); public abstract QSFactory bindQSFactory(QSFactoryImpl qsFactoryImpl);

View File

@@ -73,7 +73,7 @@ import dagger.Subcomponent;
SystemUIBinder.class, SystemUIBinder.class,
SystemUIModule.class, SystemUIModule.class,
SystemUICoreStartableModule.class, SystemUICoreStartableModule.class,
SystemUIDefaultModule.class}) ReferenceSystemUIModule.class})
public interface SysUIComponent { public interface SysUIComponent {
/** /**

View File

@@ -100,8 +100,14 @@ import dagger.Module;
import dagger.Provides; import dagger.Provides;
/** /**
* A dagger module for injecting components of System UI that are not overridden by the System UI * A dagger module for injecting components of System UI that are required by System UI.
* implementation. *
* If your feature can be excluded, subclassed, or re-implemented by a variant of SystemUI, put
* your Dagger Module in {@link ReferenceSystemUIModule} and/or any variant modules that
* rely on the feature.
*
* Adding an entry in this file means that _all_ variants of SystemUI will receive that code. They
* may not appreciate that.
*/ */
@Module(includes = { @Module(includes = {
AppOpsModule.class, AppOpsModule.class,

View File

@@ -16,6 +16,8 @@
package com.android.systemui.power.dagger; package com.android.systemui.power.dagger;
import com.android.systemui.power.EnhancedEstimates;
import com.android.systemui.power.EnhancedEstimatesImpl;
import com.android.systemui.power.PowerNotificationWarnings; import com.android.systemui.power.PowerNotificationWarnings;
import com.android.systemui.power.PowerUI; import com.android.systemui.power.PowerUI;
@@ -26,6 +28,10 @@ import dagger.Module;
/** Dagger Module for code in the power package. */ /** Dagger Module for code in the power package. */
@Module @Module
public interface PowerModule { public interface PowerModule {
/** */
@Binds
EnhancedEstimates bindEnhancedEstimates(EnhancedEstimatesImpl enhancedEstimates);
/** */ /** */
@Binds @Binds
PowerUI.WarningsUI provideWarningsUi(PowerNotificationWarnings controllerImpl); PowerUI.WarningsUI provideWarningsUi(PowerNotificationWarnings controllerImpl);

View File

@@ -38,7 +38,6 @@ import com.android.systemui.doze.DozeHost;
import com.android.systemui.plugins.qs.QSFactory; import com.android.systemui.plugins.qs.QSFactory;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.power.EnhancedEstimates; import com.android.systemui.power.EnhancedEstimates;
import com.android.systemui.power.EnhancedEstimatesImpl;
import com.android.systemui.power.dagger.PowerModule; import com.android.systemui.power.dagger.PowerModule;
import com.android.systemui.qs.dagger.QSModule; import com.android.systemui.qs.dagger.QSModule;
import com.android.systemui.qs.tileimpl.QSFactoryImpl; import com.android.systemui.qs.tileimpl.QSFactoryImpl;
@@ -101,9 +100,6 @@ public abstract class TvSystemUIModule {
return null; return null;
} }
@Binds
abstract EnhancedEstimates bindEnhancedEstimates(EnhancedEstimatesImpl enhancedEstimates);
@Binds @Binds
abstract NotificationLockscreenUserManager bindNotificationLockscreenUserManager( abstract NotificationLockscreenUserManager bindNotificationLockscreenUserManager(
NotificationLockscreenUserManagerImpl notificationLockscreenUserManager); NotificationLockscreenUserManagerImpl notificationLockscreenUserManager);