Remove all calls to getComponent(CommandQueue.class).
Makes AuthController, GlobalActionsComponent, InstantAppNotifier,
SizeCompatModeActivityController, and TvStatusBar all injectable.
Prior to this CL, CommandQueue contained within it a SystemUI object
that it used to start itself up and add itself to components. With
this change, the SystemUI object is no longer necessary, as Dagger
will ensure that a CommandQueue is available to those who need it.
Bug: 143702229
Test: atest SystemUITests
Change-Id: I2763a6d918b41fe27a2370fdd820da476654e14f
diff --git a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
index ce61a00..fef9198 100644
--- a/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
+++ b/packages/SystemUI/src/com/android/systemui/BatteryMeterView.java
@@ -54,6 +54,7 @@
import com.android.systemui.plugins.DarkIconDispatcher;
import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver;
import com.android.systemui.settings.CurrentUserTracker;
+import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.phone.StatusBarIconController;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback;
@@ -139,7 +140,8 @@
addOnAttachStateChangeListener(
- new DisableStateTracker(DISABLE_NONE, DISABLE2_SYSTEM_ICONS));
+ new DisableStateTracker(DISABLE_NONE, DISABLE2_SYSTEM_ICONS,
+ Dependency.get(CommandQueue.class)));
setupLayoutTransition();
diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java
index 486d02c..b3f32af 100644
--- a/packages/SystemUI/src/com/android/systemui/Dependency.java
+++ b/packages/SystemUI/src/com/android/systemui/Dependency.java
@@ -63,6 +63,7 @@
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.CommandQueue;
import com.android.systemui.statusbar.NavigationBarController;
import com.android.systemui.statusbar.NotificationListener;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
@@ -326,6 +327,7 @@
@Inject Lazy<KeyguardSecurityModel> mKeyguardSecurityModel;
@Inject Lazy<DozeParameters> mDozeParameters;
@Inject Lazy<IWallpaperManager> mWallpaperManager;
+ @Inject Lazy<CommandQueue> mCommandQueue;
@Inject
public Dependency() {
@@ -514,6 +516,7 @@
mProviders.put(KeyguardSecurityModel.class, mKeyguardSecurityModel::get);
mProviders.put(DozeParameters.class, mDozeParameters::get);
mProviders.put(IWallpaperManager.class, mWallpaperManager::get);
+ mProviders.put(CommandQueue.class, mCommandQueue::get);
// TODO(b/118592525): to support multi-display , we start to add something which is
// per-display, while others may be global. I think it's time to add
diff --git a/packages/SystemUI/src/com/android/systemui/SizeCompatModeActivityController.java b/packages/SystemUI/src/com/android/systemui/SizeCompatModeActivityController.java
index 10009f5..72a4030 100644
--- a/packages/SystemUI/src/com/android/systemui/SizeCompatModeActivityController.java
+++ b/packages/SystemUI/src/com/android/systemui/SizeCompatModeActivityController.java
@@ -47,7 +47,11 @@
import java.lang.ref.WeakReference;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
/** Shows a restart-activity button when the foreground activity is in size compatibility mode. */
+@Singleton
public class SizeCompatModeActivityController extends SystemUI implements CommandQueue.Callbacks {
private static final String TAG = "SizeCompatMode";
@@ -55,17 +59,17 @@
private final SparseArray<RestartActivityButton> mActiveButtons = new SparseArray<>(1);
/** Avoid creating display context frequently for non-default display. */
private final SparseArray<WeakReference<Context>> mDisplayContextCache = new SparseArray<>(0);
+ private final CommandQueue mCommandQueue;
/** Only show once automatically in the process life. */
private boolean mHasShownHint;
- public SizeCompatModeActivityController(Context context) {
- this(context, ActivityManagerWrapper.getInstance());
- }
-
@VisibleForTesting
- SizeCompatModeActivityController(Context context, ActivityManagerWrapper am) {
+ @Inject
+ SizeCompatModeActivityController(Context context, ActivityManagerWrapper am,
+ CommandQueue commandQueue) {
super(context);
+ mCommandQueue = commandQueue;
am.registerTaskStackListener(new TaskStackChangeListener() {
@Override
public void onSizeCompatModeActivityChanged(int displayId, IBinder activityToken) {
@@ -77,7 +81,7 @@
@Override
public void start() {
- SysUiServiceProvider.getComponent(mContext, CommandQueue.class).addCallback(this);
+ mCommandQueue.addCallback(this);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
index 1f950f6..b7a6167 100644
--- a/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
+++ b/packages/SystemUI/src/com/android/systemui/assist/AssistManager.java
@@ -44,7 +44,6 @@
import com.android.systemui.ConfigurationChangedReceiver;
import com.android.systemui.Dependency;
import com.android.systemui.R;
-import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.assist.ui.DefaultUiController;
import com.android.systemui.recents.OverviewProxyService;
import com.android.systemui.statusbar.CommandQueue;
@@ -130,6 +129,7 @@
private AssistOrbContainer mView;
private final DeviceProvisionedController mDeviceProvisionedController;
+ private final CommandQueue mCommandQueue;
protected final AssistUtils mAssistUtils;
private final boolean mShouldEnableOrb;
@@ -160,9 +160,11 @@
DeviceProvisionedController controller,
Context context,
AssistUtils assistUtils,
- AssistHandleBehaviorController handleController) {
+ AssistHandleBehaviorController handleController,
+ CommandQueue commandQueue) {
mContext = context;
mDeviceProvisionedController = controller;
+ mCommandQueue = commandQueue;
mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
mAssistUtils = assistUtils;
mAssistDisclosure = new AssistDisclosure(context, new Handler());
@@ -339,7 +341,7 @@
}
// Close Recent Apps if needed
- SysUiServiceProvider.getComponent(mContext, CommandQueue.class).animateCollapsePanels(
+ mCommandQueue.animateCollapsePanels(
CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL | CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL,
false /* force */);
diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
index 446ed25..516de70 100644
--- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
+++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthController.java
@@ -47,16 +47,21 @@
import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
/**
* Receives messages sent from {@link com.android.server.biometrics.BiometricService} and shows the
* appropriate biometric UI (e.g. BiometricDialogView).
*/
+@Singleton
public class AuthController extends SystemUI implements CommandQueue.Callbacks,
AuthDialogCallback {
private static final String TAG = "BiometricPrompt/AuthController";
private static final boolean DEBUG = true;
+ private final CommandQueue mCommandQueue;
private final Injector mInjector;
// TODO: These should just be saved from onSaveState
@@ -189,13 +194,15 @@
}
}
- public AuthController(Context context) {
- this(context, new Injector());
+ @Inject
+ public AuthController(Context context, CommandQueue commandQueue) {
+ this(context, commandQueue, new Injector());
}
@VisibleForTesting
- AuthController(Context context, Injector injector) {
+ AuthController(Context context, CommandQueue commandQueue, Injector injector) {
super(context);
+ mCommandQueue = commandQueue;
mInjector = injector;
}
@@ -205,7 +212,7 @@
if (pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)
|| pm.hasSystemFeature(PackageManager.FEATURE_FACE)
|| pm.hasSystemFeature(PackageManager.FEATURE_IRIS)) {
- getComponent(CommandQueue.class).addCallback(this);
+ mCommandQueue.addCallback(this);
mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
mActivityTaskManager = mInjector.getActivityTaskManager();
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/DependencyProvider.java b/packages/SystemUI/src/com/android/systemui/dagger/DependencyProvider.java
index 87434f3..11879bb 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/DependencyProvider.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/DependencyProvider.java
@@ -43,6 +43,7 @@
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.statusbar.CommandQueue;
import com.android.systemui.statusbar.NavigationBarController;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.phone.AutoHideController;
@@ -181,8 +182,8 @@
@Singleton
@Provides
public NavigationBarController provideNavigationBarController(Context context,
- @MainHandler Handler mainHandler) {
- return new NavigationBarController(context, mainHandler);
+ @MainHandler Handler mainHandler, CommandQueue commandQueue) {
+ return new NavigationBarController(context, mainHandler, commandQueue);
}
@Singleton
diff --git a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java
index bb83fdc..ead6de2 100644
--- a/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java
+++ b/packages/SystemUI/src/com/android/systemui/dagger/SystemUIBinder.java
@@ -29,14 +29,17 @@
import com.android.systemui.ForegroundServiceController;
import com.android.systemui.LatencyTester;
import com.android.systemui.ScreenDecorations;
+import com.android.systemui.SizeCompatModeActivityController;
import com.android.systemui.SystemUI;
import com.android.systemui.UiOffloadThread;
import com.android.systemui.appops.AppOpsController;
import com.android.systemui.assist.AssistManager;
+import com.android.systemui.biometrics.AuthController;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.bubbles.BubbleController;
import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.doze.DozeLog;
+import com.android.systemui.globalactions.GlobalActionsComponent;
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.keyguard.WakefulnessLifecycle;
@@ -45,6 +48,7 @@
import com.android.systemui.power.PowerUI;
import com.android.systemui.recents.Recents;
import com.android.systemui.recents.RecentsModule;
+import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.FeatureFlags;
import com.android.systemui.statusbar.NavigationBarController;
import com.android.systemui.statusbar.NotificationListener;
@@ -57,6 +61,7 @@
import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.statusbar.notification.BypassHeadsUpNotifier;
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
+import com.android.systemui.statusbar.notification.InstantAppNotifier;
import com.android.systemui.statusbar.notification.NewNotifPipeline;
import com.android.systemui.statusbar.notification.NotificationAlertingManager;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
@@ -91,6 +96,7 @@
import com.android.systemui.statusbar.policy.RemoteInputQuickSettingsDisabler;
import com.android.systemui.statusbar.policy.UserSwitcherController;
import com.android.systemui.statusbar.policy.ZenModeController;
+import com.android.systemui.statusbar.tv.TvStatusBar;
import com.android.systemui.util.InjectionInflationController;
import com.android.systemui.util.leak.GarbageMonitor;
import com.android.systemui.volume.VolumeUI;
@@ -110,6 +116,11 @@
*/
@Module(includes = {RecentsModule.class})
public abstract class SystemUIBinder {
+ /** Inject into AuthController. */
+ @Binds
+ @IntoMap
+ @ClassKey(AuthController.class)
+ public abstract SystemUI bindAuthController(AuthController service);
/** Inject into GarbageMonitor.Service. */
@Binds
@@ -117,6 +128,18 @@
@ClassKey(GarbageMonitor.Service.class)
public abstract SystemUI bindGarbageMonitorService(GarbageMonitor.Service service);
+ /** Inject into GlobalActionsComponent. */
+ @Binds
+ @IntoMap
+ @ClassKey(GlobalActionsComponent.class)
+ public abstract SystemUI bindGlobalActionsComponent(GlobalActionsComponent sysui);
+
+ /** Inject into InstantAppNotifier. */
+ @Binds
+ @IntoMap
+ @ClassKey(InstantAppNotifier.class)
+ public abstract SystemUI bindInstantAppNotifier(InstantAppNotifier sysui);
+
/** Inject into KeyguardViewMediator. */
@Binds
@IntoMap
@@ -153,12 +176,25 @@
@ClassKey(ScreenDecorations.class)
public abstract SystemUI bindScreenDecorations(ScreenDecorations sysui);
+ /** Inject into SizeCompatModeActivityController. */
+ @Binds
+ @IntoMap
+ @ClassKey(SizeCompatModeActivityController.class)
+ public abstract SystemUI bindsSizeCompatModeActivityController(
+ SizeCompatModeActivityController sysui);
+
/** Inject into StatusBar. */
@Binds
@IntoMap
@ClassKey(StatusBar.class)
public abstract SystemUI bindsStatusBar(StatusBar sysui);
+ /** Inject into TvStatusBar. */
+ @Binds
+ @IntoMap
+ @ClassKey(TvStatusBar.class)
+ public abstract SystemUI bindsTvStatusBar(TvStatusBar sysui);
+
/** Inject into VolumeUI. */
@Binds
@IntoMap
@@ -234,7 +270,8 @@
Lazy<BiometricUnlockController> biometricUnlockControllerLazy,
DozeServiceHost dozeServiceHost,
PowerManager powerManager,
- DozeScrimController dozeScrimController) {
+ DozeScrimController dozeScrimController,
+ CommandQueue commandQueue) {
return new StatusBar(
context,
featureFlags,
@@ -299,7 +336,8 @@
biometricUnlockControllerLazy,
dozeServiceHost,
powerManager,
- dozeScrimController);
+ dozeScrimController,
+ commandQueue);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsComponent.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsComponent.java
index c11127d..19b6f82 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsComponent.java
@@ -20,7 +20,6 @@
import com.android.internal.statusbar.IStatusBarService;
import com.android.systemui.Dependency;
-import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.SystemUI;
import com.android.systemui.plugins.GlobalActions;
import com.android.systemui.plugins.GlobalActions.GlobalActionsManager;
@@ -29,14 +28,24 @@
import com.android.systemui.statusbar.policy.ExtensionController;
import com.android.systemui.statusbar.policy.ExtensionController.Extension;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+/**
+ * Manages power menu plugins and communicates power menu actions to the StatusBar.
+ */
+@Singleton
public class GlobalActionsComponent extends SystemUI implements Callbacks, GlobalActionsManager {
+ private final CommandQueue mCommandQueue;
private GlobalActions mPlugin;
private Extension<GlobalActions> mExtension;
private IStatusBarService mBarService;
- public GlobalActionsComponent(Context context) {
+ @Inject
+ public GlobalActionsComponent(Context context, CommandQueue commandQueue) {
super(context);
+ mCommandQueue = commandQueue;
}
@Override
@@ -45,11 +54,11 @@
ServiceManager.getService(Context.STATUS_BAR_SERVICE));
mExtension = Dependency.get(ExtensionController.class).newExtension(GlobalActions.class)
.withPlugin(GlobalActions.class)
- .withDefault(() -> new GlobalActionsImpl(mContext))
+ .withDefault(() -> new GlobalActionsImpl(mContext, mCommandQueue))
.withCallback(this::onExtensionCallback)
.build();
mPlugin = mExtension.get();
- SysUiServiceProvider.getComponent(mContext, CommandQueue.class).addCallback(this);
+ mCommandQueue.addCallback(this);
}
private void onExtensionCallback(GlobalActions newPlugin) {
diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
index 6178a16..d5f5a5a 100644
--- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsImpl.java
@@ -33,7 +33,6 @@
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.settingslib.Utils;
import com.android.systemui.Dependency;
-import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.plugins.GlobalActions;
import com.android.systemui.plugins.GlobalActionsPanelPlugin;
@@ -54,17 +53,19 @@
private final DeviceProvisionedController mDeviceProvisionedController;
private final ExtensionController.Extension<GlobalActionsPanelPlugin> mPanelExtension;
private GlobalActionsPanelPlugin mPlugin;
+ private final CommandQueue mCommandQueue;
private GlobalActionsDialog mGlobalActions;
private boolean mDisabled;
private final PluginManager mPluginManager;
private final String mPluginPackageName;
- public GlobalActionsImpl(Context context) {
+ public GlobalActionsImpl(Context context, CommandQueue commandQueue) {
mContext = context;
mKeyguardStateController = Dependency.get(KeyguardStateController.class);
mDeviceProvisionedController = Dependency.get(DeviceProvisionedController.class);
mPluginManager = Dependency.get(PluginManager.class);
- SysUiServiceProvider.getComponent(context, CommandQueue.class).addCallback(this);
+ mCommandQueue = commandQueue;
+ mCommandQueue.addCallback(this);
mPanelExtension = Dependency.get(ExtensionController.class)
.newExtension(GlobalActionsPanelPlugin.class)
.withPlugin(GlobalActionsPanelPlugin.class)
@@ -77,7 +78,7 @@
@Override
public void destroy() {
- SysUiServiceProvider.getComponent(mContext, CommandQueue.class).removeCallback(this);
+ mCommandQueue.removeCallback(this);
mPluginManager.removePluginListener(this);
if (mPlugin != null) mPlugin.onDestroy();
if (mGlobalActions != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/pip/PipUI.java b/packages/SystemUI/src/com/android/systemui/pip/PipUI.java
index f1e801b..feb5d19 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/PipUI.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/PipUI.java
@@ -40,13 +40,15 @@
@Singleton
public class PipUI extends SystemUI implements CommandQueue.Callbacks {
+ private final CommandQueue mCommandQueue;
private BasePipManager mPipManager;
private boolean mSupportsPip;
@Inject
- public PipUI(Context context) {
+ public PipUI(Context context, CommandQueue commandQueue) {
super(context);
+ mCommandQueue = commandQueue;
}
@Override
@@ -68,7 +70,7 @@
: com.android.systemui.pip.phone.PipManager.getInstance();
mPipManager.initialize(mContext);
- getComponent(CommandQueue.class).addCallback(this);
+ mCommandQueue.addCallback(this);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java b/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java
index 496aa0e..60d30da 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSDetail.java
@@ -38,7 +38,6 @@
import com.android.systemui.Dependency;
import com.android.systemui.FontSizeUtils;
import com.android.systemui.R;
-import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.qs.DetailAdapter;
import com.android.systemui.statusbar.CommandQueue;
@@ -169,8 +168,7 @@
setupDetailHeader(adapter);
if (toggleQs && !mFullyExpanded) {
mTriggeredExpand = true;
- SysUiServiceProvider.getComponent(mContext, CommandQueue.class)
- .animateExpandSettingsPanel(null);
+ Dependency.get(CommandQueue.class).animateExpandSettingsPanel(null);
} else {
mTriggeredExpand = false;
}
@@ -181,8 +179,7 @@
x = mOpenX;
y = mOpenY;
if (toggleQs && mTriggeredExpand) {
- SysUiServiceProvider.getComponent(mContext, CommandQueue.class)
- .animateCollapsePanels();
+ Dependency.get(CommandQueue.class).animateCollapsePanels();
mTriggeredExpand = false;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java
index 0a3b43a..ccc836f 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java
@@ -38,7 +38,6 @@
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.R.id;
-import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.plugins.qs.QS;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.qs.customize.QSCustomizer;
@@ -97,11 +96,10 @@
InjectionInflationController injectionInflater,
Context context,
QSTileHost qsTileHost,
- StatusBarStateController statusBarStateController) {
+ StatusBarStateController statusBarStateController, CommandQueue commandQueue) {
mRemoteInputQuickSettingsDisabler = remoteInputQsDisabler;
mInjectionInflater = injectionInflater;
- SysUiServiceProvider.getComponent(context, CommandQueue.class)
- .observe(getLifecycle(), this);
+ commandQueue.observe(getLifecycle(), this);
mHost = qsTileHost;
mStatusBarStateController = statusBarStateController;
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
index 16c61e6..24ac27e 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QuickStatusBarHeader.java
@@ -70,6 +70,7 @@
import com.android.systemui.privacy.PrivacyItemController;
import com.android.systemui.privacy.PrivacyItemControllerKt;
import com.android.systemui.qs.QSDetail.Callback;
+import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.phone.PhoneStatusBarView;
import com.android.systemui.statusbar.phone.StatusBarIconController;
import com.android.systemui.statusbar.phone.StatusBarIconController.TintedIconManager;
@@ -124,6 +125,7 @@
private TouchAnimator mHeaderTextContainerAlphaAnimator;
private TouchAnimator mPrivacyChipAlphaAnimator;
private DualToneHandler mDualToneHandler;
+ private final CommandQueue mCommandQueue;
private View mSystemIconsView;
private View mQuickQsStatusIcons;
@@ -186,7 +188,8 @@
public QuickStatusBarHeader(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
NextAlarmController nextAlarmController, ZenModeController zenModeController,
StatusBarIconController statusBarIconController,
- ActivityStarter activityStarter, PrivacyItemController privacyItemController) {
+ ActivityStarter activityStarter, PrivacyItemController privacyItemController,
+ CommandQueue commandQueue) {
super(context, attrs);
mAlarmController = nextAlarmController;
mZenController = zenModeController;
@@ -195,6 +198,7 @@
mPrivacyItemController = privacyItemController;
mDualToneHandler = new DualToneHandler(
new ContextThemeWrapper(context, R.style.QSHeaderTheme));
+ mCommandQueue = commandQueue;
}
@Override
@@ -208,7 +212,7 @@
// Ignore privacy icons because they show in the space above QQS
iconContainer.addIgnoredSlots(getIgnoredIconSlots());
iconContainer.setShouldRestrictIcons(false);
- mIconManager = new TintedIconManager(iconContainer);
+ mIconManager = new TintedIconManager(iconContainer, mCommandQueue);
// Views corresponding to the header info section (e.g. ringer and next alarm).
mHeaderTextContainerView = findViewById(R.id.header_text_container);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
index 0a8264b..a8ecc12 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
@@ -29,23 +29,27 @@
import java.io.PrintWriter;
import javax.inject.Inject;
+import javax.inject.Singleton;
/**
* A proxy to a Recents implementation.
*/
+@Singleton
public class Recents extends SystemUI implements CommandQueue.Callbacks {
private final RecentsImplementation mImpl;
+ private final CommandQueue mCommandQueue;
@Inject
- public Recents(Context context, RecentsImplementation impl) {
+ public Recents(Context context, RecentsImplementation impl, CommandQueue commandQueue) {
super(context);
mImpl = impl;
+ mCommandQueue = commandQueue;
}
@Override
public void start() {
- getComponent(CommandQueue.class).addCallback(this);
+ mCommandQueue.addCallback(this);
putComponent(Recents.class, this);
mImpl.onStart(mContext, this);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
index 34f5437..eb6ea13 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java
@@ -56,12 +56,14 @@
import com.android.internal.statusbar.IStatusBar;
import com.android.internal.statusbar.StatusBarIcon;
import com.android.internal.view.AppearanceRegion;
-import com.android.systemui.SystemUI;
import com.android.systemui.statusbar.CommandQueue.Callbacks;
import com.android.systemui.statusbar.policy.CallbackController;
import java.util.ArrayList;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
/**
* This class takes the functions from IStatusBar that come in on
* binder pool threads and posts messages to get them onto the main
@@ -69,6 +71,7 @@
* coalescing these calls so they don't stack up. For the calls
* are coalesced, note that they are all idempotent.
*/
+@Singleton
public class CommandQueue extends IStatusBar.Stub implements CallbackController<Callbacks>,
DisplayManager.DisplayListener {
private static final int INDEX_MASK = 0xffff;
@@ -305,6 +308,7 @@
}
@VisibleForTesting
+ @Inject
public CommandQueue(Context context) {
context.getSystemService(DisplayManager.class).registerDisplayListener(this, mHandler);
// We always have default display.
@@ -1186,17 +1190,4 @@
}
}
}
-
- // Need this class since CommandQueue already extends IStatusBar.Stub, so CommandQueueStart
- // is needed so it can extend SystemUI.
- public static class CommandQueueStart extends SystemUI {
- public CommandQueueStart(Context context) {
- super(context);
- }
-
- @Override
- public void start() {
- putComponent(CommandQueue.class, new CommandQueue(mContext));
- }
- }
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java b/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java
index 1f38904..9f5cf68 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/NavigationBarController.java
@@ -18,8 +18,6 @@
import static android.view.Display.DEFAULT_DISPLAY;
-import static com.android.systemui.SysUiServiceProvider.getComponent;
-
import android.content.Context;
import android.hardware.display.DisplayManager;
import android.os.Handler;
@@ -66,14 +64,12 @@
SparseArray<NavigationBarFragment> mNavigationBars = new SparseArray<>();
@Inject
- public NavigationBarController(Context context, @MainHandler Handler handler) {
+ public NavigationBarController(Context context, @MainHandler Handler handler,
+ CommandQueue commandQueue) {
mContext = context;
mHandler = handler;
mDisplayManager = (DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE);
- CommandQueue commandQueue = getComponent(mContext, CommandQueue.class);
- if (commandQueue != null) {
- commandQueue.addCallback(this);
- }
+ commandQueue.addCallback(this);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java
index 53fbe5b..49bed15 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/InstantAppNotifier.java
@@ -53,7 +53,6 @@
import com.android.systemui.Dependency;
import com.android.systemui.DockedStackExistsListener;
import com.android.systemui.R;
-import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.SystemUI;
import com.android.systemui.UiOffloadThread;
import com.android.systemui.statusbar.CommandQueue;
@@ -62,9 +61,13 @@
import java.util.List;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
/** The class to show notification(s) of instant apps. This may show multiple notifications on
* splitted screen.
*/
+@Singleton
public class InstantAppNotifier extends SystemUI
implements CommandQueue.Callbacks, KeyguardStateController.Callback {
private static final String TAG = "InstantAppNotifier";
@@ -73,11 +76,14 @@
private final Handler mHandler = new Handler();
private final UiOffloadThread mUiOffloadThread = Dependency.get(UiOffloadThread.class);
private final ArraySet<Pair<String, Integer>> mCurrentNotifs = new ArraySet<>();
+ private final CommandQueue mCommandQueue;
private boolean mDockedStackExists;
private KeyguardStateController mKeyguardStateController;
- public InstantAppNotifier(Context context) {
+ @Inject
+ public InstantAppNotifier(Context context, CommandQueue commandQueue) {
super(context);
+ mCommandQueue = commandQueue;
}
@Override
@@ -91,7 +97,7 @@
// Ignore
}
- SysUiServiceProvider.getComponent(mContext, CommandQueue.class).addCallback(this);
+ mCommandQueue.addCallback(this);
mKeyguardStateController.addCallback(this);
DockedStackExistsListener.register(
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java
index e78b85e..0092cc9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java
@@ -83,7 +83,7 @@
mNetworkController = Dependency.get(NetworkController.class);
mStatusBarStateController = Dependency.get(StatusBarStateController.class);
mStatusBarComponent = SysUiServiceProvider.getComponent(getContext(), StatusBar.class);
- mCommandQueue = SysUiServiceProvider.getComponent(getContext(), CommandQueue.class);
+ mCommandQueue = Dependency.get(CommandQueue.class);
}
@Override
@@ -100,7 +100,8 @@
mStatusBar.restoreHierarchyState(
savedInstanceState.getSparseParcelableArray(EXTRA_PANEL_STATE));
}
- mDarkIconManager = new DarkIconManager(view.findViewById(R.id.statusIcons));
+ mDarkIconManager = new DarkIconManager(view.findViewById(R.id.statusIcons),
+ Dependency.get(CommandQueue.class));
mDarkIconManager.setShouldLog(true);
Dependency.get(StatusBarIconController.class).addIconGroup(mDarkIconManager);
mSystemIconArea = mStatusBar.findViewById(R.id.system_icon_area);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DarkIconDispatcherImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DarkIconDispatcherImpl.java
index ac58e68..ef0f7cd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DarkIconDispatcherImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DarkIconDispatcherImpl.java
@@ -26,6 +26,7 @@
import com.android.systemui.R;
import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver;
+import com.android.systemui.statusbar.CommandQueue;
import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -51,11 +52,11 @@
/**
*/
@Inject
- public DarkIconDispatcherImpl(Context context) {
+ public DarkIconDispatcherImpl(Context context, CommandQueue commandQueue) {
mDarkModeIconColorSingleTone = context.getColor(R.color.dark_mode_icon_color_single_tone);
mLightModeIconColorSingleTone = context.getColor(R.color.light_mode_icon_color_single_tone);
- mTransitionsController = new LightBarTransitionsController(context, this);
+ mTransitionsController = new LightBarTransitionsController(context, this, commandQueue);
}
public LightBarTransitionsController getTransitionsController() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java
index ce96005..8e5a912 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/HeadsUpAppearanceController.java
@@ -16,8 +16,6 @@
package com.android.systemui.statusbar.phone;
-import static com.android.systemui.SysUiServiceProvider.getComponent;
-
import android.graphics.Point;
import android.graphics.Rect;
import android.view.DisplayCutout;
@@ -94,14 +92,14 @@
public HeadsUpAppearanceController(
NotificationIconAreaController notificationIconAreaController,
- HeadsUpManagerPhone headsUpManager,
- View statusbarView,
+ HeadsUpManagerPhone headsUpManager, View statusbarView,
SysuiStatusBarStateController statusBarStateController,
KeyguardBypassController keyguardBypassController,
KeyguardStateController keyguardStateController,
- NotificationWakeUpCoordinator wakeUpCoordinator) {
+ NotificationWakeUpCoordinator wakeUpCoordinator, CommandQueue commandQueue) {
this(notificationIconAreaController, headsUpManager, statusBarStateController,
keyguardBypassController, wakeUpCoordinator, keyguardStateController,
+ commandQueue,
statusbarView.findViewById(R.id.heads_up_status_bar_view),
statusbarView.findViewById(R.id.notification_stack_scroller),
statusbarView.findViewById(R.id.notification_panel),
@@ -118,6 +116,7 @@
KeyguardBypassController bypassController,
NotificationWakeUpCoordinator wakeUpCoordinator,
KeyguardStateController keyguardStateController,
+ CommandQueue commandQueue,
HeadsUpStatusBarView headsUpStatusBarView,
NotificationStackScrollLayout stackScroller,
NotificationPanelView panelView,
@@ -161,7 +160,7 @@
mStatusBarStateController = stateController;
mWakeUpCoordinator = wakeUpCoordinator;
wakeUpCoordinator.addListener(this);
- mCommandQueue = getComponent(headsUpStatusBarView.getContext(), CommandQueue.class);
+ mCommandQueue = commandQueue;
mKeyguardStateController = keyguardStateController;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
index 6ee031a..b24942a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardStatusBarView.java
@@ -46,6 +46,7 @@
import com.android.systemui.R;
import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver;
import com.android.systemui.qs.QSPanel;
+import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.phone.StatusBarIconController.TintedIconManager;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.BatteryController.BatteryStateChangeCallback;
@@ -329,7 +330,8 @@
mMultiUserSwitch.setUserSwitcherController(mUserSwitcherController);
userInfoController.reloadUserInfo();
Dependency.get(ConfigurationController.class).addCallback(this);
- mIconManager = new TintedIconManager(findViewById(R.id.statusIcons));
+ mIconManager = new TintedIconManager(findViewById(R.id.statusIcons),
+ Dependency.get(CommandQueue.class));
Dependency.get(StatusBarIconController.class).addIconGroup(mIconManager);
onThemeChanged();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java
index de660ce1..092dd49 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LightBarTransitionsController.java
@@ -27,7 +27,6 @@
import com.android.systemui.Dependency;
import com.android.systemui.Dumpable;
import com.android.systemui.Interpolators;
-import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.CommandQueue.Callbacks;
@@ -49,6 +48,7 @@
private final DarkIntensityApplier mApplier;
private final KeyguardStateController mKeyguardStateController;
private final StatusBarStateController mStatusBarStateController;
+ private final CommandQueue mCommandQueue;
private boolean mTransitionDeferring;
private long mTransitionDeferringStartTime;
@@ -70,13 +70,14 @@
private final Context mContext;
- public LightBarTransitionsController(Context context, DarkIntensityApplier applier) {
+ public LightBarTransitionsController(Context context, DarkIntensityApplier applier,
+ CommandQueue commandQueue) {
mApplier = applier;
mHandler = new Handler();
mKeyguardStateController = Dependency.get(KeyguardStateController.class);
mStatusBarStateController = Dependency.get(StatusBarStateController.class);
- SysUiServiceProvider.getComponent(context, CommandQueue.class)
- .addCallback(this);
+ mCommandQueue = commandQueue;
+ mCommandQueue.addCallback(this);
mStatusBarStateController.addCallback(this);
mDozeAmount = mStatusBarStateController.getDozeAmount();
mContext = context;
@@ -84,8 +85,7 @@
}
public void destroy(Context context) {
- SysUiServiceProvider.getComponent(context, CommandQueue.class)
- .removeCallback(this);
+ mCommandQueue.removeCallback(this);
mStatusBarStateController.removeCallback(this);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
index 7030dfc..816327f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
@@ -165,7 +165,7 @@
private Recents mRecents;
private Divider mDivider;
private WindowManager mWindowManager;
- private CommandQueue mCommandQueue;
+ private final CommandQueue mCommandQueue;
private long mLastLockToAppLongPress;
private Locale mLocale;
@@ -265,7 +265,8 @@
NavigationModeController navigationModeController,
StatusBarStateController statusBarStateController,
SysUiState sysUiFlagsContainer,
- BroadcastDispatcher broadcastDispatcher) {
+ BroadcastDispatcher broadcastDispatcher,
+ CommandQueue commandQueue) {
mAccessibilityManagerWrapper = accessibilityManagerWrapper;
mDeviceProvisionedController = deviceProvisionedController;
mStatusBarStateController = statusBarStateController;
@@ -277,6 +278,7 @@
mNavigationModeController = navigationModeController;
mNavBarMode = navigationModeController.addListener(this);
mBroadcastDispatcher = broadcastDispatcher;
+ mCommandQueue = commandQueue;
}
// ----- Fragment Lifecycle Callbacks -----
@@ -284,7 +286,6 @@
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- mCommandQueue = SysUiServiceProvider.getComponent(getContext(), CommandQueue.class);
mCommandQueue.observe(getLifecycle(), this);
mStatusBar = SysUiServiceProvider.getComponent(getContext(), StatusBar.class);
mRecents = SysUiServiceProvider.getComponent(getContext(), Recents.class);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java
index 3b59031..1a6d3d7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarTransitions.java
@@ -34,6 +34,7 @@
import com.android.internal.statusbar.IStatusBarService;
import com.android.systemui.Dependency;
import com.android.systemui.R;
+import com.android.systemui.statusbar.CommandQueue;
import java.util.ArrayList;
import java.util.List;
@@ -78,12 +79,13 @@
}
};
- public NavigationBarTransitions(NavigationBarView view) {
+ public NavigationBarTransitions(NavigationBarView view, CommandQueue commandQueue) {
super(view, R.drawable.nav_background);
mView = view;
mBarService = IStatusBarService.Stub.asInterface(
ServiceManager.getService(Context.STATUS_BAR_SERVICE));
- mLightTransitionsController = new LightBarTransitionsController(view.getContext(), this);
+ mLightTransitionsController = new LightBarTransitionsController(
+ view.getContext(), this, commandQueue);
mAllowAutoDimWallpaperNotVisible = view.getContext().getResources()
.getBoolean(R.bool.config_navigation_bar_enable_auto_dim_no_visible_wallpaper);
mDarkIntensityListeners = new ArrayList();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
index 4b4a35b..159a829 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java
@@ -76,6 +76,7 @@
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.shared.system.WindowManagerWrapper;
+import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NavigationBarController;
import com.android.systemui.statusbar.policy.DeadZone;
import com.android.systemui.statusbar.policy.KeyButtonDrawable;
@@ -300,7 +301,7 @@
mConfiguration.updateFrom(context.getResources().getConfiguration());
mScreenPinningNotify = new ScreenPinningNotify(mContext);
- mBarTransitions = new NavigationBarTransitions(this);
+ mBarTransitions = new NavigationBarTransitions(this, Dependency.get(CommandQueue.class));
mButtonDispatchers.put(R.id.back, backButton);
mButtonDispatchers.put(R.id.home, new ButtonDispatcher(R.id.home));
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 467df37..6839fb4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -16,7 +16,6 @@
package com.android.systemui.statusbar.phone;
-import static com.android.systemui.SysUiServiceProvider.getComponent;
import static com.android.systemui.statusbar.notification.ActivityLaunchAnimator.ExpandAnimationParameters;
import static com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout.ROWS_ALL;
import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT;
@@ -463,7 +462,7 @@
NotificationEntryManager notificationEntryManager,
KeyguardStateController keyguardStateController,
StatusBarStateController statusBarStateController, DozeLog dozeLog,
- DozeParameters dozeParameters) {
+ DozeParameters dozeParameters, CommandQueue commandQueue) {
super(context, attrs, falsingManager, dozeLog, keyguardStateController,
(SysuiStatusBarStateController) statusBarStateController);
setWillNotDraw(!DEBUG);
@@ -475,7 +474,7 @@
setAccessibilityPaneTitle(determineAccessibilityPaneTitle());
mAlphaPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY));
setPanelAlpha(255, false /* animate */);
- mCommandQueue = getComponent(context, CommandQueue.class);
+ mCommandQueue = commandQueue;
mDisplayId = context.getDisplayId();
mPulseExpansionHandler = pulseExpansionHandler;
mDozeParameters = dozeParameters;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
index 294111c..0645423 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java
@@ -40,7 +40,6 @@
import com.android.internal.telephony.TelephonyIntents;
import com.android.systemui.Dependency;
import com.android.systemui.R;
-import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.UiOffloadThread;
import com.android.systemui.privacy.PrivacyItem;
import com.android.systemui.privacy.PrivacyItemController;
@@ -138,7 +137,8 @@
private BluetoothController mBluetooth;
private AlarmManager.AlarmClockInfo mNextAlarm;
- public PhoneStatusBarPolicy(Context context, StatusBarIconController iconController) {
+ public PhoneStatusBarPolicy(Context context, StatusBarIconController iconController,
+ CommandQueue commandQueue) {
mContext = context;
mIconController = iconController;
mCast = Dependency.get(CastController.class);
@@ -261,7 +261,7 @@
mSensorPrivacyController.addCallback(mSensorPrivacyListener);
mLocationController.addCallback(this);
- SysUiServiceProvider.getComponent(mContext, CommandQueue.class).addCallback(this);
+ commandQueue.addCallback(this);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
index 53e1467..312ca26 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@@ -19,7 +19,6 @@
import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
import static com.android.systemui.ScreenDecorations.DisplayCutoutView.boundsFromDirection;
-import static com.android.systemui.SysUiServiceProvider.getComponent;
import android.annotation.Nullable;
import android.content.Context;
@@ -95,7 +94,7 @@
super(context, attrs);
mBarTransitions = new PhoneStatusBarTransitions(this);
- mCommandQueue = getComponent(context, CommandQueue.class);
+ mCommandQueue = Dependency.get(CommandQueue.class);
}
public BarTransitions getBarTransitions() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index fb2ae53..4f9f131 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -696,7 +696,8 @@
Lazy<BiometricUnlockController> biometricUnlockControllerLazy,
DozeServiceHost dozeServiceHost,
PowerManager powerManager,
- DozeScrimController dozeScrimController) {
+ DozeScrimController dozeScrimController,
+ CommandQueue commandQueue) {
super(context);
mFeatureFlags = featureFlags;
mLightBarController = lightBarController;
@@ -761,6 +762,7 @@
mLockscreenWallpaperLazy = lockscreenWallpaperLazy;
mDozeScrimController = dozeScrimController;
mBiometricUnlockControllerLazy = biometricUnlockControllerLazy;
+ mCommandQueue = commandQueue;
mBubbleExpandListener =
(isExpanding, key) -> {
@@ -821,7 +823,6 @@
mKeyguardManager = (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);
// Connect in to the status bar manager service
- mCommandQueue = getComponent(CommandQueue.class);
mCommandQueue.addCallback(this);
RegisterStatusBarResult result = null;
@@ -904,7 +905,7 @@
// end old BaseStatusBar.start().
// Lastly, call to the icon policy to install/update all the icons.
- mIconPolicy = new PhoneStatusBarPolicy(mContext, mIconController);
+ mIconPolicy = new PhoneStatusBarPolicy(mContext, mIconController, mCommandQueue);
mSignalPolicy = new StatusBarSignalPolicy(mContext, mIconController);
mKeyguardStateController.addCallback(this);
@@ -1006,7 +1007,7 @@
mHeadsUpAppearanceController = new HeadsUpAppearanceController(
mNotificationIconAreaController, mHeadsUpManager, mStatusBarWindow,
mStatusBarStateController, mKeyguardBypassController,
- mKeyguardStateController, mWakeUpCoordinator);
+ mKeyguardStateController, mWakeUpCoordinator, mCommandQueue);
mHeadsUpAppearanceController.readFrom(oldController);
mStatusBarWindowViewController.setStatusBarView(mStatusBarView);
updateAreThereNotifications();
@@ -1212,7 +1213,7 @@
mPresenter = new StatusBarNotificationPresenter(mContext, mNotificationPanel,
mHeadsUpManager, mStatusBarWindow, mStackScroller, mDozeScrimController,
mScrimController, mActivityLaunchAnimator, mDynamicPrivacyController,
- mNotificationAlertingManager, rowBinder, mKeyguardStateController);
+ mNotificationAlertingManager, rowBinder, mKeyguardStateController, mCommandQueue);
mNotificationListController =
new NotificationListController(
@@ -4082,7 +4083,7 @@
// Begin Extra BaseStatusBar methods.
- protected CommandQueue mCommandQueue;
+ protected final CommandQueue mCommandQueue;
protected IStatusBarService mBarService;
// all notifications
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java
index 2e2ff1a..5daef24 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconController.java
@@ -40,6 +40,7 @@
import com.android.systemui.R;
import com.android.systemui.plugins.DarkIconDispatcher;
import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver;
+import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.StatusBarIconView;
import com.android.systemui.statusbar.StatusBarMobileView;
import com.android.systemui.statusbar.StatusBarWifiView;
@@ -96,8 +97,8 @@
private final DarkIconDispatcher mDarkIconDispatcher;
private int mIconHPadding;
- public DarkIconManager(LinearLayout linearLayout) {
- super(linearLayout);
+ public DarkIconManager(LinearLayout linearLayout, CommandQueue commandQueue) {
+ super(linearLayout, commandQueue);
mIconHPadding = mContext.getResources().getDimensionPixelSize(
R.dimen.status_bar_icon_padding);
mDarkIconDispatcher = Dependency.get(DarkIconDispatcher.class);
@@ -156,8 +157,8 @@
public static class TintedIconManager extends IconManager {
private int mColor;
- public TintedIconManager(ViewGroup group) {
- super(group);
+ public TintedIconManager(ViewGroup group, CommandQueue commandQueue) {
+ super(group, commandQueue);
}
@Override
@@ -203,14 +204,14 @@
private boolean mIsInDemoMode;
protected DemoStatusIcons mDemoStatusIcons;
- public IconManager(ViewGroup group) {
+ public IconManager(ViewGroup group, CommandQueue commandQueue) {
mGroup = group;
mContext = group.getContext();
mIconSize = mContext.getResources().getDimensionPixelSize(
com.android.internal.R.dimen.status_bar_icon_size);
DisableStateTracker tracker =
- new DisableStateTracker(DISABLE_NONE, DISABLE2_SYSTEM_ICONS);
+ new DisableStateTracker(DISABLE_NONE, DISABLE2_SYSTEM_ICONS, commandQueue);
mGroup.addOnAttachStateChangeListener(tracker);
if (mGroup.isAttachedToWindow()) {
// In case we miss the first onAttachedToWindow event
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java
index e0b1846..aa062eb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarIconControllerImpl.java
@@ -29,7 +29,6 @@
import com.android.systemui.Dependency;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
-import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.StatusIconDisplayable;
import com.android.systemui.statusbar.phone.StatusBarSignalPolicy.MobileIconState;
@@ -70,7 +69,7 @@
private boolean mIsDark = false;
@Inject
- public StatusBarIconControllerImpl(Context context) {
+ public StatusBarIconControllerImpl(Context context, CommandQueue commandQueue) {
super(context.getResources().getStringArray(
com.android.internal.R.array.config_statusBarIcons));
Dependency.get(ConfigurationController.class).addCallback(this);
@@ -79,8 +78,7 @@
loadDimens();
- SysUiServiceProvider.getComponent(context, CommandQueue.class)
- .addCallback(this);
+ commandQueue.addCallback(this);
Dependency.get(TunerService.class).addTunable(this, ICON_BLACKLIST);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
index b01a8d4..02e5ebf 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationPresenter.java
@@ -14,7 +14,6 @@
package com.android.systemui.statusbar.phone;
-import static com.android.systemui.SysUiServiceProvider.getComponent;
import static com.android.systemui.statusbar.phone.StatusBar.CLOSE_PANEL_WHEN_EMPTIED;
import static com.android.systemui.statusbar.phone.StatusBar.DEBUG;
import static com.android.systemui.statusbar.phone.StatusBar.MULTIUSER_DEBUG;
@@ -139,13 +138,14 @@
DynamicPrivacyController dynamicPrivacyController,
NotificationAlertingManager notificationAlertingManager,
NotificationRowBinderImpl notificationRowBinder,
- KeyguardStateController keyguardStateController) {
+ KeyguardStateController keyguardStateController,
+ CommandQueue commandQueue) {
mContext = context;
mKeyguardStateController = keyguardStateController;
mNotificationPanel = panel;
mHeadsUpManager = headsUp;
mDynamicPrivacyController = dynamicPrivacyController;
- mCommandQueue = getComponent(context, CommandQueue.class);
+ mCommandQueue = commandQueue;
mAboveShelfObserver = new AboveShelfObserver(stackScroller);
mActivityLaunchAnimator = activityLaunchAnimator;
mAboveShelfObserver.setListener(statusBarWindow.findViewById(
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java
index 1def89b..b5a7847 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java
@@ -16,7 +16,6 @@
import static android.content.Intent.ACTION_DEVICE_LOCKED_CHANGED;
-import static com.android.systemui.SysUiServiceProvider.getComponent;
import static com.android.systemui.statusbar.NotificationLockscreenUserManager.NOTIFICATION_UNLOCKED_BY_WORK_CHALLENGE_ACTION;
import android.app.ActivityManager;
@@ -80,7 +79,8 @@
NotificationLockscreenUserManager notificationLockscreenUserManager,
KeyguardStateController keyguardStateController,
StatusBarStateController statusBarStateController,
- ActivityStarter activityStarter, ShadeController shadeController) {
+ ActivityStarter activityStarter, ShadeController shadeController,
+ CommandQueue commandQueue) {
mContext = context;
mContext.registerReceiverAsUser(mChallengeReceiver, UserHandle.ALL,
new IntentFilter(ACTION_DEVICE_LOCKED_CHANGED), null, null);
@@ -91,7 +91,7 @@
mActivityStarter = activityStarter;
mStatusBarStateController.addCallback(this);
mKeyguardManager = context.getSystemService(KeyguardManager.class);
- mCommandQueue = getComponent(context, CommandQueue.class);
+ mCommandQueue = commandQueue;
mCommandQueue.addCallback(this);
mActivityIntentHelper = new ActivityIntentHelper(mContext);
mGroupManager = groupManager;
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java
index fd3f9c8..b7ada5d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowViewController.java
@@ -39,6 +39,7 @@
import com.android.systemui.plugins.FalsingManager;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.shared.plugins.PluginManager;
+import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.DragDownHelper;
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.PulseExpansionHandler;
@@ -94,7 +95,8 @@
KeyguardStateController keyguardStateController,
SysuiStatusBarStateController statusBarStateController,
DozeLog dozeLog,
- DozeParameters dozeParameters) {
+ DozeParameters dozeParameters,
+ CommandQueue commandQueue) {
mView = view;
mFalsingManager = falsingManager;
@@ -115,7 +117,8 @@
keyguardStateController,
statusBarStateController,
dozeLog,
- dozeParameters);
+ dozeParameters,
+ commandQueue);
ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
notificationPanelView.setVisibility(View.INVISIBLE);
@@ -488,6 +491,7 @@
private final NotificationEntryManager mNotificationEntryManager;
private final DozeLog mDozeLog;
private final DozeParameters mDozeParameters;
+ private final CommandQueue mCommandQueue;
private StatusBarWindowView mView;
@Inject
@@ -505,7 +509,8 @@
KeyguardStateController keyguardStateController,
StatusBarStateController statusBarStateController,
DozeLog dozeLog,
- DozeParameters dozeParameters) {
+ DozeParameters dozeParameters,
+ CommandQueue commandQueue) {
mInjectionInflationController = injectionInflationController;
mCoordinator = coordinator;
mPulseExpansionHandler = pulseExpansionHandler;
@@ -520,6 +525,7 @@
mStatusBarStateController = (SysuiStatusBarStateController) statusBarStateController;
mDozeLog = dozeLog;
mDozeParameters = dozeParameters;
+ mCommandQueue = commandQueue;
}
/**
@@ -558,7 +564,8 @@
mKeyguardStateController,
mStatusBarStateController,
mDozeLog,
- mDozeParameters);
+ mDozeParameters,
+ mCommandQueue);
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
index b331fc3..568f590 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java
@@ -45,7 +45,6 @@
import com.android.systemui.Dependency;
import com.android.systemui.FontSizeUtils;
import com.android.systemui.R;
-import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.broadcast.BroadcastDispatcher;
import com.android.systemui.plugins.DarkIconDispatcher;
import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver;
@@ -81,6 +80,7 @@
private static final String VISIBILITY = "visibility";
private final CurrentUserTracker mCurrentUserTracker;
+ private final CommandQueue mCommandQueue;
private int mCurrentUserId;
private boolean mClockVisibleByPolicy = true;
@@ -116,18 +116,19 @@
private final BroadcastDispatcher mBroadcastDispatcher;
public Clock(Context context, AttributeSet attrs) {
- this(context, attrs, null);
+ this(context, attrs, null, Dependency.get(CommandQueue.class));
}
@Inject
public Clock(@Named(VIEW_CONTEXT) Context context, AttributeSet attrs,
- BroadcastDispatcher broadcastDispatcher) {
- this(context, attrs, 0, broadcastDispatcher);
+ BroadcastDispatcher broadcastDispatcher, CommandQueue commandQueue) {
+ this(context, attrs, 0, broadcastDispatcher, commandQueue);
}
public Clock(Context context, AttributeSet attrs, int defStyle,
- BroadcastDispatcher broadcastDispatcher) {
+ BroadcastDispatcher broadcastDispatcher, CommandQueue commandQueue) {
super(context, attrs, defStyle);
+ mCommandQueue = commandQueue;
TypedArray a = context.getTheme().obtainStyledAttributes(
attrs,
R.styleable.Clock,
@@ -200,7 +201,7 @@
null, Dependency.get(Dependency.TIME_TICK_HANDLER));
Dependency.get(TunerService.class).addTunable(this, CLOCK_SECONDS,
StatusBarIconController.ICON_BLACKLIST);
- SysUiServiceProvider.getComponent(getContext(), CommandQueue.class).addCallback(this);
+ mCommandQueue.addCallback(this);
if (mShowDark) {
Dependency.get(DarkIconDispatcher.class).addDarkReceiver(this);
}
@@ -227,8 +228,7 @@
getContext().unregisterReceiver(mIntentReceiver);
mAttached = false;
Dependency.get(TunerService.class).removeTunable(this);
- SysUiServiceProvider.getComponent(getContext(), CommandQueue.class)
- .removeCallback(this);
+ mCommandQueue.removeCallback(this);
if (mShowDark) {
Dependency.get(DarkIconDispatcher.class).removeDarkReceiver(this);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputQuickSettingsDisabler.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputQuickSettingsDisabler.java
index 2b60274..7ef9945 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputQuickSettingsDisabler.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputQuickSettingsDisabler.java
@@ -21,7 +21,6 @@
import android.content.res.Configuration;
import com.android.internal.annotations.VisibleForTesting;
-import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.qs.QSFragment;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.phone.StatusBar;
@@ -40,13 +39,13 @@
@VisibleForTesting boolean mRemoteInputActive;
@VisibleForTesting boolean misLandscape;
private int mLastOrientation;
- @VisibleForTesting CommandQueue mCommandQueue;
+ private final CommandQueue mCommandQueue;
@Inject
public RemoteInputQuickSettingsDisabler(Context context,
- ConfigurationController configController) {
+ ConfigurationController configController, CommandQueue commandQueue) {
mContext = context;
- mCommandQueue = SysUiServiceProvider.getComponent(context, CommandQueue.class);
+ mCommandQueue = commandQueue;
mLastOrientation = mContext.getResources().getConfiguration().orientation;
configController.addCallback(this);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
index c2ed7df..379cf1f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tv/TvStatusBar.java
@@ -24,6 +24,9 @@
import com.android.systemui.SystemUI;
import com.android.systemui.statusbar.CommandQueue;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
/**
* Status bar implementation for "large screen" products that mostly present no on-screen nav.
@@ -34,10 +37,15 @@
* recording, discloses the responsible applications </li>
* </ul>
*/
+@Singleton
public class TvStatusBar extends SystemUI implements CommandQueue.Callbacks {
- public TvStatusBar(Context context) {
+ private final CommandQueue mCommandQueue;
+
+ @Inject
+ public TvStatusBar(Context context, CommandQueue commandQueue) {
super(context);
+ mCommandQueue = commandQueue;
}
@Override
@@ -46,10 +54,9 @@
final IStatusBarService barService = IStatusBarService.Stub.asInterface(
ServiceManager.getService(Context.STATUS_BAR_SERVICE));
- final CommandQueue commandQueue = getComponent(CommandQueue.class);
- commandQueue.addCallback(this);
+ mCommandQueue.addCallback(this);
try {
- barService.registerStatusBar(commandQueue);
+ barService.registerStatusBar(mCommandQueue);
} catch (RemoteException ex) {
// If the system process isn't there we're doomed anyway.
}
diff --git a/packages/SystemUI/src/com/android/systemui/util/Utils.java b/packages/SystemUI/src/com/android/systemui/util/Utils.java
index aa9c5ac..47454cb 100644
--- a/packages/SystemUI/src/com/android/systemui/util/Utils.java
+++ b/packages/SystemUI/src/com/android/systemui/util/Utils.java
@@ -23,7 +23,6 @@
import android.provider.Settings;
import android.view.View;
-import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.statusbar.CommandQueue;
@@ -53,25 +52,25 @@
View.OnAttachStateChangeListener {
private final int mMask1;
private final int mMask2;
+ private final CommandQueue mCommandQueue;
private View mView;
private boolean mDisabled;
- public DisableStateTracker(int disableMask, int disable2Mask) {
+ public DisableStateTracker(int disableMask, int disable2Mask, CommandQueue commandQueue) {
mMask1 = disableMask;
mMask2 = disable2Mask;
+ mCommandQueue = commandQueue;
}
@Override
public void onViewAttachedToWindow(View v) {
mView = v;
- SysUiServiceProvider.getComponent(v.getContext(), CommandQueue.class)
- .addCallback(this);
+ mCommandQueue.addCallback(this);
}
@Override
public void onViewDetachedFromWindow(View v) {
- SysUiServiceProvider.getComponent(mView.getContext(), CommandQueue.class)
- .removeCallback(this);
+ mCommandQueue.removeCallback(this);
mView = null;
}