Remove some calls to putComponent.
This gets some of the low hanging fruit out of the way for deprecation of the SystemUI.mComponents member. Bug: 138786270 Test: atest SystemUITests Change-Id: I9388d671a39e8a20973c39489398064c434c31ec
This commit is contained in:
@@ -23,8 +23,6 @@ import com.android.keyguard.ViewMediatorCallback;
|
||||
import com.android.systemui.statusbar.car.CarFacetButtonController;
|
||||
import com.android.systemui.statusbar.car.CarStatusBarKeyguardViewManager;
|
||||
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
|
||||
import com.android.systemui.volume.CarVolumeDialogComponent;
|
||||
import com.android.systemui.volume.VolumeDialogComponent;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@@ -57,10 +55,6 @@ public class CarSystemUIFactory extends SystemUIFactory {
|
||||
return new CarStatusBarKeyguardViewManager(context, viewMediatorCallback, lockPatternUtils);
|
||||
}
|
||||
|
||||
public VolumeDialogComponent createVolumeDialogComponent(SystemUI systemUi, Context context) {
|
||||
return new CarVolumeDialogComponent(systemUi, context);
|
||||
}
|
||||
|
||||
@Singleton
|
||||
@Component(modules = ContextHolder.class)
|
||||
public interface CarDependencyComponent {
|
||||
|
||||
@@ -36,6 +36,8 @@ import com.android.systemui.statusbar.notification.collection.NotificationData;
|
||||
import com.android.systemui.statusbar.phone.KeyguardEnvironmentImpl;
|
||||
import com.android.systemui.statusbar.phone.ShadeController;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
import com.android.systemui.volume.CarVolumeDialogComponent;
|
||||
import com.android.systemui.volume.VolumeDialogComponent;
|
||||
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
@@ -102,4 +104,8 @@ abstract class CarSystemUIModule {
|
||||
@IntoMap
|
||||
@ClassKey(StatusBar.class)
|
||||
public abstract SystemUI providesStatusBar(CarStatusBar statusBar);
|
||||
|
||||
@Binds
|
||||
abstract VolumeDialogComponent bindVolumeDialogComponent(
|
||||
CarVolumeDialogComponent carVolumeDialogComponent);
|
||||
}
|
||||
|
||||
@@ -19,15 +19,21 @@ package com.android.systemui.volume;
|
||||
import android.content.Context;
|
||||
|
||||
import com.android.systemui.SystemUI;
|
||||
import com.android.systemui.keyguard.KeyguardViewMediator;
|
||||
import com.android.systemui.plugins.VolumeDialog;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Allows for adding car specific dialog when the volume dialog is created.
|
||||
*/
|
||||
@Singleton
|
||||
public class CarVolumeDialogComponent extends VolumeDialogComponent {
|
||||
|
||||
public CarVolumeDialogComponent(SystemUI sysui, Context context) {
|
||||
super(sysui, context);
|
||||
@Inject
|
||||
public CarVolumeDialogComponent(Context context, KeyguardViewMediator keyguardViewMediator) {
|
||||
super(context, keyguardViewMediator);
|
||||
}
|
||||
|
||||
protected VolumeDialog createDefault() {
|
||||
|
||||
@@ -141,7 +141,6 @@ public class ScreenDecorations extends SystemUI implements Tunable {
|
||||
mHandler = startHandlerThread();
|
||||
mHandler.post(this::startOnScreenDecorationsThread);
|
||||
setupStatusBarPaddingIfNeeded();
|
||||
putComponent(ScreenDecorations.class, this);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -17,10 +17,12 @@
|
||||
package com.android.systemui;
|
||||
|
||||
import com.android.systemui.keyguard.KeyguardViewMediator;
|
||||
import com.android.systemui.pip.PipUI;
|
||||
import com.android.systemui.power.PowerUI;
|
||||
import com.android.systemui.recents.Recents;
|
||||
import com.android.systemui.recents.RecentsModule;
|
||||
import com.android.systemui.util.leak.GarbageMonitor;
|
||||
import com.android.systemui.volume.VolumeUI;
|
||||
|
||||
import dagger.Binds;
|
||||
import dagger.Module;
|
||||
@@ -45,6 +47,12 @@ public abstract class SystemUIBinder {
|
||||
@ClassKey(KeyguardViewMediator.class)
|
||||
public abstract SystemUI bindKeyguardViewMediator(KeyguardViewMediator sysui);
|
||||
|
||||
/** Inject into PipUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(PipUI.class)
|
||||
public abstract SystemUI bindPipUI(PipUI sysui);
|
||||
|
||||
/** Inject into PowerUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@@ -57,4 +65,10 @@ public abstract class SystemUIBinder {
|
||||
@ClassKey(Recents.class)
|
||||
public abstract SystemUI bindRecents(Recents sysui);
|
||||
|
||||
/** Inject into VolumeUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(VolumeUI.class)
|
||||
public abstract SystemUI bindVolumeUI(VolumeUI sysui);
|
||||
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ import com.android.systemui.statusbar.phone.ScrimState;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
|
||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||
import com.android.systemui.volume.VolumeDialogComponent;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@@ -169,11 +168,6 @@ public class SystemUIFactory {
|
||||
return new KeyguardIndicationController(context, indicationArea, lockIcon);
|
||||
}
|
||||
|
||||
public VolumeDialogComponent createVolumeDialogComponent(SystemUI systemUi, Context context) {
|
||||
// TODO: dagger injection.
|
||||
return new VolumeDialogComponent(systemUi, context);
|
||||
}
|
||||
|
||||
@Module
|
||||
public static class ContextHolder {
|
||||
private Context mContext;
|
||||
|
||||
@@ -794,7 +794,6 @@ public class KeyguardViewMediator extends SystemUI {
|
||||
synchronized (this) {
|
||||
setupLocked();
|
||||
}
|
||||
putComponent(KeyguardViewMediator.class, this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,15 +31,20 @@ import com.android.systemui.statusbar.CommandQueue;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Controls the picture-in-picture window.
|
||||
*/
|
||||
@Singleton
|
||||
public class PipUI extends SystemUI implements CommandQueue.Callbacks {
|
||||
|
||||
private BasePipManager mPipManager;
|
||||
|
||||
private boolean mSupportsPip;
|
||||
|
||||
@Inject
|
||||
public PipUI(Context context) {
|
||||
super(context);
|
||||
}
|
||||
@@ -64,7 +69,6 @@ public class PipUI extends SystemUI implements CommandQueue.Callbacks {
|
||||
mPipManager.initialize(mContext);
|
||||
|
||||
getComponent(CommandQueue.class).addCallback(this);
|
||||
putComponent(PipUI.class, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -101,6 +101,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
|
||||
private static final long MAX_BACKOFF_MILLIS = 10 * 60 * 1000;
|
||||
|
||||
private final Context mContext;
|
||||
private final PipUI mPipUI;
|
||||
private SysUiState mSysUiState;
|
||||
private final Handler mHandler;
|
||||
private final NavigationBarController mNavBarController;
|
||||
@@ -361,8 +362,7 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
|
||||
}
|
||||
long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
final PipUI component = SysUiServiceProvider.getComponent(mContext, PipUI.class);
|
||||
component.setShelfHeight(visible, shelfHeight);
|
||||
mPipUI.setShelfHeight(visible, shelfHeight);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
@@ -479,8 +479,9 @@ public class OverviewProxyService implements CallbackController<OverviewProxyLis
|
||||
public OverviewProxyService(Context context, DeviceProvisionedController provisionController,
|
||||
NavigationBarController navBarController, NavigationModeController navModeController,
|
||||
StatusBarWindowController statusBarWinController,
|
||||
SysUiState sysUiState) {
|
||||
SysUiState sysUiState, PipUI pipUI) {
|
||||
mContext = context;
|
||||
mPipUI = pipUI;
|
||||
mHandler = new Handler();
|
||||
mNavBarController = navBarController;
|
||||
mStatusBarWinController = statusBarWinController;
|
||||
|
||||
@@ -27,7 +27,6 @@ import android.view.WindowManager.LayoutParams;
|
||||
|
||||
import com.android.settingslib.applications.InterestingConfigChanges;
|
||||
import com.android.systemui.Dependency;
|
||||
import com.android.systemui.SystemUI;
|
||||
import com.android.systemui.keyguard.KeyguardViewMediator;
|
||||
import com.android.systemui.plugins.ActivityStarter;
|
||||
import com.android.systemui.plugins.PluginDependencyProvider;
|
||||
@@ -40,9 +39,13 @@ import com.android.systemui.tuner.TunerService;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Implementation of VolumeComponent backed by the new volume dialog.
|
||||
*/
|
||||
@Singleton
|
||||
public class VolumeDialogComponent implements VolumeComponent, TunerService.Tunable,
|
||||
VolumeDialogControllerImpl.UserActivityListener{
|
||||
|
||||
@@ -54,12 +57,12 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna
|
||||
public static final boolean DEFAULT_VOLUME_UP_TO_EXIT_SILENT = false;
|
||||
public static final boolean DEFAULT_DO_NOT_DISTURB_WHEN_SILENT = false;
|
||||
|
||||
private final SystemUI mSysui;
|
||||
protected final Context mContext;
|
||||
private final VolumeDialogControllerImpl mController;
|
||||
private final InterestingConfigChanges mConfigChanges = new InterestingConfigChanges(
|
||||
ActivityInfo.CONFIG_FONT_SCALE | ActivityInfo.CONFIG_LOCALE
|
||||
| ActivityInfo.CONFIG_ASSETS_PATHS | ActivityInfo.CONFIG_UI_MODE);
|
||||
private final KeyguardViewMediator mKeyguardViewMediator;
|
||||
private VolumeDialog mDialog;
|
||||
private VolumePolicy mVolumePolicy = new VolumePolicy(
|
||||
DEFAULT_VOLUME_DOWN_TO_ENTER_SILENT, // volumeDownToEnterSilent
|
||||
@@ -68,9 +71,10 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna
|
||||
400 // vibrateToSilentDebounce
|
||||
);
|
||||
|
||||
public VolumeDialogComponent(SystemUI sysui, Context context) {
|
||||
mSysui = sysui;
|
||||
@Inject
|
||||
public VolumeDialogComponent(Context context, KeyguardViewMediator keyguardViewMediator) {
|
||||
mContext = context;
|
||||
mKeyguardViewMediator = keyguardViewMediator;
|
||||
mController = (VolumeDialogControllerImpl) Dependency.get(VolumeDialogController.class);
|
||||
mController.setUserActivityListener(this);
|
||||
// Allow plugins to reference the VolumeDialogController.
|
||||
@@ -133,10 +137,7 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna
|
||||
|
||||
@Override
|
||||
public void onUserActivity() {
|
||||
final KeyguardViewMediator kvm = mSysui.getComponent(KeyguardViewMediator.class);
|
||||
if (kvm != null) {
|
||||
kvm.userActivity();
|
||||
}
|
||||
mKeyguardViewMediator.userActivity();
|
||||
}
|
||||
|
||||
private void applyConfiguration() {
|
||||
|
||||
@@ -23,12 +23,15 @@ import android.util.Log;
|
||||
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.SystemUI;
|
||||
import com.android.systemui.SystemUIFactory;
|
||||
import com.android.systemui.qs.tiles.DndTile;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
@Singleton
|
||||
public class VolumeUI extends SystemUI {
|
||||
private static final String TAG = "VolumeUI";
|
||||
private static boolean LOGD = Log.isLoggable(TAG, Log.DEBUG);
|
||||
@@ -38,8 +41,10 @@ public class VolumeUI extends SystemUI {
|
||||
private boolean mEnabled;
|
||||
private VolumeDialogComponent mVolumeComponent;
|
||||
|
||||
public VolumeUI(Context context) {
|
||||
@Inject
|
||||
public VolumeUI(Context context, VolumeDialogComponent volumeDialogComponent) {
|
||||
super(context);
|
||||
mVolumeComponent = volumeDialogComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,8 +55,6 @@ public class VolumeUI extends SystemUI {
|
||||
mEnabled = enableVolumeUi || enableSafetyWarning;
|
||||
if (!mEnabled) return;
|
||||
|
||||
mVolumeComponent = SystemUIFactory.getInstance()
|
||||
.createVolumeDialogComponent(this, mContext);
|
||||
mVolumeComponent.setEnableDialogs(enableVolumeUi, enableSafetyWarning);
|
||||
putComponent(VolumeComponent.class, getVolumeComponent());
|
||||
setDefaultVolumeController();
|
||||
|
||||
Reference in New Issue
Block a user