Refactor SysUI to allow daggerization of implementations
Also daggerize Android Auto. Test: tested locally BUG:139865326 Change-Id: Ia53398ce410ae8f3768142723af578c215f286a9
This commit is contained in:
@@ -47,6 +47,8 @@ android_app {
|
||||
"androidx.lifecycle_lifecycle-extensions",
|
||||
"SystemUI-tags",
|
||||
"SystemUI-proto",
|
||||
"dagger2-2.19",
|
||||
"//external/kotlinc:kotlin-annotations",
|
||||
],
|
||||
|
||||
libs: [
|
||||
|
||||
@@ -20,12 +20,8 @@ import android.content.Context;
|
||||
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.keyguard.ViewMediatorCallback;
|
||||
import com.android.systemui.car.CarNotificationEntryManager;
|
||||
import com.android.systemui.car.CarNotificationInterruptionStateProvider;
|
||||
import com.android.systemui.statusbar.car.CarFacetButtonController;
|
||||
import com.android.systemui.statusbar.car.CarStatusBarKeyguardViewManager;
|
||||
import com.android.systemui.statusbar.notification.NotificationEntryManager;
|
||||
import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider;
|
||||
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
|
||||
import com.android.systemui.volume.CarVolumeDialogComponent;
|
||||
import com.android.systemui.volume.VolumeDialogComponent;
|
||||
@@ -33,8 +29,6 @@ import com.android.systemui.volume.VolumeDialogComponent;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Component;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
/**
|
||||
* Class factory to provide car specific SystemUI components.
|
||||
@@ -44,11 +38,14 @@ public class CarSystemUIFactory extends SystemUIFactory {
|
||||
private CarDependencyComponent mCarDependencyComponent;
|
||||
|
||||
@Override
|
||||
protected void init(Context context) {
|
||||
super.init(context);
|
||||
protected SystemUIRootComponent buildSystemUIRootComponent(Context context) {
|
||||
mCarDependencyComponent = DaggerCarSystemUIFactory_CarDependencyComponent.builder()
|
||||
.contextHolder(new ContextHolder(context))
|
||||
.build();
|
||||
return DaggerCarSystemUIRootComponent.builder()
|
||||
.dependencyProvider(new com.android.systemui.DependencyProvider())
|
||||
.contextHolder(new ContextHolder(context))
|
||||
.build();
|
||||
}
|
||||
|
||||
public CarDependencyComponent getCarDependencyComponent() {
|
||||
@@ -64,42 +61,9 @@ public class CarSystemUIFactory extends SystemUIFactory {
|
||||
return new CarVolumeDialogComponent(systemUi, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NotificationInterruptionStateProvider provideNotificationInterruptionStateProvider(
|
||||
Context context) {
|
||||
return new CarNotificationInterruptionStateProvider(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean provideAllowNotificationLongPress() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Module
|
||||
protected static class ContextHolder {
|
||||
private Context mContext;
|
||||
|
||||
public ContextHolder(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Provides
|
||||
public Context provideContext() {
|
||||
return mContext;
|
||||
}
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Component(modules = ContextHolder.class)
|
||||
public interface CarDependencyComponent {
|
||||
CarFacetButtonController getCarFacetButtonController();
|
||||
}
|
||||
|
||||
/**
|
||||
* Use {@link CarNotificationEntryManager}, which does nothing when adding a notification.
|
||||
*/
|
||||
@Singleton
|
||||
public NotificationEntryManager provideNotificationEntryManager(Context context) {
|
||||
return new CarNotificationEntryManager(context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* 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 static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME;
|
||||
import static com.android.systemui.Dependency.LEAK_REPORT_EMAIL_NAME;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.systemui.car.CarNotificationEntryManager;
|
||||
import com.android.systemui.car.CarNotificationInterruptionStateProvider;
|
||||
import com.android.systemui.dock.DockManager;
|
||||
import com.android.systemui.dock.DockManagerImpl;
|
||||
import com.android.systemui.power.EnhancedEstimates;
|
||||
import com.android.systemui.power.EnhancedEstimatesImpl;
|
||||
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
|
||||
import com.android.systemui.statusbar.NotificationLockscreenUserManagerImpl;
|
||||
import com.android.systemui.statusbar.notification.NotificationEntryManager;
|
||||
import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider;
|
||||
import com.android.systemui.statusbar.notification.collection.NotificationData;
|
||||
import com.android.systemui.statusbar.phone.KeyguardEnvironmentImpl;
|
||||
import com.android.systemui.statusbar.phone.ShadeController;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Binds;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
@Module
|
||||
abstract class CarSystemUIModule {
|
||||
|
||||
@Binds
|
||||
abstract NotificationInterruptionStateProvider bindNotificationInterruptionStateProvider(
|
||||
CarNotificationInterruptionStateProvider notificationInterruptionStateProvider);
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
@Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME)
|
||||
static boolean provideAllowNotificationLongPress() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use {@link CarNotificationEntryManager}, which does nothing when adding a notification.
|
||||
*/
|
||||
@Binds
|
||||
abstract NotificationEntryManager bindNotificationEntryManager(
|
||||
CarNotificationEntryManager notificationEntryManager);
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
@Named(LEAK_REPORT_EMAIL_NAME)
|
||||
static String provideLeakReportEmail() {
|
||||
return "buganizer-system+181579@google.com";
|
||||
}
|
||||
|
||||
@Binds
|
||||
abstract EnhancedEstimates bindEnhancedEstimates(EnhancedEstimatesImpl enhancedEstimates);
|
||||
|
||||
@Binds
|
||||
abstract NotificationLockscreenUserManager bindNotificationLockscreenUserManager(
|
||||
NotificationLockscreenUserManagerImpl notificationLockscreenUserManager);
|
||||
|
||||
@Binds
|
||||
abstract DockManager bindDockManager(DockManagerImpl dockManager);
|
||||
|
||||
@Binds
|
||||
abstract NotificationData.KeyguardEnvironment bindKeyguardEnvironment(
|
||||
KeyguardEnvironmentImpl keyguardEnvironment);
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
static ShadeController provideShadeController(Context context) {
|
||||
return SysUiServiceProvider.getComponent(context, StatusBar.class);
|
||||
}
|
||||
|
||||
@Binds
|
||||
abstract SystemUIRootComponent bindSystemUIRootComponent(
|
||||
CarSystemUIRootComponent systemUIRootComponent);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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 javax.inject.Singleton;
|
||||
|
||||
import dagger.Component;
|
||||
|
||||
@Singleton
|
||||
@Component(
|
||||
modules = {
|
||||
DependencyProvider.class,
|
||||
DependencyBinder.class,
|
||||
ServiceBinder.class,
|
||||
SystemUIFactory.ContextHolder.class,
|
||||
SystemUIModule.class,
|
||||
CarSystemUIModule.class
|
||||
})
|
||||
interface CarSystemUIRootComponent extends SystemUIRootComponent {
|
||||
|
||||
}
|
||||
@@ -21,13 +21,19 @@ import android.service.notification.StatusBarNotification;
|
||||
|
||||
import com.android.systemui.statusbar.notification.NotificationEntryManager;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Car specific notification entry manager that does nothing when adding a notification.
|
||||
*
|
||||
* <p> This is because system UI notifications are disabled and we have a different implementation.
|
||||
* Please see {@link com.android.car.notification}.
|
||||
*/
|
||||
@Singleton
|
||||
public class CarNotificationEntryManager extends NotificationEntryManager {
|
||||
|
||||
@Inject
|
||||
public CarNotificationEntryManager(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@@ -21,9 +21,15 @@ import android.content.Context;
|
||||
import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider;
|
||||
import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/** Auto-specific implementation of {@link NotificationInterruptionStateProvider}. */
|
||||
@Singleton
|
||||
public class CarNotificationInterruptionStateProvider extends
|
||||
NotificationInterruptionStateProvider {
|
||||
|
||||
@Inject
|
||||
public CarNotificationInterruptionStateProvider(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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 static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME;
|
||||
import static com.android.systemui.Dependency.LEAK_REPORT_EMAIL_NAME;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.systemui.dock.DockManager;
|
||||
import com.android.systemui.dock.DockManagerImpl;
|
||||
import com.android.systemui.power.EnhancedEstimates;
|
||||
import com.android.systemui.power.EnhancedEstimatesImpl;
|
||||
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
|
||||
import com.android.systemui.statusbar.NotificationLockscreenUserManagerImpl;
|
||||
import com.android.systemui.statusbar.notification.collection.NotificationData;
|
||||
import com.android.systemui.statusbar.phone.KeyguardEnvironmentImpl;
|
||||
import com.android.systemui.statusbar.phone.ShadeController;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Binds;
|
||||
import dagger.Module;
|
||||
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
|
||||
abstract class SystemUIDefaultModule {
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
@Named(LEAK_REPORT_EMAIL_NAME)
|
||||
@Nullable
|
||||
static String provideLeakReportEmail() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Binds
|
||||
abstract EnhancedEstimates bindEnhancedEstimates(EnhancedEstimatesImpl enhancedEstimates);
|
||||
|
||||
@Binds
|
||||
abstract NotificationLockscreenUserManager bindNotificationLockscreenUserManager(
|
||||
NotificationLockscreenUserManagerImpl notificationLockscreenUserManager);
|
||||
|
||||
@Binds
|
||||
abstract DockManager bindDockManager(DockManagerImpl dockManager);
|
||||
|
||||
@Binds
|
||||
abstract NotificationData.KeyguardEnvironment bindKeyguardEnvironment(
|
||||
KeyguardEnvironmentImpl keyguardEnvironment);
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
static ShadeController provideShadeController(Context context) {
|
||||
return SysUiServiceProvider.getComponent(context, StatusBar.class);
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
@Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME)
|
||||
static boolean provideAllowNotificationLongPress() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -16,14 +16,9 @@
|
||||
|
||||
package com.android.systemui;
|
||||
|
||||
import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME;
|
||||
import static com.android.systemui.Dependency.LEAK_REPORT_EMAIL_NAME;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.AlarmManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
@@ -34,59 +29,40 @@ import com.android.internal.util.function.TriConsumer;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||
import com.android.keyguard.ViewMediatorCallback;
|
||||
import com.android.systemui.assist.AssistManager;
|
||||
import com.android.systemui.dock.DockManager;
|
||||
import com.android.systemui.keyguard.DismissCallbackRegistry;
|
||||
import com.android.systemui.plugins.FalsingManager;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||
import com.android.systemui.power.EnhancedEstimates;
|
||||
import com.android.systemui.power.EnhancedEstimatesImpl;
|
||||
import com.android.systemui.statusbar.KeyguardIndicationController;
|
||||
import com.android.systemui.statusbar.NotificationListener;
|
||||
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
|
||||
import com.android.systemui.statusbar.NotificationLockscreenUserManagerImpl;
|
||||
import com.android.systemui.statusbar.NotificationMediaManager;
|
||||
import com.android.systemui.statusbar.ScrimView;
|
||||
import com.android.systemui.statusbar.notification.NotificationEntryManager;
|
||||
import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider;
|
||||
import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
|
||||
import com.android.systemui.statusbar.notification.collection.NotificationData;
|
||||
import com.android.systemui.statusbar.phone.DozeParameters;
|
||||
import com.android.systemui.statusbar.phone.KeyguardBouncer;
|
||||
import com.android.systemui.statusbar.phone.KeyguardBypassController;
|
||||
import com.android.systemui.statusbar.phone.KeyguardEnvironmentImpl;
|
||||
import com.android.systemui.statusbar.phone.KeyguardLiftController;
|
||||
import com.android.systemui.statusbar.phone.LockIcon;
|
||||
import com.android.systemui.statusbar.phone.LockscreenWallpaper;
|
||||
import com.android.systemui.statusbar.phone.NotificationIconAreaController;
|
||||
import com.android.systemui.statusbar.phone.ScrimController;
|
||||
import com.android.systemui.statusbar.phone.ScrimState;
|
||||
import com.android.systemui.statusbar.phone.ShadeController;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
|
||||
import com.android.systemui.statusbar.phone.UnlockMethodCache;
|
||||
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
|
||||
import com.android.systemui.statusbar.policy.KeyguardMonitor;
|
||||
import com.android.systemui.util.AsyncSensorManager;
|
||||
import com.android.systemui.volume.VolumeDialogComponent;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
/**
|
||||
* Class factory to provide customizable SystemUI components.
|
||||
*/
|
||||
@Module
|
||||
public class SystemUIFactory {
|
||||
private static final String TAG = "SystemUIFactory";
|
||||
|
||||
static SystemUIFactory mFactory;
|
||||
private SystemUIRootComponent mRootComponent;
|
||||
protected SystemUIRootComponent mRootComponent;
|
||||
|
||||
public static <T extends SystemUIFactory> T getInstance() {
|
||||
return (T) mFactory;
|
||||
@@ -111,12 +87,11 @@ public class SystemUIFactory {
|
||||
|
||||
public SystemUIFactory() {}
|
||||
|
||||
protected void init(Context context) {
|
||||
initWithRootComponent(DaggerSystemUIRootComponent.builder()
|
||||
.systemUIFactory(this)
|
||||
.dependencyProvider(new com.android.systemui.DependencyProvider())
|
||||
.contextHolder(new ContextHolder(context))
|
||||
.build());
|
||||
private void init(Context context) {
|
||||
initWithRootComponent(buildSystemUIRootComponent(context));
|
||||
// Every other part of our codebase currently relies on Dependency, so we
|
||||
// really need to ensure the Dependency gets initialized early on.
|
||||
Dependency.initDependencies(context);
|
||||
}
|
||||
|
||||
protected void initWithRootComponent(@NonNull SystemUIRootComponent rootComponent) {
|
||||
@@ -127,6 +102,13 @@ public class SystemUIFactory {
|
||||
mRootComponent = rootComponent;
|
||||
}
|
||||
|
||||
protected SystemUIRootComponent buildSystemUIRootComponent(Context context) {
|
||||
return DaggerSystemUIRootComponent.builder()
|
||||
.dependencyProvider(new com.android.systemui.DependencyProvider())
|
||||
.contextHolder(new ContextHolder(context))
|
||||
.build();
|
||||
}
|
||||
|
||||
public SystemUIRootComponent getRootComponent() {
|
||||
return mRootComponent;
|
||||
}
|
||||
@@ -176,93 +158,8 @@ public class SystemUIFactory {
|
||||
return new VolumeDialogComponent(systemUi, context);
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
public NotificationData.KeyguardEnvironment provideKeyguardEnvironment(Context context) {
|
||||
return new KeyguardEnvironmentImpl();
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
public NotificationLockscreenUserManager provideNotificationLockscreenUserManager(
|
||||
Context context) {
|
||||
return new NotificationLockscreenUserManagerImpl(context);
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
public AssistManager provideAssistManager(DeviceProvisionedController controller,
|
||||
Context context) {
|
||||
return new AssistManager(controller, context);
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
@Nullable
|
||||
public DockManager provideDockManager(Context context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
public NotificationEntryManager provideNotificationEntryManager(Context context) {
|
||||
return new NotificationEntryManager(context);
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
public EnhancedEstimates provideEnhancedEstimates(Context context) {
|
||||
return new EnhancedEstimatesImpl();
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
@Named(LEAK_REPORT_EMAIL_NAME)
|
||||
@Nullable
|
||||
public String provideLeakReportEmail() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
@Nullable
|
||||
public KeyguardLiftController provideKeyguardLiftController(Context context,
|
||||
StatusBarStateController statusBarStateController,
|
||||
AsyncSensorManager asyncSensorManager) {
|
||||
if (!context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE)) {
|
||||
return null;
|
||||
}
|
||||
return new KeyguardLiftController(context, statusBarStateController, asyncSensorManager);
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
public NotificationListener provideNotificationListener(Context context) {
|
||||
return new NotificationListener(context);
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
public NotificationInterruptionStateProvider provideNotificationInterruptionStateProvider(
|
||||
Context context) {
|
||||
return new NotificationInterruptionStateProvider(context);
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
@Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME)
|
||||
public boolean provideAllowNotificationLongPress() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
public ShadeController provideShadeController(Context context) {
|
||||
return SysUiServiceProvider.getComponent(context, StatusBar.class);
|
||||
}
|
||||
|
||||
@Module
|
||||
protected static class ContextHolder {
|
||||
public static class ContextHolder {
|
||||
private Context mContext;
|
||||
|
||||
public ContextHolder(Context context) {
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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 android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||
import com.android.systemui.statusbar.phone.KeyguardLiftController;
|
||||
import com.android.systemui.util.AsyncSensorManager;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
|
||||
/**
|
||||
* A dagger module for injecting components of System UI that are not overridden by the System UI
|
||||
* implementation.
|
||||
*/
|
||||
@Module
|
||||
public abstract class SystemUIModule {
|
||||
|
||||
@Singleton
|
||||
@Provides
|
||||
@Nullable
|
||||
static KeyguardLiftController provideKeyguardLiftController(Context context,
|
||||
StatusBarStateController statusBarStateController,
|
||||
AsyncSensorManager asyncSensorManager) {
|
||||
if (!context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE)) {
|
||||
return null;
|
||||
}
|
||||
return new KeyguardLiftController(context, statusBarStateController, asyncSensorManager);
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,14 @@
|
||||
|
||||
package com.android.systemui;
|
||||
|
||||
import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME;
|
||||
|
||||
import com.android.systemui.fragments.FragmentService;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
import com.android.systemui.util.InjectionInflationController;
|
||||
import com.android.systemui.util.leak.GarbageMonitor;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Component;
|
||||
@@ -29,8 +32,13 @@ import dagger.Component;
|
||||
* Root component for Dagger injection.
|
||||
*/
|
||||
@Singleton
|
||||
@Component(modules = {SystemUIFactory.class, DependencyProvider.class, DependencyBinder.class,
|
||||
ServiceBinder.class, SystemUIFactory.ContextHolder.class})
|
||||
@Component(modules = {
|
||||
DependencyProvider.class,
|
||||
DependencyBinder.class,
|
||||
ServiceBinder.class,
|
||||
SystemUIFactory.ContextHolder.class,
|
||||
SystemUIModule.class,
|
||||
SystemUIDefaultModule.class})
|
||||
public interface SystemUIRootComponent {
|
||||
/**
|
||||
* Main dependency providing module.
|
||||
@@ -61,6 +69,12 @@ public interface SystemUIRootComponent {
|
||||
@Singleton
|
||||
GarbageMonitor createGarbageMonitor();
|
||||
|
||||
/**
|
||||
* Whether notification long press is allowed.
|
||||
*/
|
||||
@Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME)
|
||||
boolean allowNotificationLongPressName();
|
||||
|
||||
/**
|
||||
* Injects into the supplied argument.
|
||||
*/
|
||||
|
||||
@@ -48,9 +48,13 @@ import com.android.systemui.recents.OverviewProxyService;
|
||||
import com.android.systemui.statusbar.CommandQueue;
|
||||
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Class to manage everything related to assist in SystemUI.
|
||||
*/
|
||||
@Singleton
|
||||
public class AssistManager implements ConfigurationChangedReceiver {
|
||||
|
||||
/**
|
||||
@@ -147,6 +151,7 @@ public class AssistManager implements ConfigurationChangedReceiver {
|
||||
}
|
||||
};
|
||||
|
||||
@Inject
|
||||
public AssistManager(DeviceProvisionedController controller, Context context) {
|
||||
mContext = context;
|
||||
mDeviceProvisionedController = controller;
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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.dock;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@Singleton
|
||||
public class DockManagerImpl implements DockManager {
|
||||
|
||||
@Inject
|
||||
public DockManagerImpl() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(DockEventListener callback) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(DockEventListener callback) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDocked() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,16 @@ package com.android.systemui.power;
|
||||
|
||||
import com.android.settingslib.fuelgauge.Estimate;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@Singleton
|
||||
public class EnhancedEstimatesImpl implements EnhancedEstimates {
|
||||
|
||||
@Inject
|
||||
public EnhancedEstimatesImpl() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHybridNotificationEnabled() {
|
||||
return false;
|
||||
|
||||
@@ -37,11 +37,15 @@ import com.android.systemui.statusbar.phone.NotificationListenerWithPlugins;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* This class handles listening to notification updates and passing them along to
|
||||
* NotificationPresenter to be displayed to the user.
|
||||
*/
|
||||
@SuppressLint("OverrideAbstract")
|
||||
@Singleton
|
||||
public class NotificationListener extends NotificationListenerWithPlugins {
|
||||
private static final String TAG = "NotificationListener";
|
||||
|
||||
@@ -56,6 +60,7 @@ public class NotificationListener extends NotificationListenerWithPlugins {
|
||||
private final ArrayList<NotificationSettingsListener> mSettingsListeners = new ArrayList<>();
|
||||
private final Context mContext;
|
||||
|
||||
@Inject
|
||||
public NotificationListener(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@@ -58,10 +58,14 @@ import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Handles keeping track of the current user, profiles, and various things related to hiding
|
||||
* contents, redacting notifications, and the lockscreen.
|
||||
*/
|
||||
@Singleton
|
||||
public class NotificationLockscreenUserManagerImpl implements
|
||||
Dumpable, NotificationLockscreenUserManager, StateListener {
|
||||
private static final String TAG = "LockscreenUserManager";
|
||||
@@ -171,6 +175,7 @@ public class NotificationLockscreenUserManagerImpl implements
|
||||
return mEntryManager;
|
||||
}
|
||||
|
||||
@Inject
|
||||
public NotificationLockscreenUserManagerImpl(Context context) {
|
||||
mContext = context;
|
||||
mDevicePolicyManager = (DevicePolicyManager) mContext.getSystemService(
|
||||
|
||||
@@ -54,11 +54,15 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* NotificationEntryManager is responsible for the adding, removing, and updating of notifications.
|
||||
* It also handles tasks such as their inflation and their interaction with other
|
||||
* Notification.*Manager objects.
|
||||
*/
|
||||
@Singleton
|
||||
public class NotificationEntryManager implements
|
||||
Dumpable,
|
||||
NotificationContentInflater.InflationCallback,
|
||||
@@ -118,6 +122,7 @@ public class NotificationEntryManager implements
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
public NotificationEntryManager(Context context) {
|
||||
mNotificationData = new NotificationData();
|
||||
}
|
||||
|
||||
@@ -42,9 +42,13 @@ import com.android.systemui.statusbar.notification.collection.NotificationEntry;
|
||||
import com.android.systemui.statusbar.phone.ShadeController;
|
||||
import com.android.systemui.statusbar.policy.HeadsUpManager;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Provides heads-up and pulsing state for notification entries.
|
||||
*/
|
||||
@Singleton
|
||||
public class NotificationInterruptionStateProvider {
|
||||
|
||||
private static final String TAG = "InterruptionStateProvider";
|
||||
@@ -72,6 +76,7 @@ public class NotificationInterruptionStateProvider {
|
||||
protected boolean mUseHeadsUp = false;
|
||||
private boolean mDisableNotificationAlerts;
|
||||
|
||||
@Inject
|
||||
public NotificationInterruptionStateProvider(Context context) {
|
||||
this(context,
|
||||
(PowerManager) context.getSystemService(Context.POWER_SERVICE),
|
||||
|
||||
@@ -25,6 +25,10 @@ import com.android.systemui.statusbar.NotificationLockscreenUserManager;
|
||||
import com.android.systemui.statusbar.notification.collection.NotificationData.KeyguardEnvironment;
|
||||
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@Singleton
|
||||
public class KeyguardEnvironmentImpl implements KeyguardEnvironment {
|
||||
|
||||
private static final String TAG = "KeyguardEnvironmentImpl";
|
||||
@@ -34,6 +38,7 @@ public class KeyguardEnvironmentImpl implements KeyguardEnvironment {
|
||||
private final DeviceProvisionedController mDeviceProvisionedController =
|
||||
Dependency.get(DeviceProvisionedController.class);
|
||||
|
||||
@Inject
|
||||
public KeyguardEnvironmentImpl() {
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import static android.app.StatusBarManager.WindowVisibleState;
|
||||
import static android.app.StatusBarManager.windowStateToString;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN_OR_SPLIT_SCREEN_SECONDARY;
|
||||
|
||||
import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME;
|
||||
import static com.android.systemui.Dependency.BG_HANDLER;
|
||||
import static com.android.systemui.Dependency.MAIN_HANDLER;
|
||||
import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_ASLEEP;
|
||||
@@ -238,6 +239,7 @@ import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@@ -382,6 +384,9 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
@Nullable
|
||||
@Inject
|
||||
protected KeyguardLiftController mKeyguardLiftController;
|
||||
@Inject
|
||||
@Named(ALLOW_NOTIFICATION_LONG_PRESS_NAME)
|
||||
boolean mAllowNotificationLongPress;
|
||||
|
||||
// expanded notifications
|
||||
protected NotificationPanelView mNotificationPanel; // the sliding/resizing panel within the notification window
|
||||
@@ -1075,7 +1080,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
final NotificationRowBinderImpl rowBinder =
|
||||
new NotificationRowBinderImpl(
|
||||
mContext,
|
||||
SystemUIFactory.getInstance().provideAllowNotificationLongPress(),
|
||||
mAllowNotificationLongPress,
|
||||
mKeyguardBypassController,
|
||||
mStatusBarStateController);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user