Instances of SystemUI must now define their own ComponentBinder
This will allow us to mark parts of the core system as Optional, like the StatusBar. Bug: 140514132 Test: atest SystemUITests Change-Id: I37f6fa414e9dc2a672dd0bc8cc69ce4049762973
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.android.systemui.dagger.DefaultActivityBinder;
|
||||
import com.android.systemui.dagger.DefaultServiceBinder;
|
||||
|
||||
import dagger.Module;
|
||||
|
||||
/**
|
||||
* Supply Activities, Services, and SystemUI Objects for CarSystemUI.
|
||||
*/
|
||||
@Module(includes = {
|
||||
DefaultActivityBinder.class,
|
||||
DefaultServiceBinder.class,
|
||||
CarSystemUIBinder.class})
|
||||
public class CarComponentBinder {
|
||||
}
|
||||
@@ -16,7 +16,16 @@
|
||||
|
||||
package com.android.systemui;
|
||||
|
||||
import com.android.systemui.keyguard.KeyguardViewMediator;
|
||||
import com.android.systemui.navigationbar.car.CarNavigationBar;
|
||||
import com.android.systemui.pip.PipUI;
|
||||
import com.android.systemui.power.PowerUI;
|
||||
import com.android.systemui.recents.Recents;
|
||||
import com.android.systemui.recents.RecentsModule;
|
||||
import com.android.systemui.statusbar.car.CarStatusBar;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
import com.android.systemui.util.leak.GarbageMonitor;
|
||||
import com.android.systemui.volume.VolumeUI;
|
||||
|
||||
import dagger.Binds;
|
||||
import dagger.Module;
|
||||
@@ -24,11 +33,71 @@ import dagger.multibindings.ClassKey;
|
||||
import dagger.multibindings.IntoMap;
|
||||
|
||||
/** Binder for car specific {@link SystemUI} modules. */
|
||||
@Module
|
||||
@Module(includes = {RecentsModule.class})
|
||||
public abstract class CarSystemUIBinder {
|
||||
/** */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(CarNavigationBar.class)
|
||||
public abstract SystemUI bindCarNavigationBar(CarNavigationBar sysui);
|
||||
|
||||
/** Inject into GarbageMonitor.Service. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(GarbageMonitor.Service.class)
|
||||
public abstract SystemUI bindGarbageMonitorService(GarbageMonitor.Service service);
|
||||
|
||||
/** Inject into KeyguardViewMediator. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(KeyguardViewMediator.class)
|
||||
public abstract SystemUI bindKeyguardViewMediator(KeyguardViewMediator sysui);
|
||||
|
||||
/** Inject into LatencyTests. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(LatencyTester.class)
|
||||
public abstract SystemUI bindLatencyTester(LatencyTester sysui);
|
||||
|
||||
/** Inject into PipUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(PipUI.class)
|
||||
public abstract SystemUI bindPipUI(PipUI sysui);
|
||||
|
||||
/** Inject into PowerUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(PowerUI.class)
|
||||
public abstract SystemUI bindPowerUI(PowerUI sysui);
|
||||
|
||||
/** Inject into Recents. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(Recents.class)
|
||||
public abstract SystemUI bindRecents(Recents sysui);
|
||||
|
||||
/** Inject into ScreenDecorations. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(ScreenDecorations.class)
|
||||
public abstract SystemUI bindScreenDecorations(ScreenDecorations sysui);
|
||||
|
||||
/** Inject into StatusBar. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(StatusBar.class)
|
||||
public abstract SystemUI bindsStatusBar(CarStatusBar sysui);
|
||||
|
||||
/** Inject into StatusBarGoogle. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(CarStatusBar.class)
|
||||
public abstract SystemUI bindsCarStatusBar(CarStatusBar sysui);
|
||||
|
||||
/** Inject into VolumeUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(VolumeUI.class)
|
||||
public abstract SystemUI bindVolumeUI(VolumeUI sysui);
|
||||
}
|
||||
|
||||
@@ -46,8 +46,6 @@ import javax.inject.Singleton;
|
||||
import dagger.Binds;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import dagger.multibindings.ClassKey;
|
||||
import dagger.multibindings.IntoMap;
|
||||
|
||||
@Module
|
||||
abstract class CarSystemUIModule {
|
||||
@@ -104,11 +102,6 @@ abstract class CarSystemUIModule {
|
||||
@Binds
|
||||
public abstract StatusBar bindStatusBar(CarStatusBar statusBar);
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(StatusBar.class)
|
||||
public abstract SystemUI providesStatusBar(CarStatusBar statusBar);
|
||||
|
||||
@Binds
|
||||
abstract VolumeDialogComponent bindVolumeDialogComponent(
|
||||
CarVolumeDialogComponent carVolumeDialogComponent);
|
||||
|
||||
@@ -29,6 +29,7 @@ import dagger.Component;
|
||||
@Singleton
|
||||
@Component(
|
||||
modules = {
|
||||
CarComponentBinder.class,
|
||||
DependencyProvider.class,
|
||||
DependencyBinder.class,
|
||||
SystemUIFactory.ContextHolder.class,
|
||||
|
||||
@@ -30,7 +30,7 @@ import dagger.multibindings.IntoMap;
|
||||
* Services and Activities that are injectable should go here.
|
||||
*/
|
||||
@Module
|
||||
public abstract class ActivityBinder {
|
||||
public abstract class DefaultActivityBinder {
|
||||
/** Inject into TunerActivity. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@@ -16,16 +16,13 @@
|
||||
|
||||
package com.android.systemui.dagger;
|
||||
|
||||
import dagger.Binds;
|
||||
import dagger.Module;
|
||||
|
||||
/**
|
||||
* Dagger Module that collects related sub-modules together.
|
||||
*
|
||||
* See {@link ContextComponentResolver}
|
||||
*/
|
||||
@Module(includes = {ActivityBinder.class, ServiceBinder.class, SystemUIBinder.class})
|
||||
public abstract class ComponentBinder {
|
||||
/** */
|
||||
@Binds
|
||||
public abstract ContextComponentHelper bindComponentHelper(
|
||||
ContextComponentResolver componentHelper);
|
||||
@Module(includes = {DefaultActivityBinder.class, DefaultServiceBinder.class, SystemUIBinder.class})
|
||||
public abstract class DefaultComponentBinder {
|
||||
}
|
||||
@@ -31,7 +31,7 @@ import dagger.multibindings.IntoMap;
|
||||
* Services that are injectable should go here.
|
||||
*/
|
||||
@Module
|
||||
public abstract class ServiceBinder {
|
||||
public abstract class DefaultServiceBinder {
|
||||
/** */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@@ -24,6 +24,7 @@ import com.android.systemui.pip.PipUI;
|
||||
import com.android.systemui.power.PowerUI;
|
||||
import com.android.systemui.recents.Recents;
|
||||
import com.android.systemui.recents.RecentsModule;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
import com.android.systemui.util.leak.GarbageMonitor;
|
||||
import com.android.systemui.volume.VolumeUI;
|
||||
|
||||
@@ -80,6 +81,12 @@ public abstract class SystemUIBinder {
|
||||
@ClassKey(ScreenDecorations.class)
|
||||
public abstract SystemUI bindScreenDecorations(ScreenDecorations sysui);
|
||||
|
||||
/** Inject into StatusBar. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(StatusBar.class)
|
||||
public abstract SystemUI bindsStatusBar(StatusBar sysui);
|
||||
|
||||
/** Inject into VolumeUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
|
||||
@@ -21,7 +21,6 @@ import static com.android.systemui.Dependency.LEAK_REPORT_EMAIL_NAME;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.systemui.SystemUI;
|
||||
import com.android.systemui.dock.DockManager;
|
||||
import com.android.systemui.dock.DockManagerImpl;
|
||||
import com.android.systemui.power.EnhancedEstimates;
|
||||
@@ -39,8 +38,6 @@ import javax.inject.Singleton;
|
||||
import dagger.Binds;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import dagger.multibindings.ClassKey;
|
||||
import dagger.multibindings.IntoMap;
|
||||
|
||||
/**
|
||||
* A dagger module for injecting default implementations of components of System UI that may be
|
||||
@@ -74,11 +71,6 @@ abstract class SystemUIDefaultModule {
|
||||
@Binds
|
||||
abstract ShadeController provideShadeController(StatusBar statusBar);
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(StatusBar.class)
|
||||
public abstract SystemUI providesStatusBar(StatusBar statusBar);
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
@Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME)
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.android.systemui.util.sensors.AsyncSensorManager;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Binds;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
@@ -38,9 +39,12 @@ import dagger.Provides;
|
||||
* implementation.
|
||||
*/
|
||||
@Module(includes = {AssistModule.class,
|
||||
ComponentBinder.class,
|
||||
PeopleHubModule.class})
|
||||
public abstract class SystemUIModule {
|
||||
/** */
|
||||
@Binds
|
||||
public abstract ContextComponentHelper bindComponentHelper(
|
||||
ContextComponentResolver componentHelper);
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
@@ -56,7 +60,6 @@ public abstract class SystemUIModule {
|
||||
keyguardUpdateMonitor);
|
||||
}
|
||||
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
static SysUiState provideSysUiState() {
|
||||
|
||||
@@ -37,6 +37,7 @@ import dagger.Component;
|
||||
*/
|
||||
@Singleton
|
||||
@Component(modules = {
|
||||
DefaultComponentBinder.class,
|
||||
DependencyProvider.class,
|
||||
DependencyBinder.class,
|
||||
SystemServicesModule.class,
|
||||
|
||||
Reference in New Issue
Block a user