diff options
55 files changed, 433 insertions, 269 deletions
diff --git a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIFactory.java b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIFactory.java index 011d5ea9d86b..be4b8897d00b 100644 --- a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIFactory.java +++ b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIFactory.java @@ -20,6 +20,7 @@ import android.content.Context; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.ViewMediatorCallback; +import com.android.systemui.dagger.SystemUIRootComponent; import com.android.systemui.navigationbar.car.CarFacetButtonController; import com.android.systemui.statusbar.car.CarStatusBarKeyguardViewManager; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; diff --git a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java index b1067f8c3df5..0f44e0815a86 100644 --- a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java +++ b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIModule.java @@ -23,6 +23,7 @@ import android.content.Context; import com.android.systemui.car.CarNotificationEntryManager; import com.android.systemui.car.CarNotificationInterruptionStateProvider; +import com.android.systemui.dagger.SystemUIRootComponent; import com.android.systemui.dock.DockManager; import com.android.systemui.dock.DockManagerImpl; import com.android.systemui.power.EnhancedEstimates; diff --git a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIRootComponent.java b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIRootComponent.java index 325c98890b11..c2847c88785b 100644 --- a/packages/CarSystemUI/src/com/android/systemui/CarSystemUIRootComponent.java +++ b/packages/CarSystemUI/src/com/android/systemui/CarSystemUIRootComponent.java @@ -16,6 +16,12 @@ package com.android.systemui; +import com.android.systemui.dagger.DependencyBinder; +import com.android.systemui.dagger.DependencyProvider; +import com.android.systemui.dagger.SystemServicesModule; +import com.android.systemui.dagger.SystemUIModule; +import com.android.systemui.dagger.SystemUIRootComponent; + import javax.inject.Singleton; import dagger.Component; @@ -26,6 +32,7 @@ import dagger.Component; DependencyProvider.class, DependencyBinder.class, SystemUIFactory.ContextHolder.class, + SystemServicesModule.class, SystemUIModule.class, CarSystemUIModule.class, CarSystemUIBinder.class diff --git a/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBar.java b/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBar.java index 5bb35309edd2..6fba1d516c73 100644 --- a/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBar.java +++ b/packages/CarSystemUI/src/com/android/systemui/navigationbar/car/CarNavigationBar.java @@ -16,8 +16,6 @@ package com.android.systemui.navigationbar.car; -import static com.android.systemui.Dependency.MAIN_HANDLER_NAME; - import android.content.Context; import android.graphics.PixelFormat; import android.inputmethodservice.InputMethodService; @@ -35,6 +33,7 @@ import com.android.internal.statusbar.IStatusBarService; import com.android.internal.statusbar.RegisterStatusBarResult; import com.android.systemui.R; import com.android.systemui.SystemUI; +import com.android.systemui.dagger.qualifiers.MainHandler; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.NavigationBarController; @@ -47,7 +46,6 @@ import java.io.FileDescriptor; import java.io.PrintWriter; import javax.inject.Inject; -import javax.inject.Named; import dagger.Lazy; @@ -96,7 +94,7 @@ public class CarNavigationBar extends SystemUI implements CommandQueue.Callbacks WindowManager windowManager, DeviceProvisionedController deviceProvisionedController, Lazy<FacetButtonTaskStackListener> facetButtonTaskStackListener, - @Named(MAIN_HANDLER_NAME) Handler mainHandler, + @MainHandler Handler mainHandler, Lazy<KeyguardStateController> keyguardStateController, Lazy<CarFacetButtonController> facetButtonController, Lazy<NavigationBarController> navigationBarController, diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index ac5e255289cf..27410be09db0 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -39,7 +39,6 @@ import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STR import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_TIMEOUT; import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN; import static com.android.systemui.DejankUtils.whitelistIpcs; -import static com.android.systemui.Dependency.MAIN_LOOPER_NAME; import android.annotation.AnyThread; import android.annotation.MainThread; @@ -101,6 +100,7 @@ import com.android.internal.widget.LockPatternUtils; import com.android.settingslib.WirelessUtils; import com.android.systemui.DejankUtils; import com.android.systemui.R; +import com.android.systemui.dagger.qualifiers.MainLooper; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.TaskStackChangeListener; import com.android.systemui.statusbar.phone.KeyguardBypassController; @@ -118,7 +118,6 @@ import java.util.TimeZone; import java.util.function.Consumer; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; /** @@ -1500,7 +1499,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { @VisibleForTesting @Inject - protected KeyguardUpdateMonitor(Context context, @Named(MAIN_LOOPER_NAME) Looper mainLooper) { + protected KeyguardUpdateMonitor(Context context, @MainLooper Looper mainLooper) { mContext = context; mSubscriptionManager = SubscriptionManager.from(context); mDeviceProvisioned = isDeviceProvisionedInSettingsDb(); diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java index ff8a932a6a92..486d02c207db 100644 --- a/packages/SystemUI/src/com/android/systemui/Dependency.java +++ b/packages/SystemUI/src/com/android/systemui/Dependency.java @@ -40,6 +40,10 @@ import com.android.systemui.assist.AssistManager; import com.android.systemui.broadcast.BroadcastDispatcher; import com.android.systemui.bubbles.BubbleController; import com.android.systemui.colorextraction.SysuiColorExtractor; +import com.android.systemui.dagger.qualifiers.BgHandler; +import com.android.systemui.dagger.qualifiers.BgLooper; +import com.android.systemui.dagger.qualifiers.MainHandler; +import com.android.systemui.dagger.qualifiers.MainLooper; import com.android.systemui.dock.DockManager; import com.android.systemui.fragments.FragmentService; import com.android.systemui.keyguard.ScreenLifecycle; @@ -148,16 +152,16 @@ public class Dependency { /** * Key for getting a the main looper. */ - public static final String MAIN_LOOPER_NAME = "main_looper"; + private static final String MAIN_LOOPER_NAME = "main_looper"; /** * Key for getting a background Looper for background work. */ - public static final String BG_LOOPER_NAME = "background_looper"; + private static final String BG_LOOPER_NAME = "background_looper"; /** * Key for getting a background Handler for background work. */ - public static final String BG_HANDLER_NAME = "background_handler"; + private static final String BG_HANDLER_NAME = "background_handler"; /** * Key for getting a Handler for receiving time tick broadcasts on. */ @@ -165,7 +169,7 @@ public class Dependency { /** * Generic handler on the main thread. */ - public static final String MAIN_HANDLER_NAME = "main_handler"; + private static final String MAIN_HANDLER_NAME = "main_handler"; /** * An email address to send memory leak reports to by default. @@ -300,10 +304,10 @@ public class Dependency { @Inject Lazy<AutoHideController> mAutoHideController; @Inject Lazy<ForegroundServiceNotificationListener> mForegroundServiceNotificationListener; @Inject Lazy<PrivacyItemController> mPrivacyItemController; - @Inject @Named(BG_LOOPER_NAME) Lazy<Looper> mBgLooper; - @Inject @Named(BG_HANDLER_NAME) Lazy<Handler> mBgHandler; - @Inject @Named(MAIN_LOOPER_NAME) Lazy<Looper> mMainLooper; - @Inject @Named(MAIN_HANDLER_NAME) Lazy<Handler> mMainHandler; + @Inject @BgLooper Lazy<Looper> mBgLooper; + @Inject @BgHandler Lazy<Handler> mBgHandler; + @Inject @MainLooper Lazy<Looper> mMainLooper; + @Inject @MainHandler Lazy<Handler> mMainHandler; @Inject @Named(TIME_TICK_HANDLER_NAME) Lazy<Handler> mTimeTickHandler; @Nullable @Inject @Named(LEAK_REPORT_EMAIL_NAME) Lazy<String> mLeakReportEmail; diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIAppComponentFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIAppComponentFactory.java index aa13fa834f56..746515a816b3 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIAppComponentFactory.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIAppComponentFactory.java @@ -27,6 +27,8 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.app.AppComponentFactory; +import com.android.systemui.dagger.ContextComponentHelper; + import javax.inject.Inject; /** diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java index 91776a335f0d..022bf06838a6 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIApplication.java @@ -34,6 +34,7 @@ import android.util.ArraySet; import android.util.Log; import android.util.TimingsTraceLog; +import com.android.systemui.dagger.ContextComponentHelper; import com.android.systemui.plugins.OverlayPlugin; import com.android.systemui.plugins.PluginListener; import com.android.systemui.shared.plugins.PluginManager; diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java index 11db481a425b..0a547b6bf051 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java +++ b/packages/SystemUI/src/com/android/systemui/SystemUIFactory.java @@ -27,6 +27,9 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.ViewMediatorCallback; +import com.android.systemui.dagger.DaggerSystemUIRootComponent; +import com.android.systemui.dagger.DependencyProvider; +import com.android.systemui.dagger.SystemUIRootComponent; import com.android.systemui.keyguard.DismissCallbackRegistry; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; @@ -107,7 +110,7 @@ public class SystemUIFactory { protected SystemUIRootComponent buildSystemUIRootComponent(Context context) { return DaggerSystemUIRootComponent.builder() - .dependencyProvider(new com.android.systemui.DependencyProvider()) + .dependencyProvider(new DependencyProvider()) .contextHolder(new ContextHolder(context)) .build(); } diff --git a/packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java b/packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java index ef171d305d28..f616d57e90aa 100644 --- a/packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java @@ -16,8 +16,6 @@ package com.android.systemui.appops; -import static com.android.systemui.Dependency.BG_LOOPER_NAME; - import android.app.AppOpsManager; import android.content.Context; import android.content.pm.PackageManager; @@ -31,6 +29,7 @@ import android.util.Log; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.Dumpable; +import com.android.systemui.dagger.qualifiers.BgLooper; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -39,7 +38,6 @@ import java.util.List; import java.util.Set; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; /** @@ -79,7 +77,7 @@ public class AppOpsControllerImpl implements AppOpsController, }; @Inject - public AppOpsControllerImpl(Context context, @Named(BG_LOOPER_NAME) Looper bgLooper) { + public AppOpsControllerImpl(Context context, @BgLooper Looper bgLooper) { this(context, bgLooper, new PermissionFlagsCache(context)); } diff --git a/packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcher.kt b/packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcher.kt index 5e977b4684dc..ff4711cb208a 100644 --- a/packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcher.kt +++ b/packages/SystemUI/src/com/android/systemui/broadcast/BroadcastDispatcher.kt @@ -26,13 +26,12 @@ import android.os.UserHandle import android.util.Log import android.util.SparseArray import com.android.internal.annotations.VisibleForTesting -import com.android.systemui.Dependency.BG_LOOPER_NAME -import com.android.systemui.Dependency.MAIN_HANDLER_NAME import com.android.systemui.Dumpable +import com.android.systemui.dagger.qualifiers.BgLooper +import com.android.systemui.dagger.qualifiers.MainHandler import java.io.FileDescriptor import java.io.PrintWriter import javax.inject.Inject -import javax.inject.Named import javax.inject.Singleton data class ReceiverData( @@ -61,8 +60,8 @@ private const val DEBUG = false @Singleton open class BroadcastDispatcher @Inject constructor ( private val context: Context, - @Named(MAIN_HANDLER_NAME) private val mainHandler: Handler, - @Named(BG_LOOPER_NAME) private val bgLooper: Looper + @MainHandler private val mainHandler: Handler, + @BgLooper private val bgLooper: Looper ) : Dumpable { // Only modify in BG thread diff --git a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerProxy.java b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerProxy.java index 914258f48b46..db85fa0a3203 100644 --- a/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerProxy.java +++ b/packages/SystemUI/src/com/android/systemui/classifier/FalsingManagerProxy.java @@ -17,7 +17,6 @@ package com.android.systemui.classifier; import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.BRIGHTLINE_FALSING_MANAGER_ENABLED; -import static com.android.systemui.Dependency.MAIN_HANDLER_NAME; import android.content.Context; import android.hardware.SensorManager; @@ -31,6 +30,7 @@ import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.Dependency; import com.android.systemui.classifier.brightline.BrightLineFalsingManager; import com.android.systemui.classifier.brightline.FalsingDataProvider; +import com.android.systemui.dagger.qualifiers.MainHandler; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.FalsingPlugin; import com.android.systemui.plugins.PluginListener; @@ -41,7 +41,6 @@ import com.android.systemui.util.sensors.ProximitySensor; import java.io.PrintWriter; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; /** @@ -62,7 +61,7 @@ public class FalsingManagerProxy implements FalsingManager { @Inject FalsingManagerProxy(Context context, PluginManager pluginManager, - @Named(MAIN_HANDLER_NAME) Handler handler, + @MainHandler Handler handler, ProximitySensor proximitySensor, DeviceConfigProxy deviceConfig) { mProximitySensor = proximitySensor; diff --git a/packages/SystemUI/src/com/android/systemui/ActivityBinder.java b/packages/SystemUI/src/com/android/systemui/dagger/ActivityBinder.java index 2c8a67270d94..4be610fcd9ee 100644 --- a/packages/SystemUI/src/com/android/systemui/ActivityBinder.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/ActivityBinder.java @@ -14,10 +14,11 @@ * limitations under the License. */ -package com.android.systemui; +package com.android.systemui.dagger; import android.app.Activity; +import com.android.systemui.ForegroundServicesDialog; import com.android.systemui.tuner.TunerActivity; import dagger.Binds; diff --git a/packages/SystemUI/src/com/android/systemui/ComponentBinder.java b/packages/SystemUI/src/com/android/systemui/dagger/ComponentBinder.java index 3b35c61e8eb2..4e4c06e9d447 100644 --- a/packages/SystemUI/src/com/android/systemui/ComponentBinder.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/ComponentBinder.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui; +package com.android.systemui.dagger; import dagger.Binds; import dagger.Module; diff --git a/packages/SystemUI/src/com/android/systemui/ContextComponentHelper.java b/packages/SystemUI/src/com/android/systemui/dagger/ContextComponentHelper.java index 2cf0f8dafcad..d6d1e418240a 100644 --- a/packages/SystemUI/src/com/android/systemui/ContextComponentHelper.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/ContextComponentHelper.java @@ -14,11 +14,13 @@ * limitations under the License. */ -package com.android.systemui; +package com.android.systemui.dagger; import android.app.Activity; import android.app.Service; +import com.android.systemui.SystemUI; + /** * Interface necessary to make Dagger happy. See {@link ContextComponentResolver}. */ diff --git a/packages/SystemUI/src/com/android/systemui/ContextComponentResolver.java b/packages/SystemUI/src/com/android/systemui/dagger/ContextComponentResolver.java index 995263240e2d..d7822c9fc6da 100644 --- a/packages/SystemUI/src/com/android/systemui/ContextComponentResolver.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/ContextComponentResolver.java @@ -14,11 +14,13 @@ * limitations under the License. */ -package com.android.systemui; +package com.android.systemui.dagger; import android.app.Activity; import android.app.Service; +import com.android.systemui.SystemUI; + import java.util.Map; import javax.inject.Inject; diff --git a/packages/SystemUI/src/com/android/systemui/DependencyBinder.java b/packages/SystemUI/src/com/android/systemui/dagger/DependencyBinder.java index f9f0f1bad2fa..6674c12ab613 100644 --- a/packages/SystemUI/src/com/android/systemui/DependencyBinder.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/DependencyBinder.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -14,8 +14,9 @@ * limitations under the License. */ -package com.android.systemui; +package com.android.systemui.dagger; +import com.android.systemui.ActivityStarterDelegate; import com.android.systemui.appops.AppOpsController; import com.android.systemui.appops.AppOpsControllerImpl; import com.android.systemui.classifier.FalsingManagerProxy; diff --git a/packages/SystemUI/src/com/android/systemui/DependencyProvider.java b/packages/SystemUI/src/com/android/systemui/dagger/DependencyProvider.java index 8c1f8ac91916..87434f344729 100644 --- a/packages/SystemUI/src/com/android/systemui/DependencyProvider.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/DependencyProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 The Android Open Source Project + * 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. @@ -14,51 +14,35 @@ * limitations under the License. */ -package com.android.systemui; +package com.android.systemui.dagger; -import static com.android.systemui.Dependency.BG_HANDLER_NAME; -import static com.android.systemui.Dependency.BG_LOOPER_NAME; -import static com.android.systemui.Dependency.MAIN_HANDLER_NAME; -import static com.android.systemui.Dependency.MAIN_LOOPER_NAME; import static com.android.systemui.Dependency.TIME_TICK_HANDLER_NAME; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import android.annotation.Nullable; -import android.app.ActivityManager; -import android.app.AlarmManager; -import android.app.IActivityManager; import android.app.INotificationManager; -import android.app.IWallpaperManager; -import android.app.WallpaperManager; import android.content.Context; -import android.content.res.Resources; -import android.hardware.SensorPrivacyManager; import android.hardware.display.AmbientDisplayConfiguration; import android.hardware.display.NightDisplayListener; import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; -import android.os.PowerManager; import android.os.Process; import android.os.ServiceManager; -import android.os.UserHandle; import android.util.DisplayMetrics; import android.view.IWindowManager; -import android.view.WindowManager; -import android.view.WindowManagerGlobal; import com.android.internal.logging.MetricsLogger; import com.android.internal.statusbar.IStatusBarService; import com.android.internal.widget.LockPatternUtils; -import com.android.settingslib.bluetooth.LocalBluetoothManager; +import com.android.systemui.dagger.qualifiers.BgHandler; +import com.android.systemui.dagger.qualifiers.BgLooper; +import com.android.systemui.dagger.qualifiers.MainHandler; +import com.android.systemui.dagger.qualifiers.MainLooper; import com.android.systemui.doze.AlwaysOnDisplayPolicy; import com.android.systemui.plugins.PluginInitializerImpl; import com.android.systemui.shared.plugins.PluginManager; import com.android.systemui.shared.plugins.PluginManagerImpl; import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.DevicePolicyManagerWrapper; -import com.android.systemui.shared.system.PackageManagerWrapper; import com.android.systemui.statusbar.NavigationBarController; import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.phone.AutoHideController; @@ -70,11 +54,7 @@ import com.android.systemui.statusbar.policy.DeviceProvisionedControllerImpl; import com.android.systemui.statusbar.policy.NetworkController; import com.android.systemui.util.leak.LeakDetector; -import java.lang.annotation.Documented; -import java.lang.annotation.Retention; - import javax.inject.Named; -import javax.inject.Qualifier; import javax.inject.Singleton; import dagger.Module; @@ -82,16 +62,14 @@ import dagger.Provides; /** * Provides dependencies for the root component of sysui injection. + * + * Only SystemUI owned classes and instances should go in here. Other, framework-owned classes + * should go in {@link SystemServicesModule}. + * * See SystemUI/docs/dagger.md */ @Module public class DependencyProvider { - @Qualifier - @Documented - @Retention(RUNTIME) - public @interface MainResources { - // TODO: use attribute to get other, non-main resources? - } @Singleton @Provides @@ -104,7 +82,7 @@ public class DependencyProvider { @Singleton @Provides - @Named(BG_LOOPER_NAME) + @BgLooper public Looper provideBgLooper() { HandlerThread thread = new HandlerThread("SysUiBg", Process.THREAD_PRIORITY_BACKGROUND); @@ -113,29 +91,34 @@ public class DependencyProvider { } /** Main Looper */ - @Singleton @Provides - @Named(MAIN_LOOPER_NAME) + @MainLooper public Looper provideMainLooper() { return Looper.getMainLooper(); } @Singleton @Provides - @Named(BG_HANDLER_NAME) - public Handler provideBgHandler(@Named(BG_LOOPER_NAME) Looper bgLooper) { + @BgHandler + public Handler provideBgHandler(@BgLooper Looper bgLooper) { return new Handler(bgLooper); } @Singleton @Provides - @Named(MAIN_HANDLER_NAME) - public Handler provideMainHandler(@Named(MAIN_LOOPER_NAME) Looper mainLooper) { + @MainHandler + public Handler provideMainHandler(@MainLooper Looper mainLooper) { return new Handler(mainLooper); } /** */ @Provides + public AmbientDisplayConfiguration provideAmbientDispalyConfiguration(Context context) { + return new AmbientDisplayConfiguration(context); + } + + /** */ + @Provides public Handler provideHandler() { return new Handler(); } @@ -148,23 +131,10 @@ public class DependencyProvider { @Singleton @Provides - @Nullable - public LocalBluetoothManager provideLocalBluetoothController(Context context, - @Named(BG_HANDLER_NAME) Handler bgHandler) { - return LocalBluetoothManager.create(context, bgHandler, - UserHandle.ALL); - } - - @Singleton - @Provides - public MetricsLogger provideMetricsLogger() { - return new MetricsLogger(); - } - - @Singleton - @Provides - public IWindowManager provideIWindowManager() { - return WindowManagerGlobal.getWindowManagerService(); + // Single instance of DisplayMetrics, gets updated by StatusBar, but can be used + // anywhere it is needed. + public DisplayMetrics provideDisplayMetrics() { + return new DisplayMetrics(); } @Singleton @@ -184,29 +154,21 @@ public class DependencyProvider { @Singleton @Provides - // Single instance of DisplayMetrics, gets updated by StatusBar, but can be used - // anywhere it is needed. - public DisplayMetrics provideDisplayMetrics() { - return new DisplayMetrics(); - } + public LeakDetector provideLeakDetector() { + return LeakDetector.create(); - @Singleton - @Provides - public SensorPrivacyManager provideSensorPrivacyManager(Context context) { - return context.getSystemService(SensorPrivacyManager.class); } @Singleton @Provides - public LeakDetector provideLeakDetector() { - return LeakDetector.create(); - + public MetricsLogger provideMetricsLogger() { + return new MetricsLogger(); } @Singleton @Provides public NightDisplayListener provideNightDisplayListener(Context context, - @Named(BG_HANDLER_NAME) Handler bgHandler) { + @BgHandler Handler bgHandler) { return new NightDisplayListener(context, bgHandler); } @@ -219,7 +181,7 @@ public class DependencyProvider { @Singleton @Provides public NavigationBarController provideNavigationBarController(Context context, - @Named(MAIN_HANDLER_NAME) Handler mainHandler) { + @MainHandler Handler mainHandler) { return new NavigationBarController(context, mainHandler); } @@ -232,7 +194,7 @@ public class DependencyProvider { @Singleton @Provides public AutoHideController provideAutoHideController(Context context, - @Named(MAIN_HANDLER_NAME) Handler mainHandler, + @MainHandler Handler mainHandler, NotificationRemoteInputManager notificationRemoteInputManager, IWindowManager iWindowManager) { return new AutoHideController(context, mainHandler, notificationRemoteInputManager, @@ -253,25 +215,12 @@ public class DependencyProvider { @Singleton @Provides - public PackageManagerWrapper providePackageManagerWrapper() { - return PackageManagerWrapper.getInstance(); - } - - @Singleton - @Provides public DeviceProvisionedController provideDeviceProvisionedController(Context context, - @Named(MAIN_HANDLER_NAME) Handler mainHandler) { + @MainHandler Handler mainHandler) { return new DeviceProvisionedControllerImpl(context, mainHandler); } /** */ - @Singleton - @Provides - public AlarmManager provideAlarmManager(Context context) { - return context.getSystemService(AlarmManager.class); - } - - /** */ @Provides public LockPatternUtils provideLockPatternUtils(Context context) { return new LockPatternUtils(context); @@ -279,52 +228,7 @@ public class DependencyProvider { /** */ @Provides - public AmbientDisplayConfiguration provideAmbientDispalyConfiguration(Context context) { - return new AmbientDisplayConfiguration(context); - } - - /** */ - @Provides public AlwaysOnDisplayPolicy provideAlwaysOnDisplayPolicy(Context context) { return new AlwaysOnDisplayPolicy(context); } - - /** */ - @Provides - public PowerManager providePowerManager(Context context) { - return context.getSystemService(PowerManager.class); - } - - /** */ - @Provides - @MainResources - public Resources provideResources(Context context) { - return context.getResources(); - } - - /** */ - @Provides - @Nullable - public IWallpaperManager provideIWallpaperManager() { - return IWallpaperManager.Stub.asInterface( - ServiceManager.getService(Context.WALLPAPER_SERVICE)); - } - - /** */ - @Provides - public WallpaperManager providesWallpaperManager(Context context) { - return (WallpaperManager) context.getSystemService(Context.WALLPAPER_SERVICE); - } - - /** */ - @Provides - public WindowManager providesWindowManager(Context context) { - return context.getSystemService(WindowManager.class); - } - - /** */ - @Provides - public IActivityManager providesIActivityManager() { - return ActivityManager.getService(); - } } diff --git a/packages/SystemUI/src/com/android/systemui/ServiceBinder.java b/packages/SystemUI/src/com/android/systemui/dagger/ServiceBinder.java index c11236ebae53..1f2c0a18f928 100644 --- a/packages/SystemUI/src/com/android/systemui/ServiceBinder.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/ServiceBinder.java @@ -14,10 +14,11 @@ * limitations under the License. */ -package com.android.systemui; +package com.android.systemui.dagger; import android.app.Service; +import com.android.systemui.ImageWallpaper; import com.android.systemui.doze.DozeService; import com.android.systemui.keyguard.KeyguardService; diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemServicesModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemServicesModule.java new file mode 100644 index 000000000000..434e2d3f4791 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemServicesModule.java @@ -0,0 +1,122 @@ +/* + * 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 android.annotation.Nullable; +import android.annotation.SuppressLint; +import android.app.ActivityManager; +import android.app.AlarmManager; +import android.app.IActivityManager; +import android.app.IWallpaperManager; +import android.app.WallpaperManager; +import android.content.Context; +import android.content.res.Resources; +import android.hardware.SensorPrivacyManager; +import android.os.Handler; +import android.os.PowerManager; +import android.os.ServiceManager; +import android.os.UserHandle; +import android.view.IWindowManager; +import android.view.WindowManager; +import android.view.WindowManagerGlobal; + +import com.android.settingslib.bluetooth.LocalBluetoothManager; +import com.android.systemui.dagger.qualifiers.BgHandler; +import com.android.systemui.dagger.qualifiers.MainResources; +import com.android.systemui.shared.system.PackageManagerWrapper; + +import javax.inject.Singleton; + +import dagger.Module; +import dagger.Provides; + +/** + * Provides Non-SystemUI, Framework-Owned instances to the dependency graph. + */ +@Module +public class SystemServicesModule { + + @Singleton + @Provides + static AlarmManager provideAlarmManager(Context context) { + return context.getSystemService(AlarmManager.class); + } + + @Singleton + @Provides + static IActivityManager providesIActivityManager() { + return ActivityManager.getService(); + } + + @Provides + static IWallpaperManager provideWallPaperManager() { + return IWallpaperManager.Stub.asInterface( + ServiceManager.getService(Context.WALLPAPER_SERVICE)); + } + + @Singleton + @Provides + static IWindowManager provideIWindowManager() { + return WindowManagerGlobal.getWindowManagerService(); + } + + @SuppressLint("MissingPermission") + @Singleton + @Provides + @Nullable + static LocalBluetoothManager provideLocalBluetoothController(Context context, + @BgHandler Handler bgHandler) { + return LocalBluetoothManager.create(context, bgHandler, UserHandle.ALL); + } + + @Singleton + @Provides + static PackageManagerWrapper providePackageManagerWrapper() { + return PackageManagerWrapper.getInstance(); + } + + /** */ + @Singleton + @Provides + static PowerManager providePowerManager(Context context) { + return context.getSystemService(PowerManager.class); + } + + @Provides + @MainResources + static Resources provideResources(Context context) { + return context.getResources(); + } + + @Singleton + @Provides + static SensorPrivacyManager provideSensorPrivacyManager(Context context) { + return context.getSystemService(SensorPrivacyManager.class); + } + + @Provides + static WallpaperManager providesWallpaperManager(Context context) { + return (WallpaperManager) context.getSystemService(Context.WALLPAPER_SERVICE); + } + + @Singleton + @Provides + static WindowManager providesWindowManager(Context context) { + return context.getSystemService(WindowManager.class); + } + +} diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIBinder.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java index a5a55983fe51..49cd414f9d9e 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIBinder.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java @@ -14,8 +14,9 @@ * limitations under the License. */ -package com.android.systemui; +package com.android.systemui.dagger; +import com.android.systemui.SystemUI; import com.android.systemui.keyguard.KeyguardViewMediator; import com.android.systemui.pip.PipUI; import com.android.systemui.power.PowerUI; diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIDefaultModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java index 176bcbfd9500..c95b50b195b3 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIDefaultModule.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIDefaultModule.java @@ -14,13 +14,14 @@ * limitations under the License. */ -package com.android.systemui; +package com.android.systemui.dagger; import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME; 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; diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIModule.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java index 4520a1a6a037..30f13979e66e 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIModule.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.systemui; +package com.android.systemui.dagger; import android.annotation.Nullable; import android.content.Context; diff --git a/packages/SystemUI/src/com/android/systemui/SystemUIRootComponent.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIRootComponent.java index bcbe672fbe97..113c9c845d95 100644 --- a/packages/SystemUI/src/com/android/systemui/SystemUIRootComponent.java +++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIRootComponent.java @@ -14,12 +14,15 @@ * limitations under the License. */ -package com.android.systemui; +package com.android.systemui.dagger; import static com.android.systemui.Dependency.ALLOW_NOTIFICATION_LONG_PRESS_NAME; import android.content.ContentProvider; +import com.android.systemui.Dependency; +import com.android.systemui.SystemUIAppComponentFactory; +import com.android.systemui.SystemUIFactory; import com.android.systemui.fragments.FragmentService; import com.android.systemui.statusbar.phone.StatusBar; import com.android.systemui.util.InjectionInflationController; @@ -36,6 +39,7 @@ import dagger.Component; @Component(modules = { DependencyProvider.class, DependencyBinder.class, + SystemServicesModule.class, SystemUIFactory.ContextHolder.class, SystemUIModule.class, SystemUIDefaultModule.class}) diff --git a/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/BgHandler.java b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/BgHandler.java new file mode 100644 index 000000000000..bc6b83ba1def --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/BgHandler.java @@ -0,0 +1,30 @@ +/* + * 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.qualifiers; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; + +import javax.inject.Qualifier; + +@Qualifier +@Documented +@Retention(RUNTIME) +public @interface BgHandler { +} diff --git a/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/BgLooper.java b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/BgLooper.java new file mode 100644 index 000000000000..2aadda1215d5 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/BgLooper.java @@ -0,0 +1,30 @@ +/* + * 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.qualifiers; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; + +import javax.inject.Qualifier; + +@Qualifier +@Documented +@Retention(RUNTIME) +public @interface BgLooper { +} diff --git a/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/MainHandler.java b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/MainHandler.java new file mode 100644 index 000000000000..79661fa4a738 --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/MainHandler.java @@ -0,0 +1,30 @@ +/* + * 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.qualifiers; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; + +import javax.inject.Qualifier; + +@Qualifier +@Documented +@Retention(RUNTIME) +public @interface MainHandler { +} diff --git a/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/MainLooper.java b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/MainLooper.java new file mode 100644 index 000000000000..750d7d72035c --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/MainLooper.java @@ -0,0 +1,30 @@ +/* + * 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.qualifiers; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; + +import javax.inject.Qualifier; + +@Qualifier +@Documented +@Retention(RUNTIME) +public @interface MainLooper { +} diff --git a/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/MainResources.java b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/MainResources.java new file mode 100644 index 000000000000..3daeda550b4c --- /dev/null +++ b/packages/SystemUI/src/com/android/systemui/dagger/qualifiers/MainResources.java @@ -0,0 +1,31 @@ +/* + * 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.qualifiers; + +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; + +import javax.inject.Qualifier; + +@Qualifier +@Documented +@Retention(RUNTIME) +public @interface MainResources { + // TODO: use attribute to get other, non-main resources? +} diff --git a/packages/SystemUI/src/com/android/systemui/fragments/FragmentService.java b/packages/SystemUI/src/com/android/systemui/fragments/FragmentService.java index b4cc571be061..1b4857ebb209 100644 --- a/packages/SystemUI/src/com/android/systemui/fragments/FragmentService.java +++ b/packages/SystemUI/src/com/android/systemui/fragments/FragmentService.java @@ -22,7 +22,7 @@ import android.view.View; import com.android.systemui.ConfigurationChangedReceiver; import com.android.systemui.Dumpable; -import com.android.systemui.SystemUIRootComponent; +import com.android.systemui.dagger.SystemUIRootComponent; import com.android.systemui.qs.QSFragment; import com.android.systemui.statusbar.phone.NavigationBarFragment; diff --git a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt index 631b8b7a14a0..22fb4c0dbdb5 100644 --- a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt +++ b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt @@ -22,25 +22,20 @@ import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.content.IntentFilter -import android.os.Handler -import android.os.Looper -import android.os.Message -import android.os.UserHandle -import android.os.UserManager +import android.os.* import android.provider.DeviceConfig import com.android.internal.annotations.VisibleForTesting import com.android.internal.config.sysui.SystemUiDeviceConfigFlags -import com.android.systemui.Dependency.BG_HANDLER_NAME -import com.android.systemui.Dependency.MAIN_HANDLER_NAME +import com.android.systemui.Dumpable import com.android.systemui.R import com.android.systemui.appops.AppOpItem import com.android.systemui.appops.AppOpsController -import com.android.systemui.Dumpable +import com.android.systemui.dagger.qualifiers.BgHandler +import com.android.systemui.dagger.qualifiers.MainHandler import java.io.FileDescriptor import java.io.PrintWriter import java.lang.ref.WeakReference import javax.inject.Inject -import javax.inject.Named import javax.inject.Singleton fun isPermissionsHubEnabled() = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY, @@ -50,8 +45,8 @@ fun isPermissionsHubEnabled() = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_P class PrivacyItemController @Inject constructor( val context: Context, private val appOpsController: AppOpsController, - @Named(MAIN_HANDLER_NAME) private val uiHandler: Handler, - @Named(BG_HANDLER_NAME) private val bgHandler: Handler + @MainHandler private val uiHandler: Handler, + @BgHandler private val bgHandler: Handler ) : Dumpable { @VisibleForTesting diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroup.java b/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroup.java index b9f3a7fcc63b..5742787b39bc 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroup.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSCarrierGroup.java @@ -17,9 +17,7 @@ package com.android.systemui.qs; import static com.android.systemui.Dependency.BG_HANDLER; -import static com.android.systemui.Dependency.BG_HANDLER_NAME; import static com.android.systemui.Dependency.MAIN_LOOPER; -import static com.android.systemui.Dependency.MAIN_LOOPER_NAME; import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT; import android.annotation.MainThread; @@ -41,6 +39,8 @@ import androidx.annotation.VisibleForTesting; import com.android.keyguard.CarrierTextController; import com.android.systemui.Dependency; import com.android.systemui.R; +import com.android.systemui.dagger.qualifiers.BgHandler; +import com.android.systemui.dagger.qualifiers.MainLooper; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.statusbar.policy.NetworkController; @@ -77,8 +77,8 @@ public class QSCarrierGroup extends LinearLayout implements @Inject public QSCarrierGroup(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs, NetworkController networkController, ActivityStarter activityStarter, - @Named(BG_HANDLER_NAME) Handler handler, - @Named(MAIN_LOOPER_NAME) Looper looper) { + @BgHandler Handler handler, + @MainLooper Looper looper) { super(context, attrs); mNetworkController = networkController; mActivityStarter = activityStarter; diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java index 1e763cf79240..b395c3c336d3 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java @@ -30,11 +30,12 @@ import android.service.quicksettings.Tile; import android.text.TextUtils; import android.util.Log; -import com.android.systemui.Dependency; import com.android.systemui.DumpController; import com.android.systemui.Dumpable; import com.android.systemui.R; import com.android.systemui.SysUiServiceProvider; +import com.android.systemui.dagger.qualifiers.BgLooper; +import com.android.systemui.dagger.qualifiers.MainHandler; import com.android.systemui.plugins.PluginListener; import com.android.systemui.plugins.qs.QSFactory; import com.android.systemui.plugins.qs.QSTile; @@ -61,7 +62,6 @@ import java.util.List; import java.util.function.Predicate; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Provider; import javax.inject.Singleton; @@ -94,8 +94,8 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, D public QSTileHost(Context context, StatusBarIconController iconController, QSFactoryImpl defaultFactory, - @Named(Dependency.MAIN_HANDLER_NAME) Handler mainHandler, - @Named(Dependency.BG_LOOPER_NAME) Looper bgLooper, + @MainHandler Handler mainHandler, + @BgLooper Looper bgLooper, PluginManager pluginManager, TunerService tunerService, Provider<AutoTileManager> autoTiles, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java b/packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java index 0679595cef23..341c49a87156 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/FeatureFlags.java @@ -16,18 +16,17 @@ package com.android.systemui.statusbar; -import static com.android.systemui.Dependency.BG_HANDLER_NAME; - import android.annotation.NonNull; import android.os.Handler; import android.os.HandlerExecutor; import android.provider.DeviceConfig; import android.util.ArrayMap; +import com.android.systemui.dagger.qualifiers.BgHandler; + import java.util.Map; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; /** @@ -50,8 +49,7 @@ public class FeatureFlags { private final Map<String, Boolean> mCachedDeviceConfigFlags = new ArrayMap<>(); @Inject - public FeatureFlags( - @Named(BG_HANDLER_NAME) Handler bgHandler) { + public FeatureFlags(@BgHandler Handler bgHandler) { DeviceConfig.addOnPropertiesChangedListener( "systemui", new HandlerExecutor(bgHandler), diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java b/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java index 275475d6d72c..1f389049f423 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java @@ -18,7 +18,6 @@ package com.android.systemui.statusbar; import static android.view.Display.DEFAULT_DISPLAY; -import static com.android.systemui.Dependency.MAIN_HANDLER_NAME; import static com.android.systemui.SysUiServiceProvider.getComponent; import android.content.Context; @@ -38,6 +37,7 @@ import com.android.internal.annotations.VisibleForTesting; import com.android.internal.statusbar.RegisterStatusBarResult; import com.android.systemui.Dependency; import com.android.systemui.assist.AssistHandleViewController; +import com.android.systemui.dagger.qualifiers.MainHandler; import com.android.systemui.plugins.DarkIconDispatcher; import com.android.systemui.statusbar.CommandQueue.Callbacks; import com.android.systemui.statusbar.phone.AutoHideController; @@ -48,7 +48,6 @@ import com.android.systemui.statusbar.phone.NavigationBarView; import com.android.systemui.statusbar.policy.BatteryController; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; @@ -67,7 +66,7 @@ public class NavigationBarController implements Callbacks { SparseArray<NavigationBarFragment> mNavigationBars = new SparseArray<>(); @Inject - public NavigationBarController(Context context, @Named(MAIN_HANDLER_NAME) Handler handler) { + public NavigationBarController(Context context, @MainHandler Handler handler) { mContext = context; mHandler = handler; mDisplayManager = (DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java index 23968d59d58f..c838ac5315a7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationRemoteInputManager.java @@ -17,8 +17,6 @@ package com.android.systemui.statusbar; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN_OR_SPLIT_SCREEN_SECONDARY; -import static com.android.systemui.Dependency.MAIN_HANDLER_NAME; - import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityManager; @@ -52,6 +50,7 @@ import com.android.internal.statusbar.IStatusBarService; import com.android.internal.statusbar.NotificationVisibility; import com.android.systemui.Dumpable; import com.android.systemui.R; +import com.android.systemui.dagger.qualifiers.MainHandler; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.notification.NotificationEntryListener; import com.android.systemui.statusbar.notification.NotificationEntryManager; @@ -69,7 +68,6 @@ import java.util.Objects; import java.util.Set; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; import dagger.Lazy; @@ -262,7 +260,7 @@ public class NotificationRemoteInputManager implements Dumpable { NotificationEntryManager notificationEntryManager, Lazy<ShadeController> shadeController, StatusBarStateController statusBarStateController, - @Named(MAIN_HANDLER_NAME) Handler mainHandler) { + @MainHandler Handler mainHandler) { mContext = context; mLockscreenUserManager = lockscreenUserManager; mSmartReplyController = smartReplyController; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java index c2bb5b7693c2..095ca54f3bb2 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java @@ -16,8 +16,6 @@ package com.android.systemui.statusbar; -import static com.android.systemui.Dependency.MAIN_HANDLER_NAME; - import android.content.Context; import android.content.res.Resources; import android.os.Handler; @@ -29,6 +27,7 @@ import android.view.ViewGroup; import com.android.systemui.R; import com.android.systemui.bubbles.BubbleController; +import com.android.systemui.dagger.qualifiers.MainHandler; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.NotificationEntryManager; @@ -47,7 +46,6 @@ import java.util.List; import java.util.Stack; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; import dagger.Lazy; @@ -99,8 +97,7 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle private boolean mIsHandleDynamicPrivacyChangeScheduled; @Inject - public NotificationViewHierarchyManager(Context context, - @Named(MAIN_HANDLER_NAME) Handler mainHandler, + public NotificationViewHierarchyManager(Context context, @MainHandler Handler mainHandler, NotificationLockscreenUserManager notificationLockscreenUserManager, NotificationGroupManager groupManager, VisualStabilityManager visualStabilityManager, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java index 6fe4abee6133..1daf48492ea0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/VisualStabilityManager.java @@ -16,8 +16,6 @@ package com.android.systemui.statusbar.notification; -import static com.android.systemui.Dependency.MAIN_HANDLER_NAME; - import android.os.Handler; import android.os.SystemClock; import android.view.View; @@ -25,6 +23,7 @@ import android.view.View; import androidx.collection.ArraySet; import com.android.systemui.Dumpable; +import com.android.systemui.dagger.qualifiers.MainHandler; import com.android.systemui.statusbar.NotificationPresenter; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; @@ -35,7 +34,6 @@ import java.io.PrintWriter; import java.util.ArrayList; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; /** @@ -64,8 +62,7 @@ public class VisualStabilityManager implements OnHeadsUpChangedListener, Dumpabl @Inject public VisualStabilityManager( - NotificationEntryManager notificationEntryManager, - @Named(MAIN_HANDLER_NAME) Handler handler) { + NotificationEntryManager notificationEntryManager, @MainHandler Handler handler) { mHandler = handler; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoHideController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoHideController.java index 008464e543a0..f9b936763308 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoHideController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoHideController.java @@ -16,8 +16,6 @@ package com.android.systemui.statusbar.phone; -import static com.android.systemui.Dependency.MAIN_HANDLER_NAME; - import android.content.Context; import android.os.Handler; import android.os.RemoteException; @@ -25,10 +23,10 @@ import android.util.Log; import android.view.IWindowManager; import android.view.MotionEvent; +import com.android.systemui.dagger.qualifiers.MainHandler; import com.android.systemui.statusbar.NotificationRemoteInputManager; import javax.inject.Inject; -import javax.inject.Named; /** A controller to control all auto-hide things. */ public class AutoHideController { @@ -54,7 +52,7 @@ public class AutoHideController { }; @Inject - public AutoHideController(Context context, @Named(MAIN_HANDLER_NAME) Handler handler, + public AutoHideController(Context context, @MainHandler Handler handler, NotificationRemoteInputManager notificationRemoteInputManager, IWindowManager iWindowManager) { mHandler = handler; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoTileManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoTileManager.java index 007c50c8765d..837517e2cc9b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoTileManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/AutoTileManager.java @@ -21,7 +21,7 @@ import android.os.Handler; import android.provider.Settings.Secure; import com.android.internal.annotations.VisibleForTesting; -import com.android.systemui.Dependency; +import com.android.systemui.dagger.qualifiers.BgHandler; import com.android.systemui.qs.AutoAddTracker; import com.android.systemui.qs.QSTileHost; import com.android.systemui.qs.SecureSetting; @@ -33,7 +33,6 @@ import com.android.systemui.statusbar.policy.HotspotController; import com.android.systemui.statusbar.policy.HotspotController.Callback; import javax.inject.Inject; -import javax.inject.Named; /** * Manages which tiles should be automatically added to QS. @@ -58,7 +57,7 @@ public class AutoTileManager { @Inject public AutoTileManager(Context context, AutoAddTracker autoAddTracker, QSTileHost host, - @Named(Dependency.BG_HANDLER_NAME) Handler handler, + @BgHandler Handler handler, HotspotController hotspotController, DataSaverController dataSaverController, ManagedProfileController managedProfileController, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java index 28dac87c92cf..50d33a70fed5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java @@ -25,8 +25,8 @@ import android.provider.Settings; import android.util.MathUtils; import com.android.internal.annotations.VisibleForTesting; -import com.android.systemui.DependencyProvider; import com.android.systemui.R; +import com.android.systemui.dagger.qualifiers.MainResources; import com.android.systemui.doze.AlwaysOnDisplayPolicy; import com.android.systemui.doze.DozeScreenState; import com.android.systemui.tuner.TunerService; @@ -59,7 +59,7 @@ public class DozeParameters implements TunerService.Tunable, @Inject protected DozeParameters( - @DependencyProvider.MainResources Resources resources, + @MainResources Resources resources, AmbientDisplayConfiguration ambientDisplayConfiguration, AlwaysOnDisplayPolicy alwaysOnDisplayPolicy, PowerManager powerManager, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java index c50b1bf2dc20..6064fbedf63d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -42,10 +42,10 @@ import com.android.internal.util.function.TriConsumer; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.systemui.DejankUtils; -import com.android.systemui.DependencyProvider; import com.android.systemui.Dumpable; import com.android.systemui.R; import com.android.systemui.colorextraction.SysuiColorExtractor; +import com.android.systemui.dagger.qualifiers.MainResources; import com.android.systemui.statusbar.ScrimView; import com.android.systemui.statusbar.notification.stack.ViewState; import com.android.systemui.statusbar.policy.KeyguardStateController; @@ -188,7 +188,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, OnCo @Inject public ScrimController(LightBarController lightBarController, DozeParameters dozeParameters, AlarmManager alarmManager, KeyguardStateController keyguardStateController, - @DependencyProvider.MainResources Resources resources, + @MainResources Resources resources, DelayedWakeLock.Builder delayedWakeLockBuilder, Handler handler, KeyguardUpdateMonitor keyguardUpdateMonitor, SysuiColorExtractor sysuiColorExtractor) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java index 0a2fb2e783a9..76683b6a5e6a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BluetoothControllerImpl.java @@ -16,9 +16,6 @@ package com.android.systemui.statusbar.policy; -import static com.android.systemui.Dependency.BG_LOOPER_NAME; -import static com.android.systemui.Dependency.MAIN_LOOPER_NAME; - import android.annotation.Nullable; import android.app.ActivityManager; import android.bluetooth.BluetoothAdapter; @@ -36,6 +33,8 @@ import com.android.settingslib.bluetooth.BluetoothCallback; import com.android.settingslib.bluetooth.CachedBluetoothDevice; import com.android.settingslib.bluetooth.LocalBluetoothManager; import com.android.settingslib.bluetooth.LocalBluetoothProfileManager; +import com.android.systemui.dagger.qualifiers.BgLooper; +import com.android.systemui.dagger.qualifiers.MainLooper; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -46,7 +45,6 @@ import java.util.List; import java.util.WeakHashMap; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; /** @@ -74,9 +72,8 @@ public class BluetoothControllerImpl implements BluetoothController, BluetoothCa /** */ @Inject - public BluetoothControllerImpl(Context context, @Named(BG_LOOPER_NAME) Looper bgLooper, - @Named(MAIN_LOOPER_NAME) Looper mainLooper, - @Nullable LocalBluetoothManager localBluetoothManager) { + public BluetoothControllerImpl(Context context, @BgLooper Looper bgLooper, + @MainLooper Looper mainLooper, @Nullable LocalBluetoothManager localBluetoothManager) { mLocalBluetoothManager = localBluetoothManager; mBgHandler = new Handler(bgLooper); mHandler = new H(mainLooper); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImpl.java index 089d5c924de8..0a40b3c4831c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DeviceProvisionedControllerImpl.java @@ -14,8 +14,6 @@ package com.android.systemui.statusbar.policy; -import static com.android.systemui.Dependency.MAIN_HANDLER_NAME; - import android.app.ActivityManager; import android.content.ContentResolver; import android.content.Context; @@ -26,12 +24,12 @@ import android.provider.Settings.Global; import android.provider.Settings.Secure; import android.util.Log; +import com.android.systemui.dagger.qualifiers.MainHandler; import com.android.systemui.settings.CurrentUserTracker; import java.util.ArrayList; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; /** @@ -51,8 +49,7 @@ public class DeviceProvisionedControllerImpl extends CurrentUserTracker implemen /** */ @Inject - public DeviceProvisionedControllerImpl(Context context, - @Named(MAIN_HANDLER_NAME) Handler mainHandler) { + public DeviceProvisionedControllerImpl(Context context, @MainHandler Handler mainHandler) { super(context); mContext = context; mContentResolver = context.getContentResolver(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java index 1c6d12f15e4c..8f201c793258 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HotspotControllerImpl.java @@ -16,8 +16,6 @@ package com.android.systemui.statusbar.policy; -import static com.android.systemui.Dependency.MAIN_HANDLER_NAME; - import android.app.ActivityManager; import android.content.Context; import android.net.ConnectivityManager; @@ -26,12 +24,13 @@ import android.os.Handler; import android.os.UserManager; import android.util.Log; +import com.android.systemui.dagger.qualifiers.MainHandler; + import java.io.FileDescriptor; import java.io.PrintWriter; import java.util.ArrayList; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; /** @@ -56,7 +55,7 @@ public class HotspotControllerImpl implements HotspotController, WifiManager.Sof /** */ @Inject - public HotspotControllerImpl(Context context, @Named(MAIN_HANDLER_NAME) Handler mainHandler) { + public HotspotControllerImpl(Context context, @MainHandler Handler mainHandler) { mContext = context; mConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java index 683cdbb326dc..5a97eedd9b2c 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/LocationControllerImpl.java @@ -17,7 +17,6 @@ package com.android.systemui.statusbar.policy; import static com.android.settingslib.Utils.updateLocationEnabled; -import static com.android.systemui.Dependency.BG_LOOPER_NAME; import android.app.ActivityManager; import android.app.AppOpsManager; @@ -36,13 +35,13 @@ import android.provider.Settings; import androidx.annotation.VisibleForTesting; +import com.android.systemui.dagger.qualifiers.BgLooper; import com.android.systemui.util.Utils; import java.util.ArrayList; import java.util.List; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; /** @@ -66,7 +65,7 @@ public class LocationControllerImpl extends BroadcastReceiver implements Locatio private final H mHandler = new H(); @Inject - public LocationControllerImpl(Context context, @Named(BG_LOOPER_NAME) Looper bgLooper) { + public LocationControllerImpl(Context context, @BgLooper Looper bgLooper) { mContext = context; // Register to listen for changes in location settings. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java index 7b5d48947498..60784c91ee62 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkControllerImpl.java @@ -24,7 +24,6 @@ import static android.net.wifi.WifiManager.TrafficStateCallback.DATA_ACTIVITY_OU import static android.telephony.PhoneStateListener.LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE; import static com.android.internal.telephony.PhoneConstants.MAX_PHONE_COUNT_DUAL_SIM; -import static com.android.systemui.Dependency.BG_LOOPER_NAME; import android.content.BroadcastReceiver; import android.content.Context; @@ -65,6 +64,7 @@ import com.android.systemui.ConfigurationChangedReceiver; import com.android.systemui.DemoMode; import com.android.systemui.Dumpable; import com.android.systemui.R; +import com.android.systemui.dagger.qualifiers.BgLooper; import com.android.systemui.settings.CurrentUserTracker; import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener; import com.android.systemui.statusbar.policy.MobileSignalController.MobileIconGroup; @@ -81,7 +81,6 @@ import java.util.Locale; import java.util.Map; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; /** Platform implementation of the network controller. **/ @@ -170,7 +169,7 @@ public class NetworkControllerImpl extends BroadcastReceiver * Construct this controller object and register for updates. */ @Inject - public NetworkControllerImpl(Context context, @Named(BG_LOOPER_NAME) Looper bgLooper, + public NetworkControllerImpl(Context context, @BgLooper Looper bgLooper, DeviceProvisionedController deviceProvisionedController) { this(context, (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE), (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE), diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java index d88ae78c5afb..6edd75b20fed 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SecurityControllerImpl.java @@ -15,8 +15,6 @@ */ package com.android.systemui.statusbar.policy; -import static com.android.systemui.Dependency.BG_HANDLER_NAME; - import android.app.ActivityManager; import android.app.admin.DevicePolicyManager; import android.content.BroadcastReceiver; @@ -50,6 +48,7 @@ import com.android.internal.annotations.GuardedBy; import com.android.internal.net.LegacyVpnInfo; import com.android.internal.net.VpnConfig; import com.android.systemui.R; +import com.android.systemui.dagger.qualifiers.BgHandler; import com.android.systemui.settings.CurrentUserTracker; import java.io.FileDescriptor; @@ -57,7 +56,6 @@ import java.io.PrintWriter; import java.util.ArrayList; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; /** @@ -102,7 +100,7 @@ public class SecurityControllerImpl extends CurrentUserTracker implements Securi /** */ @Inject - public SecurityControllerImpl(Context context, @Named(BG_HANDLER_NAME) Handler bgHandler) { + public SecurityControllerImpl(Context context, @BgHandler Handler bgHandler) { this(context, bgHandler, null); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java index 655c29cbf687..347d3009c3ec 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyConstants.java @@ -16,8 +16,6 @@ package com.android.systemui.statusbar.policy; -import static com.android.systemui.Dependency.MAIN_HANDLER_NAME; - import android.app.RemoteInput; import android.content.Context; import android.content.res.Resources; @@ -30,9 +28,9 @@ import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; import com.android.systemui.R; +import com.android.systemui.dagger.qualifiers.MainHandler; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; @Singleton @@ -67,7 +65,7 @@ public final class SmartReplyConstants { private final KeyValueListParser mParser = new KeyValueListParser(','); @Inject - public SmartReplyConstants(@Named(MAIN_HANDLER_NAME) Handler handler, Context context) { + public SmartReplyConstants(@MainHandler Handler handler, Context context) { mHandler = handler; mContext = context; final Resources resources = mContext.getResources(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java index bcfbdacf9ea8..f2d2faed6a42 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java @@ -18,7 +18,6 @@ package com.android.systemui.statusbar.policy; import static com.android.settingslib.RestrictedLockUtils.EnforcedAdmin; import static com.android.systemui.DejankUtils.whitelistIpcs; -import static com.android.systemui.Dependency.MAIN_HANDLER_NAME; import android.app.ActivityManager; import android.app.Dialog; @@ -58,6 +57,7 @@ import com.android.systemui.Prefs; import com.android.systemui.Prefs.Key; import com.android.systemui.R; import com.android.systemui.SystemUISecondaryUserService; +import com.android.systemui.dagger.qualifiers.MainHandler; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.qs.DetailAdapter; import com.android.systemui.qs.tiles.UserDetailView; @@ -70,7 +70,6 @@ import java.util.ArrayList; import java.util.List; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; /** @@ -110,7 +109,7 @@ public class UserSwitcherController implements Dumpable { @Inject public UserSwitcherController(Context context, KeyguardStateController keyguardStateController, - @Named(MAIN_HANDLER_NAME) Handler handler, ActivityStarter activityStarter) { + @MainHandler Handler handler, ActivityStarter activityStarter) { mContext = context; if (!UserManager.isGuestUserEphemeral()) { mGuestResumeSessionReceiver.register(context); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java index 29c42d24b3b4..1c7a1951b27d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/ZenModeControllerImpl.java @@ -16,8 +16,6 @@ package com.android.systemui.statusbar.policy; -import static com.android.systemui.Dependency.MAIN_HANDLER_NAME; - import android.app.ActivityManager; import android.app.AlarmManager; import android.app.NotificationManager; @@ -41,6 +39,7 @@ import android.util.Log; import com.android.internal.annotations.VisibleForTesting; import com.android.systemui.Dumpable; +import com.android.systemui.dagger.qualifiers.MainHandler; import com.android.systemui.qs.GlobalSetting; import com.android.systemui.settings.CurrentUserTracker; import com.android.systemui.util.Utils; @@ -51,7 +50,6 @@ import java.util.ArrayList; import java.util.Objects; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; /** Platform implementation of the zen mode controller. **/ @@ -79,7 +77,7 @@ public class ZenModeControllerImpl extends CurrentUserTracker private NotificationManager.Policy mConsolidatedNotificationPolicy; @Inject - public ZenModeControllerImpl(Context context, @Named(MAIN_HANDLER_NAME) Handler handler) { + public ZenModeControllerImpl(Context context, @MainHandler Handler handler) { super(context); mContext = context; mModeSetting = new GlobalSetting(mContext, handler, Global.ZEN_MODE) { diff --git a/packages/SystemUI/src/com/android/systemui/tuner/TunerServiceImpl.java b/packages/SystemUI/src/com/android/systemui/tuner/TunerServiceImpl.java index a55e2cf38e39..2d6027cb324d 100644 --- a/packages/SystemUI/src/com/android/systemui/tuner/TunerServiceImpl.java +++ b/packages/SystemUI/src/com/android/systemui/tuner/TunerServiceImpl.java @@ -15,8 +15,6 @@ */ package com.android.systemui.tuner; -import static com.android.systemui.Dependency.MAIN_HANDLER_NAME; - import android.app.ActivityManager; import android.content.ContentResolver; import android.content.Context; @@ -36,6 +34,7 @@ import android.util.ArraySet; import com.android.internal.util.ArrayUtils; import com.android.systemui.DejankUtils; import com.android.systemui.DemoMode; +import com.android.systemui.dagger.qualifiers.MainHandler; import com.android.systemui.qs.QSTileHost; import com.android.systemui.settings.CurrentUserTracker; import com.android.systemui.statusbar.phone.StatusBarIconController; @@ -46,7 +45,6 @@ import java.util.HashSet; import java.util.Set; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; @@ -83,7 +81,7 @@ public class TunerServiceImpl extends TunerService { /** */ @Inject - public TunerServiceImpl(Context context, @Named(MAIN_HANDLER_NAME) Handler mainHandler, + public TunerServiceImpl(Context context, @MainHandler Handler mainHandler, LeakDetector leakDetector) { mContext = context; mContentResolver = mContext.getContentResolver(); diff --git a/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java b/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java index 7e801da9cd1b..5ed027d37def 100644 --- a/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java +++ b/packages/SystemUI/src/com/android/systemui/util/InjectionInflationController.java @@ -26,7 +26,7 @@ import android.view.View; import com.android.keyguard.KeyguardClockSwitch; import com.android.keyguard.KeyguardMessageArea; import com.android.keyguard.KeyguardSliceView; -import com.android.systemui.SystemUIRootComponent; +import com.android.systemui.dagger.SystemUIRootComponent; import com.android.systemui.qs.QSCarrierGroup; import com.android.systemui.qs.QSFooterImpl; import com.android.systemui.qs.QSPanel; diff --git a/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java b/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java index 63db755ef09d..bff405c0bee6 100644 --- a/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java +++ b/packages/SystemUI/src/com/android/systemui/util/leak/GarbageMonitor.java @@ -20,7 +20,6 @@ import static android.service.quicksettings.Tile.STATE_ACTIVE; import static android.telephony.ims.feature.ImsFeature.STATE_UNAVAILABLE; import static com.android.internal.logging.MetricsLogger.VIEW_UNKNOWN; -import static com.android.systemui.Dependency.BG_LOOPER_NAME; import android.annotation.Nullable; import android.app.ActivityManager; @@ -48,6 +47,7 @@ import android.util.LongSparseArray; import com.android.systemui.Dumpable; import com.android.systemui.R; import com.android.systemui.SystemUI; +import com.android.systemui.dagger.qualifiers.BgLooper; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.qs.QSTile; import com.android.systemui.qs.QSHost; @@ -59,7 +59,6 @@ import java.util.ArrayList; import java.util.List; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; /** @@ -110,7 +109,7 @@ public class GarbageMonitor implements Dumpable { @Inject public GarbageMonitor( Context context, - @Named(BG_LOOPER_NAME) Looper bgLooper, + @BgLooper Looper bgLooper, LeakDetector leakDetector, LeakReporter leakReporter) { mContext = context.getApplicationContext(); diff --git a/packages/SystemUI/src/com/android/systemui/util/sensors/ProximitySensor.java b/packages/SystemUI/src/com/android/systemui/util/sensors/ProximitySensor.java index fdffc4338843..a96977a338a9 100644 --- a/packages/SystemUI/src/com/android/systemui/util/sensors/ProximitySensor.java +++ b/packages/SystemUI/src/com/android/systemui/util/sensors/ProximitySensor.java @@ -25,8 +25,8 @@ import android.os.Handler; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; -import com.android.systemui.DependencyProvider; import com.android.systemui.R; +import com.android.systemui.dagger.qualifiers.MainResources; import java.util.ArrayList; import java.util.List; @@ -65,7 +65,7 @@ public class ProximitySensor { }; @Inject - public ProximitySensor(@DependencyProvider.MainResources Resources resources, + public ProximitySensor(@MainResources Resources resources, AsyncSensorManager sensorManager) { mSensorManager = sensorManager; Sensor sensor = findBrightnessSensor(resources); |