Make CoreStartable an Interface.

Context is no longer passed in as a constructor arg.

Bug: 229228871
Test: manual
Change-Id: I3dd5e593f209d120eb36faf33ba629a2066ad3f5
This commit is contained in:
Dave Mankoff
2022-04-15 03:04:39 +00:00
parent fd537d40de
commit c80ec2b14f
59 changed files with 170 additions and 197 deletions

View File

@@ -17,7 +17,6 @@
package com.android.keyguard package com.android.keyguard
import android.app.StatusBarManager.SESSION_KEYGUARD import android.app.StatusBarManager.SESSION_KEYGUARD
import android.content.Context
import android.hardware.biometrics.BiometricSourceType import android.hardware.biometrics.BiometricSourceType
import com.android.internal.annotations.VisibleForTesting import com.android.internal.annotations.VisibleForTesting
import com.android.internal.logging.UiEvent import com.android.internal.logging.UiEvent
@@ -41,11 +40,10 @@ import javax.inject.Inject
*/ */
@SysUISingleton @SysUISingleton
class KeyguardBiometricLockoutLogger @Inject constructor( class KeyguardBiometricLockoutLogger @Inject constructor(
context: Context?,
private val uiEventLogger: UiEventLogger, private val uiEventLogger: UiEventLogger,
private val keyguardUpdateMonitor: KeyguardUpdateMonitor, private val keyguardUpdateMonitor: KeyguardUpdateMonitor,
private val sessionTracker: SessionTracker private val sessionTracker: SessionTracker
) : CoreStartable(context) { ) : CoreStartable {
private var fingerprintLockedOut = false private var fingerprintLockedOut = false
private var faceLockedOut = false private var faceLockedOut = false
private var encryptedOrLockdown = false private var encryptedOrLockdown = false

View File

@@ -19,11 +19,11 @@ import kotlinx.coroutines.withContext
@SysUISingleton @SysUISingleton
class ChooserSelector @Inject constructor( class ChooserSelector @Inject constructor(
context: Context, private val context: Context,
private val featureFlags: FeatureFlags, private val featureFlags: FeatureFlags,
@Application private val coroutineScope: CoroutineScope, @Application private val coroutineScope: CoroutineScope,
@Background private val bgDispatcher: CoroutineDispatcher @Background private val bgDispatcher: CoroutineDispatcher
) : CoreStartable(context) { ) : CoreStartable {
private val packageManager = context.packageManager private val packageManager = context.packageManager
private val chooserComponent = ComponentName.unflattenFromString( private val chooserComponent = ComponentName.unflattenFromString(

View File

@@ -16,39 +16,41 @@
package com.android.systemui; package com.android.systemui;
import android.content.Context;
import android.content.res.Configuration; import android.content.res.Configuration;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.android.internal.annotations.VisibleForTesting;
import java.io.PrintWriter; import java.io.PrintWriter;
/** /**
* A top-level module of system UI code (sometimes called "system UI services" elsewhere in code). * Code that needs to be run when SystemUI is started.
* Which CoreStartable modules are loaded can be controlled via a config resource. *
* Which CoreStartable modules are loaded is controlled via the dagger graph. Bind them into the
* CoreStartable map with code such as:
*
* <pre>
* &#64;Binds
* &#64;IntoMap
* &#64;ClassKey(FoobarStartable::class)
* abstract fun bind(impl: FoobarStartable): CoreStartable
* </pre>
* *
* @see SystemUIApplication#startServicesIfNeeded() * @see SystemUIApplication#startServicesIfNeeded()
*/ */
public abstract class CoreStartable implements Dumpable { public interface CoreStartable extends Dumpable {
protected final Context mContext;
public CoreStartable(Context context) {
mContext = context;
}
/** Main entry point for implementations. Called shortly after app startup. */ /** Main entry point for implementations. Called shortly after app startup. */
public abstract void start(); void start();
protected void onConfigurationChanged(Configuration newConfig) { /** */
default void onConfigurationChanged(Configuration newConfig) {
} }
@Override @Override
public void dump(@NonNull PrintWriter pw, @NonNull String[] args) { default void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
} }
@VisibleForTesting /** Called when the device reports BOOT_COMPLETED. */
protected void onBootCompleted() { default void onBootCompleted() {
} }
} }

View File

@@ -46,7 +46,7 @@ import javax.inject.Inject;
* system that are used for testing the latency. * system that are used for testing the latency.
*/ */
@SysUISingleton @SysUISingleton
public class LatencyTester extends CoreStartable { public class LatencyTester implements CoreStartable {
private static final boolean DEFAULT_ENABLED = Build.IS_ENG; private static final boolean DEFAULT_ENABLED = Build.IS_ENG;
private static final String private static final String
ACTION_FINGERPRINT_WAKE = ACTION_FINGERPRINT_WAKE =
@@ -62,13 +62,11 @@ public class LatencyTester extends CoreStartable {
@Inject @Inject
public LatencyTester( public LatencyTester(
Context context,
BiometricUnlockController biometricUnlockController, BiometricUnlockController biometricUnlockController,
BroadcastDispatcher broadcastDispatcher, BroadcastDispatcher broadcastDispatcher,
DeviceConfigProxy deviceConfigProxy, DeviceConfigProxy deviceConfigProxy,
@Main DelayableExecutor mainExecutor @Main DelayableExecutor mainExecutor
) { ) {
super(context);
mBiometricUnlockController = biometricUnlockController; mBiometricUnlockController = biometricUnlockController;
mBroadcastDispatcher = broadcastDispatcher; mBroadcastDispatcher = broadcastDispatcher;
mDeviceConfigProxy = deviceConfigProxy; mDeviceConfigProxy = deviceConfigProxy;

View File

@@ -105,7 +105,7 @@ import kotlin.Pair;
* for antialiasing and emulation purposes. * for antialiasing and emulation purposes.
*/ */
@SysUISingleton @SysUISingleton
public class ScreenDecorations extends CoreStartable implements Tunable , Dumpable { public class ScreenDecorations implements CoreStartable, Tunable , Dumpable {
private static final boolean DEBUG = false; private static final boolean DEBUG = false;
private static final String TAG = "ScreenDecorations"; private static final String TAG = "ScreenDecorations";
@@ -130,6 +130,7 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab
@VisibleForTesting @VisibleForTesting
protected boolean mIsRegistered; protected boolean mIsRegistered;
private final BroadcastDispatcher mBroadcastDispatcher; private final BroadcastDispatcher mBroadcastDispatcher;
private final Context mContext;
private final Executor mMainExecutor; private final Executor mMainExecutor;
private final TunerService mTunerService; private final TunerService mTunerService;
private final SecureSettings mSecureSettings; private final SecureSettings mSecureSettings;
@@ -308,7 +309,7 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab
ThreadFactory threadFactory, ThreadFactory threadFactory,
PrivacyDotDecorProviderFactory dotFactory, PrivacyDotDecorProviderFactory dotFactory,
FaceScanningProviderFactory faceScanningFactory) { FaceScanningProviderFactory faceScanningFactory) {
super(context); mContext = context;
mMainExecutor = mainExecutor; mMainExecutor = mainExecutor;
mSecureSettings = secureSettings; mSecureSettings = secureSettings;
mBroadcastDispatcher = broadcastDispatcher; mBroadcastDispatcher = broadcastDispatcher;
@@ -973,7 +974,7 @@ public class ScreenDecorations extends CoreStartable implements Tunable , Dumpab
} }
@Override @Override
protected void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {
if (DEBUG_DISABLE_SCREEN_DECORATIONS) { if (DEBUG_DISABLE_SCREEN_DECORATIONS) {
Log.i(TAG, "ScreenDecorations is disabled"); Log.i(TAG, "ScreenDecorations is disabled");
return; return;

View File

@@ -38,16 +38,17 @@ import javax.inject.Inject;
* @see SliceBroadcastRelay * @see SliceBroadcastRelay
*/ */
@SysUISingleton @SysUISingleton
public class SliceBroadcastRelayHandler extends CoreStartable { public class SliceBroadcastRelayHandler implements CoreStartable {
private static final String TAG = "SliceBroadcastRelay"; private static final String TAG = "SliceBroadcastRelay";
private static final boolean DEBUG = false; private static final boolean DEBUG = false;
private final ArrayMap<Uri, BroadcastRelay> mRelays = new ArrayMap<>(); private final ArrayMap<Uri, BroadcastRelay> mRelays = new ArrayMap<>();
private final Context mContext;
private final BroadcastDispatcher mBroadcastDispatcher; private final BroadcastDispatcher mBroadcastDispatcher;
@Inject @Inject
public SliceBroadcastRelayHandler(Context context, BroadcastDispatcher broadcastDispatcher) { public SliceBroadcastRelayHandler(Context context, BroadcastDispatcher broadcastDispatcher) {
super(context); mContext = context;
mBroadcastDispatcher = broadcastDispatcher; mBroadcastDispatcher = broadcastDispatcher;
} }

View File

@@ -45,8 +45,6 @@ import com.android.systemui.dagger.SysUIComponent;
import com.android.systemui.dump.DumpManager; import com.android.systemui.dump.DumpManager;
import com.android.systemui.util.NotificationChannels; import com.android.systemui.util.NotificationChannels;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.Comparator; import java.util.Comparator;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
@@ -287,14 +285,10 @@ public class SystemUIApplication extends Application implements
CoreStartable startable; CoreStartable startable;
if (DEBUG) Log.d(TAG, "loading: " + clsName); if (DEBUG) Log.d(TAG, "loading: " + clsName);
try { try {
Constructor<?> constructor = Class.forName(clsName).getConstructor( startable = (CoreStartable) Class.forName(clsName).newInstance();
Context.class);
startable = (CoreStartable) constructor.newInstance(this);
} catch (ClassNotFoundException } catch (ClassNotFoundException
| NoSuchMethodException
| IllegalAccessException | IllegalAccessException
| InstantiationException | InstantiationException ex) {
| InvocationTargetException ex) {
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }

View File

@@ -16,15 +16,12 @@
package com.android.systemui; package com.android.systemui;
import android.content.Context;
/** /**
* Placeholder for any vendor-specific services. * Placeholder for any vendor-specific services.
*/ */
public class VendorServices extends CoreStartable { public class VendorServices implements CoreStartable {
public VendorServices(Context context) { public VendorServices() {
super(context);
} }
@Override @Override

View File

@@ -69,7 +69,7 @@ import dagger.Lazy;
* Class to register system actions with accessibility framework. * Class to register system actions with accessibility framework.
*/ */
@SysUISingleton @SysUISingleton
public class SystemActions extends CoreStartable { public class SystemActions implements CoreStartable {
private static final String TAG = "SystemActions"; private static final String TAG = "SystemActions";
/** /**
@@ -177,6 +177,7 @@ public class SystemActions extends CoreStartable {
private static final String PERMISSION_SELF = "com.android.systemui.permission.SELF"; private static final String PERMISSION_SELF = "com.android.systemui.permission.SELF";
private final SystemActionsBroadcastReceiver mReceiver; private final SystemActionsBroadcastReceiver mReceiver;
private final Context mContext;
private final Optional<Recents> mRecentsOptional; private final Optional<Recents> mRecentsOptional;
private Locale mLocale; private Locale mLocale;
private final AccessibilityManager mA11yManager; private final AccessibilityManager mA11yManager;
@@ -190,7 +191,7 @@ public class SystemActions extends CoreStartable {
NotificationShadeWindowController notificationShadeController, NotificationShadeWindowController notificationShadeController,
Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy, Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
Optional<Recents> recentsOptional) { Optional<Recents> recentsOptional) {
super(context); mContext = context;
mRecentsOptional = recentsOptional; mRecentsOptional = recentsOptional;
mReceiver = new SystemActionsBroadcastReceiver(); mReceiver = new SystemActionsBroadcastReceiver();
mLocale = mContext.getResources().getConfiguration().getLocales().get(0); mLocale = mContext.getResources().getConfiguration().getLocales().get(0);
@@ -219,7 +220,6 @@ public class SystemActions extends CoreStartable {
@Override @Override
public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
final Locale locale = mContext.getResources().getConfiguration().getLocales().get(0); final Locale locale = mContext.getResources().getConfiguration().getLocales().get(0);
if (!locale.equals(mLocale)) { if (!locale.equals(mLocale)) {
mLocale = locale; mLocale = locale;

View File

@@ -53,11 +53,12 @@ import javax.inject.Inject;
* when {@code IStatusBar#requestWindowMagnificationConnection(boolean)} is called. * when {@code IStatusBar#requestWindowMagnificationConnection(boolean)} is called.
*/ */
@SysUISingleton @SysUISingleton
public class WindowMagnification extends CoreStartable implements WindowMagnifierCallback, public class WindowMagnification implements CoreStartable, WindowMagnifierCallback,
CommandQueue.Callbacks { CommandQueue.Callbacks {
private static final String TAG = "WindowMagnification"; private static final String TAG = "WindowMagnification";
private final ModeSwitchesController mModeSwitchesController; private final ModeSwitchesController mModeSwitchesController;
private final Context mContext;
private final Handler mHandler; private final Handler mHandler;
private final AccessibilityManager mAccessibilityManager; private final AccessibilityManager mAccessibilityManager;
private final CommandQueue mCommandQueue; private final CommandQueue mCommandQueue;
@@ -108,7 +109,7 @@ public class WindowMagnification extends CoreStartable implements WindowMagnifie
public WindowMagnification(Context context, @Main Handler mainHandler, public WindowMagnification(Context context, @Main Handler mainHandler,
CommandQueue commandQueue, ModeSwitchesController modeSwitchesController, CommandQueue commandQueue, ModeSwitchesController modeSwitchesController,
SysUiState sysUiState, OverviewProxyService overviewProxyService) { SysUiState sysUiState, OverviewProxyService overviewProxyService) {
super(context); mContext = context;
mHandler = mainHandler; mHandler = mainHandler;
mAccessibilityManager = mContext.getSystemService(AccessibilityManager.class); mAccessibilityManager = mContext.getSystemService(AccessibilityManager.class);
mCommandQueue = commandQueue; mCommandQueue = commandQueue;

View File

@@ -104,7 +104,7 @@ import kotlin.Unit;
* {@link com.android.keyguard.KeyguardUpdateMonitor} * {@link com.android.keyguard.KeyguardUpdateMonitor}
*/ */
@SysUISingleton @SysUISingleton
public class AuthController extends CoreStartable implements CommandQueue.Callbacks, public class AuthController implements CoreStartable, CommandQueue.Callbacks,
AuthDialogCallback, DozeReceiver { AuthDialogCallback, DozeReceiver {
private static final String TAG = "AuthController"; private static final String TAG = "AuthController";
@@ -112,6 +112,7 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba
private static final int SENSOR_PRIVACY_DELAY = 500; private static final int SENSOR_PRIVACY_DELAY = 500;
private final Handler mHandler; private final Handler mHandler;
private final Context mContext;
private final Execution mExecution; private final Execution mExecution;
private final CommandQueue mCommandQueue; private final CommandQueue mCommandQueue;
private final StatusBarStateController mStatusBarStateController; private final StatusBarStateController mStatusBarStateController;
@@ -697,7 +698,7 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba
@Main Handler handler, @Main Handler handler,
@Background DelayableExecutor bgExecutor, @Background DelayableExecutor bgExecutor,
@NonNull VibratorHelper vibrator) { @NonNull VibratorHelper vibrator) {
super(context); mContext = context;
mExecution = execution; mExecution = execution;
mUserManager = userManager; mUserManager = userManager;
mLockPatternUtils = lockPatternUtils; mLockPatternUtils = lockPatternUtils;
@@ -1152,8 +1153,7 @@ public class AuthController extends CoreStartable implements CommandQueue.Callba
} }
@Override @Override
protected void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
updateSensorLocations(); updateSensorLocations();
// Save the state of the current dialog (buttons showing, etc) // Save the state of the current dialog (buttons showing, etc)

View File

@@ -16,14 +16,12 @@
package com.android.systemui.broadcast package com.android.systemui.broadcast
import android.content.Context
import com.android.systemui.CoreStartable import com.android.systemui.CoreStartable
import javax.inject.Inject import javax.inject.Inject
class BroadcastDispatcherStartable @Inject constructor( class BroadcastDispatcherStartable @Inject constructor(
context: Context,
val broadcastDispatcher: BroadcastDispatcher val broadcastDispatcher: BroadcastDispatcher
) : CoreStartable(context) { ) : CoreStartable {
override fun start() { override fun start() {
broadcastDispatcher.initialize() broadcastDispatcher.initialize()

View File

@@ -39,8 +39,8 @@ import javax.inject.Inject;
* ClipboardListener brings up a clipboard overlay when something is copied to the clipboard. * ClipboardListener brings up a clipboard overlay when something is copied to the clipboard.
*/ */
@SysUISingleton @SysUISingleton
public class ClipboardListener extends CoreStartable public class ClipboardListener implements
implements ClipboardManager.OnPrimaryClipChangedListener { CoreStartable, ClipboardManager.OnPrimaryClipChangedListener {
private static final String TAG = "ClipboardListener"; private static final String TAG = "ClipboardListener";
@VisibleForTesting @VisibleForTesting
@@ -49,6 +49,7 @@ public class ClipboardListener extends CoreStartable
static final String EXTRA_SUPPRESS_OVERLAY = static final String EXTRA_SUPPRESS_OVERLAY =
"com.android.systemui.SUPPRESS_CLIPBOARD_OVERLAY"; "com.android.systemui.SUPPRESS_CLIPBOARD_OVERLAY";
private final Context mContext;
private final DeviceConfigProxy mDeviceConfig; private final DeviceConfigProxy mDeviceConfig;
private final ClipboardOverlayControllerFactory mOverlayFactory; private final ClipboardOverlayControllerFactory mOverlayFactory;
private final ClipboardManager mClipboardManager; private final ClipboardManager mClipboardManager;
@@ -59,7 +60,7 @@ public class ClipboardListener extends CoreStartable
public ClipboardListener(Context context, DeviceConfigProxy deviceConfigProxy, public ClipboardListener(Context context, DeviceConfigProxy deviceConfigProxy,
ClipboardOverlayControllerFactory overlayFactory, ClipboardManager clipboardManager, ClipboardOverlayControllerFactory overlayFactory, ClipboardManager clipboardManager,
UiEventLogger uiEventLogger) { UiEventLogger uiEventLogger) {
super(context); mContext = context;
mDeviceConfig = deviceConfigProxy; mDeviceConfig = deviceConfigProxy;
mOverlayFactory = overlayFactory; mOverlayFactory = overlayFactory;
mClipboardManager = clipboardManager; mClipboardManager = clipboardManager;

View File

@@ -40,11 +40,12 @@ import javax.inject.Inject;
* {@link DreamOverlayRegistrant} is responsible for telling system server that SystemUI should be * {@link DreamOverlayRegistrant} is responsible for telling system server that SystemUI should be
* the designated dream overlay component. * the designated dream overlay component.
*/ */
public class DreamOverlayRegistrant extends CoreStartable { public class DreamOverlayRegistrant implements CoreStartable {
private static final String TAG = "DreamOverlayRegistrant"; private static final String TAG = "DreamOverlayRegistrant";
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
private final IDreamManager mDreamManager; private final IDreamManager mDreamManager;
private final ComponentName mOverlayServiceComponent; private final ComponentName mOverlayServiceComponent;
private final Context mContext;
private final Resources mResources; private final Resources mResources;
private boolean mCurrentRegisteredState = false; private boolean mCurrentRegisteredState = false;
@@ -98,7 +99,7 @@ public class DreamOverlayRegistrant extends CoreStartable {
@Inject @Inject
public DreamOverlayRegistrant(Context context, @Main Resources resources) { public DreamOverlayRegistrant(Context context, @Main Resources resources) {
super(context); mContext = context;
mResources = resources; mResources = resources;
mDreamManager = IDreamManager.Stub.asInterface( mDreamManager = IDreamManager.Stub.asInterface(
ServiceManager.getService(DreamService.DREAM_SERVICE)); ServiceManager.getService(DreamService.DREAM_SERVICE));

View File

@@ -16,7 +16,6 @@
package com.android.systemui.dreams.complication; package com.android.systemui.dreams.complication;
import android.content.Context;
import android.database.ContentObserver; import android.database.ContentObserver;
import android.os.UserHandle; import android.os.UserHandle;
import android.provider.Settings; import android.provider.Settings;
@@ -37,7 +36,7 @@ import javax.inject.Inject;
* user, and pushes updates to {@link DreamOverlayStateController}. * user, and pushes updates to {@link DreamOverlayStateController}.
*/ */
@SysUISingleton @SysUISingleton
public class ComplicationTypesUpdater extends CoreStartable { public class ComplicationTypesUpdater implements CoreStartable {
private final DreamBackend mDreamBackend; private final DreamBackend mDreamBackend;
private final Executor mExecutor; private final Executor mExecutor;
private final SecureSettings mSecureSettings; private final SecureSettings mSecureSettings;
@@ -45,13 +44,11 @@ public class ComplicationTypesUpdater extends CoreStartable {
private final DreamOverlayStateController mDreamOverlayStateController; private final DreamOverlayStateController mDreamOverlayStateController;
@Inject @Inject
ComplicationTypesUpdater(Context context, ComplicationTypesUpdater(
DreamBackend dreamBackend, DreamBackend dreamBackend,
@Main Executor executor, @Main Executor executor,
SecureSettings secureSettings, SecureSettings secureSettings,
DreamOverlayStateController dreamOverlayStateController) { DreamOverlayStateController dreamOverlayStateController) {
super(context);
mDreamBackend = dreamBackend; mDreamBackend = dreamBackend;
mExecutor = executor; mExecutor = executor;
mSecureSettings = secureSettings; mSecureSettings = secureSettings;

View File

@@ -19,7 +19,6 @@ package com.android.systemui.dreams.complication;
import static com.android.systemui.dreams.complication.dagger.DreamClockTimeComplicationModule.DREAM_CLOCK_TIME_COMPLICATION_VIEW; import static com.android.systemui.dreams.complication.dagger.DreamClockTimeComplicationModule.DREAM_CLOCK_TIME_COMPLICATION_VIEW;
import static com.android.systemui.dreams.complication.dagger.RegisteredComplicationsModule.DREAM_CLOCK_TIME_COMPLICATION_LAYOUT_PARAMS; import static com.android.systemui.dreams.complication.dagger.RegisteredComplicationsModule.DREAM_CLOCK_TIME_COMPLICATION_LAYOUT_PARAMS;
import android.content.Context;
import android.view.View; import android.view.View;
import com.android.systemui.CoreStartable; import com.android.systemui.CoreStartable;
@@ -61,7 +60,7 @@ public class DreamClockTimeComplication implements Complication {
* {@link CoreStartable} responsible for registering {@link DreamClockTimeComplication} with * {@link CoreStartable} responsible for registering {@link DreamClockTimeComplication} with
* SystemUI. * SystemUI.
*/ */
public static class Registrant extends CoreStartable { public static class Registrant implements CoreStartable {
private final DreamOverlayStateController mDreamOverlayStateController; private final DreamOverlayStateController mDreamOverlayStateController;
private final DreamClockTimeComplication mComplication; private final DreamClockTimeComplication mComplication;
@@ -69,10 +68,9 @@ public class DreamClockTimeComplication implements Complication {
* Default constructor to register {@link DreamClockTimeComplication}. * Default constructor to register {@link DreamClockTimeComplication}.
*/ */
@Inject @Inject
public Registrant(Context context, public Registrant(
DreamOverlayStateController dreamOverlayStateController, DreamOverlayStateController dreamOverlayStateController,
DreamClockTimeComplication dreamClockTimeComplication) { DreamClockTimeComplication dreamClockTimeComplication) {
super(context);
mDreamOverlayStateController = dreamOverlayStateController; mDreamOverlayStateController = dreamOverlayStateController;
mComplication = dreamClockTimeComplication; mComplication = dreamClockTimeComplication;
} }

View File

@@ -71,7 +71,7 @@ public class DreamHomeControlsComplication implements Complication {
/** /**
* {@link CoreStartable} for registering the complication with SystemUI on startup. * {@link CoreStartable} for registering the complication with SystemUI on startup.
*/ */
public static class Registrant extends CoreStartable { public static class Registrant implements CoreStartable {
private final DreamHomeControlsComplication mComplication; private final DreamHomeControlsComplication mComplication;
private final DreamOverlayStateController mDreamOverlayStateController; private final DreamOverlayStateController mDreamOverlayStateController;
private final ControlsComponent mControlsComponent; private final ControlsComponent mControlsComponent;
@@ -90,11 +90,9 @@ public class DreamHomeControlsComplication implements Complication {
}; };
@Inject @Inject
public Registrant(Context context, DreamHomeControlsComplication complication, public Registrant(DreamHomeControlsComplication complication,
DreamOverlayStateController dreamOverlayStateController, DreamOverlayStateController dreamOverlayStateController,
ControlsComponent controlsComponent) { ControlsComponent controlsComponent) {
super(context);
mComplication = complication; mComplication = complication;
mControlsComponent = controlsComponent; mControlsComponent = controlsComponent;
mDreamOverlayStateController = dreamOverlayStateController; mDreamOverlayStateController = dreamOverlayStateController;

View File

@@ -61,7 +61,7 @@ public class SmartSpaceComplication implements Complication {
* {@link CoreStartable} responsbile for registering {@link SmartSpaceComplication} with * {@link CoreStartable} responsbile for registering {@link SmartSpaceComplication} with
* SystemUI. * SystemUI.
*/ */
public static class Registrant extends CoreStartable { public static class Registrant implements CoreStartable {
private final DreamSmartspaceController mSmartSpaceController; private final DreamSmartspaceController mSmartSpaceController;
private final DreamOverlayStateController mDreamOverlayStateController; private final DreamOverlayStateController mDreamOverlayStateController;
private final SmartSpaceComplication mComplication; private final SmartSpaceComplication mComplication;
@@ -78,11 +78,10 @@ public class SmartSpaceComplication implements Complication {
* Default constructor for {@link SmartSpaceComplication}. * Default constructor for {@link SmartSpaceComplication}.
*/ */
@Inject @Inject
public Registrant(Context context, public Registrant(
DreamOverlayStateController dreamOverlayStateController, DreamOverlayStateController dreamOverlayStateController,
SmartSpaceComplication smartSpaceComplication, SmartSpaceComplication smartSpaceComplication,
DreamSmartspaceController smartSpaceController) { DreamSmartspaceController smartSpaceController) {
super(context);
mDreamOverlayStateController = dreamOverlayStateController; mDreamOverlayStateController = dreamOverlayStateController;
mComplication = smartSpaceComplication; mComplication = smartSpaceComplication;
mSmartSpaceController = smartSpaceController; mSmartSpaceController = smartSpaceController;

View File

@@ -16,9 +16,7 @@
package com.android.systemui.flags package com.android.systemui.flags
import android.content.Context
import com.android.systemui.CoreStartable import com.android.systemui.CoreStartable
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dump.DumpManager import com.android.systemui.dump.DumpManager
import com.android.systemui.statusbar.commandline.CommandRegistry import com.android.systemui.statusbar.commandline.CommandRegistry
import dagger.Binds import dagger.Binds
@@ -30,12 +28,11 @@ import javax.inject.Inject
class FeatureFlagsDebugStartable class FeatureFlagsDebugStartable
@Inject @Inject
constructor( constructor(
@Application context: Context,
dumpManager: DumpManager, dumpManager: DumpManager,
private val commandRegistry: CommandRegistry, private val commandRegistry: CommandRegistry,
private val flagCommand: FlagCommand, private val flagCommand: FlagCommand,
featureFlags: FeatureFlags featureFlags: FeatureFlags
) : CoreStartable(context) { ) : CoreStartable {
init { init {
dumpManager.registerDumpable(FeatureFlagsDebug.TAG) { pw, args -> dumpManager.registerDumpable(FeatureFlagsDebug.TAG) { pw, args ->

View File

@@ -16,9 +16,7 @@
package com.android.systemui.flags package com.android.systemui.flags
import android.content.Context
import com.android.systemui.CoreStartable import com.android.systemui.CoreStartable
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dump.DumpManager import com.android.systemui.dump.DumpManager
import dagger.Binds import dagger.Binds
import dagger.Module import dagger.Module
@@ -28,8 +26,7 @@ import javax.inject.Inject
class FeatureFlagsReleaseStartable class FeatureFlagsReleaseStartable
@Inject @Inject
constructor(@Application context: Context, dumpManager: DumpManager, featureFlags: FeatureFlags) : constructor(dumpManager: DumpManager, featureFlags: FeatureFlags) : CoreStartable {
CoreStartable(context) {
init { init {
dumpManager.registerDumpable(FeatureFlagsRelease.TAG) { pw, args -> dumpManager.registerDumpable(FeatureFlagsRelease.TAG) { pw, args ->

View File

@@ -36,8 +36,7 @@ import javax.inject.Provider;
* Manages power menu plugins and communicates power menu actions to the CentralSurfaces. * Manages power menu plugins and communicates power menu actions to the CentralSurfaces.
*/ */
@SysUISingleton @SysUISingleton
public class GlobalActionsComponent extends CoreStartable public class GlobalActionsComponent implements CoreStartable, Callbacks, GlobalActionsManager {
implements Callbacks, GlobalActionsManager {
private final CommandQueue mCommandQueue; private final CommandQueue mCommandQueue;
private final ExtensionController mExtensionController; private final ExtensionController mExtensionController;
@@ -48,11 +47,10 @@ public class GlobalActionsComponent extends CoreStartable
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
@Inject @Inject
public GlobalActionsComponent(Context context, CommandQueue commandQueue, public GlobalActionsComponent(CommandQueue commandQueue,
ExtensionController extensionController, ExtensionController extensionController,
Provider<GlobalActions> globalActionsProvider, Provider<GlobalActions> globalActionsProvider,
StatusBarKeyguardViewManager statusBarKeyguardViewManager) { StatusBarKeyguardViewManager statusBarKeyguardViewManager) {
super(context);
mCommandQueue = commandQueue; mCommandQueue = commandQueue;
mExtensionController = extensionController; mExtensionController = extensionController;
mGlobalActionsProvider = globalActionsProvider; mGlobalActionsProvider = globalActionsProvider;

View File

@@ -27,7 +27,6 @@ import android.bluetooth.le.ScanSettings;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.res.Configuration;
import android.hardware.input.InputManager; import android.hardware.input.InputManager;
import android.os.Handler; import android.os.Handler;
import android.os.HandlerThread; import android.os.HandlerThread;
@@ -66,7 +65,7 @@ import javax.inject.Provider;
/** */ /** */
@SysUISingleton @SysUISingleton
public class KeyboardUI extends CoreStartable implements InputManager.OnTabletModeChangedListener { public class KeyboardUI implements CoreStartable, InputManager.OnTabletModeChangedListener {
private static final String TAG = "KeyboardUI"; private static final String TAG = "KeyboardUI";
private static final boolean DEBUG = false; private static final boolean DEBUG = false;
@@ -127,23 +126,18 @@ public class KeyboardUI extends CoreStartable implements InputManager.OnTabletMo
@Inject @Inject
public KeyboardUI(Context context, Provider<LocalBluetoothManager> bluetoothManagerProvider) { public KeyboardUI(Context context, Provider<LocalBluetoothManager> bluetoothManagerProvider) {
super(context); mContext = context;
this.mBluetoothManagerProvider = bluetoothManagerProvider; this.mBluetoothManagerProvider = bluetoothManagerProvider;
} }
@Override @Override
public void start() { public void start() {
mContext = super.mContext;
HandlerThread thread = new HandlerThread("Keyboard", Process.THREAD_PRIORITY_BACKGROUND); HandlerThread thread = new HandlerThread("Keyboard", Process.THREAD_PRIORITY_BACKGROUND);
thread.start(); thread.start();
mHandler = new KeyboardHandler(thread.getLooper()); mHandler = new KeyboardHandler(thread.getLooper());
mHandler.sendEmptyMessage(MSG_INIT); mHandler.sendEmptyMessage(MSG_INIT);
} }
@Override
protected void onConfigurationChanged(Configuration newConfig) {
}
@Override @Override
public void dump(PrintWriter pw, String[] args) { public void dump(PrintWriter pw, String[] args) {
pw.println("KeyboardUI:"); pw.println("KeyboardUI:");
@@ -156,7 +150,7 @@ public class KeyboardUI extends CoreStartable implements InputManager.OnTabletMo
} }
@Override @Override
protected void onBootCompleted() { public void onBootCompleted() {
mHandler.sendEmptyMessage(MSG_ON_BOOT_COMPLETED); mHandler.sendEmptyMessage(MSG_ON_BOOT_COMPLETED);
} }

View File

@@ -186,7 +186,7 @@ import dagger.Lazy;
* directly to the keyguard UI is posted to a {@link android.os.Handler} to ensure it is taken on the UI * directly to the keyguard UI is posted to a {@link android.os.Handler} to ensure it is taken on the UI
* thread of the keyguard. * thread of the keyguard.
*/ */
public class KeyguardViewMediator extends CoreStartable implements Dumpable, public class KeyguardViewMediator implements CoreStartable, Dumpable,
StatusBarStateController.StateListener { StatusBarStateController.StateListener {
private static final int KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT = 30000; private static final int KEYGUARD_DISPLAY_TIMEOUT_DELAY_DEFAULT = 30000;
private static final long KEYGUARD_DONE_PENDING_TIMEOUT_MS = 3000; private static final long KEYGUARD_DONE_PENDING_TIMEOUT_MS = 3000;
@@ -272,6 +272,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
private boolean mShuttingDown; private boolean mShuttingDown;
private boolean mDozing; private boolean mDozing;
private boolean mAnimatingScreenOff; private boolean mAnimatingScreenOff;
private final Context mContext;
private final FalsingCollector mFalsingCollector; private final FalsingCollector mFalsingCollector;
/** High level access to the power manager for WakeLocks */ /** High level access to the power manager for WakeLocks */
@@ -1128,7 +1129,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
DreamOverlayStateController dreamOverlayStateController, DreamOverlayStateController dreamOverlayStateController,
Lazy<NotificationShadeWindowController> notificationShadeWindowControllerLazy, Lazy<NotificationShadeWindowController> notificationShadeWindowControllerLazy,
Lazy<ActivityLaunchAnimator> activityLaunchAnimator) { Lazy<ActivityLaunchAnimator> activityLaunchAnimator) {
super(context); mContext = context;
mFalsingCollector = falsingCollector; mFalsingCollector = falsingCollector;
mLockPatternUtils = lockPatternUtils; mLockPatternUtils = lockPatternUtils;
mBroadcastDispatcher = broadcastDispatcher; mBroadcastDispatcher = broadcastDispatcher;

View File

@@ -21,7 +21,6 @@ import static android.app.StatusBarManager.SESSION_BIOMETRIC_PROMPT;
import static android.app.StatusBarManager.SESSION_KEYGUARD; import static android.app.StatusBarManager.SESSION_KEYGUARD;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.content.Context;
import android.os.RemoteException; import android.os.RemoteException;
import android.util.Log; import android.util.Log;
@@ -48,7 +47,7 @@ import javax.inject.Inject;
* session. Can be used across processes via StatusBarManagerService#registerSessionListener * session. Can be used across processes via StatusBarManagerService#registerSessionListener
*/ */
@SysUISingleton @SysUISingleton
public class SessionTracker extends CoreStartable { public class SessionTracker implements CoreStartable {
private static final String TAG = "SessionTracker"; private static final String TAG = "SessionTracker";
private static final boolean DEBUG = false; private static final boolean DEBUG = false;
@@ -65,13 +64,11 @@ public class SessionTracker extends CoreStartable {
@Inject @Inject
public SessionTracker( public SessionTracker(
Context context,
IStatusBarService statusBarService, IStatusBarService statusBarService,
AuthController authController, AuthController authController,
KeyguardUpdateMonitor keyguardUpdateMonitor, KeyguardUpdateMonitor keyguardUpdateMonitor,
KeyguardStateController keyguardStateController KeyguardStateController keyguardStateController
) { ) {
super(context);
mStatusBarManagerService = statusBarService; mStatusBarManagerService = statusBarService;
mAuthController = authController; mAuthController = authController;
mKeyguardUpdateMonitor = keyguardUpdateMonitor; mKeyguardUpdateMonitor = keyguardUpdateMonitor;

View File

@@ -51,9 +51,10 @@ import javax.inject.Inject;
* {@link android.Manifest.permission#READ_EXTERNAL_STORAGE}. * {@link android.Manifest.permission#READ_EXTERNAL_STORAGE}.
*/ */
@SysUISingleton @SysUISingleton
public class RingtonePlayer extends CoreStartable { public class RingtonePlayer implements CoreStartable {
private static final String TAG = "RingtonePlayer"; private static final String TAG = "RingtonePlayer";
private static final boolean LOGD = false; private static final boolean LOGD = false;
private final Context mContext;
// TODO: support Uri switching under same IBinder // TODO: support Uri switching under same IBinder
@@ -64,7 +65,7 @@ public class RingtonePlayer extends CoreStartable {
@Inject @Inject
public RingtonePlayer(Context context) { public RingtonePlayer(Context context) {
super(context); mContext = context;
} }
@Override @Override

View File

@@ -18,7 +18,6 @@ package com.android.systemui.media.dream;
import static com.android.systemui.flags.Flags.DREAM_MEDIA_COMPLICATION; import static com.android.systemui.flags.Flags.DREAM_MEDIA_COMPLICATION;
import android.content.Context;
import android.util.Log; import android.util.Log;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@@ -38,7 +37,7 @@ import javax.inject.Inject;
* {@link MediaDreamSentinel} is responsible for tracking media state and registering/unregistering * {@link MediaDreamSentinel} is responsible for tracking media state and registering/unregistering
* the media complication as appropriate * the media complication as appropriate
*/ */
public class MediaDreamSentinel extends CoreStartable { public class MediaDreamSentinel implements CoreStartable {
private static final String TAG = "MediaDreamSentinel"; private static final String TAG = "MediaDreamSentinel";
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
@@ -113,11 +112,10 @@ public class MediaDreamSentinel extends CoreStartable {
private final FeatureFlags mFeatureFlags; private final FeatureFlags mFeatureFlags;
@Inject @Inject
public MediaDreamSentinel(Context context, MediaDataManager mediaDataManager, public MediaDreamSentinel(MediaDataManager mediaDataManager,
DreamOverlayStateController dreamOverlayStateController, DreamOverlayStateController dreamOverlayStateController,
DreamMediaEntryComplication mediaEntryComplication, DreamMediaEntryComplication mediaEntryComplication,
FeatureFlags featureFlags) { FeatureFlags featureFlags) {
super(context);
mMediaDataManager = mediaDataManager; mMediaDataManager = mediaDataManager;
mDreamOverlayStateController = dreamOverlayStateController; mDreamOverlayStateController = dreamOverlayStateController;
mMediaEntryComplication = mediaEntryComplication; mMediaEntryComplication = mediaEntryComplication;

View File

@@ -40,7 +40,7 @@ import javax.inject.Inject;
* documented at {@link #handleTaskStackChanged} apply. * documented at {@link #handleTaskStackChanged} apply.
*/ */
@SysUISingleton @SysUISingleton
public class HomeSoundEffectController extends CoreStartable { public class HomeSoundEffectController implements CoreStartable {
private static final String TAG = "HomeSoundEffectController"; private static final String TAG = "HomeSoundEffectController";
private final AudioManager mAudioManager; private final AudioManager mAudioManager;
@@ -65,7 +65,6 @@ public class HomeSoundEffectController extends CoreStartable {
TaskStackChangeListeners taskStackChangeListeners, TaskStackChangeListeners taskStackChangeListeners,
ActivityManagerWrapper activityManagerWrapper, ActivityManagerWrapper activityManagerWrapper,
PackageManager packageManager) { PackageManager packageManager) {
super(context);
mAudioManager = audioManager; mAudioManager = audioManager;
mTaskStackChangeListeners = taskStackChangeListeners; mTaskStackChangeListeners = taskStackChangeListeners;
mActivityManagerWrapper = activityManagerWrapper; mActivityManagerWrapper = activityManagerWrapper;

View File

@@ -43,7 +43,7 @@ class MediaTttCommandLineHelper @Inject constructor(
private val commandRegistry: CommandRegistry, private val commandRegistry: CommandRegistry,
private val context: Context, private val context: Context,
@Main private val mainExecutor: Executor @Main private val mainExecutor: Executor
) : CoreStartable(context) { ) : CoreStartable {
/** All commands for the sender device. */ /** All commands for the sender device. */
inner class SenderCommand : Command { inner class SenderCommand : Command {

View File

@@ -59,7 +59,7 @@ import javax.inject.Inject;
import dagger.Lazy; import dagger.Lazy;
@SysUISingleton @SysUISingleton
public class PowerUI extends CoreStartable implements CommandQueue.Callbacks { public class PowerUI implements CoreStartable, CommandQueue.Callbacks {
static final String TAG = "PowerUI"; static final String TAG = "PowerUI";
static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
@@ -103,6 +103,7 @@ public class PowerUI extends CoreStartable implements CommandQueue.Callbacks {
private IThermalEventListener mSkinThermalEventListener; private IThermalEventListener mSkinThermalEventListener;
private IThermalEventListener mUsbThermalEventListener; private IThermalEventListener mUsbThermalEventListener;
private final Context mContext;
private final BroadcastDispatcher mBroadcastDispatcher; private final BroadcastDispatcher mBroadcastDispatcher;
private final CommandQueue mCommandQueue; private final CommandQueue mCommandQueue;
private final Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy; private final Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy;
@@ -112,7 +113,7 @@ public class PowerUI extends CoreStartable implements CommandQueue.Callbacks {
CommandQueue commandQueue, Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy, CommandQueue commandQueue, Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
WarningsUI warningsUI, EnhancedEstimates enhancedEstimates, WarningsUI warningsUI, EnhancedEstimates enhancedEstimates,
PowerManager powerManager) { PowerManager powerManager) {
super(context); mContext = context;
mBroadcastDispatcher = broadcastDispatcher; mBroadcastDispatcher = broadcastDispatcher;
mCommandQueue = commandQueue; mCommandQueue = commandQueue;
mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy; mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy;
@@ -169,7 +170,7 @@ public class PowerUI extends CoreStartable implements CommandQueue.Callbacks {
} }
@Override @Override
protected void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {
final int mask = ActivityInfo.CONFIG_MCC | ActivityInfo.CONFIG_MNC; final int mask = ActivityInfo.CONFIG_MCC | ActivityInfo.CONFIG_MNC;
// Safe to modify mLastConfiguration here as it's only updated by the main thread (here). // Safe to modify mLastConfiguration here as it's only updated by the main thread (here).

View File

@@ -70,8 +70,8 @@ import javax.inject.Inject;
* recording audio, camera, the screen, or accessing the location. * recording audio, camera, the screen, or accessing the location.
*/ */
@SysUISingleton @SysUISingleton
public class TvPrivacyChipsController extends CoreStartable public class TvPrivacyChipsController
implements PrivacyItemController.Callback { implements CoreStartable, PrivacyItemController.Callback {
private static final String TAG = "TvPrivacyChipsController"; private static final String TAG = "TvPrivacyChipsController";
private static final boolean DEBUG = false; private static final boolean DEBUG = false;
@@ -106,6 +106,7 @@ public class TvPrivacyChipsController extends CoreStartable
// How long chips stay expanded after an update. // How long chips stay expanded after an update.
private static final int EXPANDED_DURATION_MS = 4000; private static final int EXPANDED_DURATION_MS = 4000;
private final Context mContext;
private final Handler mUiThreadHandler = new Handler(Looper.getMainLooper()); private final Handler mUiThreadHandler = new Handler(Looper.getMainLooper());
private final Runnable mCollapseRunnable = this::collapseChips; private final Runnable mCollapseRunnable = this::collapseChips;
private final Runnable mUpdatePrivacyItemsRunnable = this::updateChipsAndAnnounce; private final Runnable mUpdatePrivacyItemsRunnable = this::updateChipsAndAnnounce;
@@ -130,7 +131,7 @@ public class TvPrivacyChipsController extends CoreStartable
@Inject @Inject
public TvPrivacyChipsController(Context context, PrivacyItemController privacyItemController, public TvPrivacyChipsController(Context context, PrivacyItemController privacyItemController,
IWindowManager iWindowManager) { IWindowManager iWindowManager) {
super(context); mContext = context;
if (DEBUG) Log.d(TAG, "TvPrivacyChipsController running"); if (DEBUG) Log.d(TAG, "TvPrivacyChipsController running");
mPrivacyItemController = privacyItemController; mPrivacyItemController = privacyItemController;
mIWindowManager = iWindowManager; mIWindowManager = iWindowManager;

View File

@@ -29,13 +29,14 @@ import java.io.PrintWriter;
/** /**
* A proxy to a Recents implementation. * A proxy to a Recents implementation.
*/ */
public class Recents extends CoreStartable implements CommandQueue.Callbacks { public class Recents implements CoreStartable, CommandQueue.Callbacks {
private final Context mContext;
private final RecentsImplementation mImpl; private final RecentsImplementation mImpl;
private final CommandQueue mCommandQueue; private final CommandQueue mCommandQueue;
public Recents(Context context, RecentsImplementation impl, CommandQueue commandQueue) { public Recents(Context context, RecentsImplementation impl, CommandQueue commandQueue) {
super(context); mContext = context;
mImpl = impl; mImpl = impl;
mCommandQueue = commandQueue; mCommandQueue = commandQueue;
} }

View File

@@ -42,11 +42,11 @@ import javax.inject.Inject
@SysUISingleton @SysUISingleton
class UserFileManagerImpl @Inject constructor( class UserFileManagerImpl @Inject constructor(
// Context of system process and system user. // Context of system process and system user.
val context: Context, private val context: Context,
val userManager: UserManager, val userManager: UserManager,
val broadcastDispatcher: BroadcastDispatcher, val broadcastDispatcher: BroadcastDispatcher,
@Background val backgroundExecutor: DelayableExecutor @Background val backgroundExecutor: DelayableExecutor
) : UserFileManager, CoreStartable(context) { ) : UserFileManager, CoreStartable {
companion object { companion object {
private const val FILES = "files" private const val FILES = "files"
@VisibleForTesting internal const val SHARED_PREFS = "shared_prefs" @VisibleForTesting internal const val SHARED_PREFS = "shared_prefs"

View File

@@ -32,10 +32,10 @@ import javax.inject.Inject;
* Dispatches shortcut to System UI components * Dispatches shortcut to System UI components
*/ */
@SysUISingleton @SysUISingleton
public class ShortcutKeyDispatcher extends CoreStartable public class ShortcutKeyDispatcher implements CoreStartable, ShortcutKeyServiceProxy.Callbacks {
implements ShortcutKeyServiceProxy.Callbacks {
private static final String TAG = "ShortcutKeyDispatcher"; private static final String TAG = "ShortcutKeyDispatcher";
private final Context mContext;
private ShortcutKeyServiceProxy mShortcutKeyServiceProxy = new ShortcutKeyServiceProxy(this); private ShortcutKeyServiceProxy mShortcutKeyServiceProxy = new ShortcutKeyServiceProxy(this);
private IWindowManager mWindowManagerService = WindowManagerGlobal.getWindowManagerService(); private IWindowManager mWindowManagerService = WindowManagerGlobal.getWindowManagerService();
@@ -50,7 +50,7 @@ public class ShortcutKeyDispatcher extends CoreStartable
@Inject @Inject
public ShortcutKeyDispatcher(Context context) { public ShortcutKeyDispatcher(Context context) {
super(context); mContext = context;
} }
/** /**

View File

@@ -66,11 +66,12 @@ import javax.inject.Inject;
* splitted screen. * splitted screen.
*/ */
@SysUISingleton @SysUISingleton
public class InstantAppNotifier extends CoreStartable public class InstantAppNotifier
implements CommandQueue.Callbacks, KeyguardStateController.Callback { implements CoreStartable, CommandQueue.Callbacks, KeyguardStateController.Callback {
private static final String TAG = "InstantAppNotifier"; private static final String TAG = "InstantAppNotifier";
public static final int NUM_TASKS_FOR_INSTANT_APP_INFO = 5; public static final int NUM_TASKS_FOR_INSTANT_APP_INFO = 5;
private final Context mContext;
private final Handler mHandler = new Handler(); private final Handler mHandler = new Handler();
private final Executor mUiBgExecutor; private final Executor mUiBgExecutor;
private final ArraySet<Pair<String, Integer>> mCurrentNotifs = new ArraySet<>(); private final ArraySet<Pair<String, Integer>> mCurrentNotifs = new ArraySet<>();
@@ -83,7 +84,7 @@ public class InstantAppNotifier extends CoreStartable
CommandQueue commandQueue, CommandQueue commandQueue,
@UiBackground Executor uiBgExecutor, @UiBackground Executor uiBgExecutor,
KeyguardStateController keyguardStateController) { KeyguardStateController keyguardStateController) {
super(context); mContext = context;
mCommandQueue = commandQueue; mCommandQueue = commandQueue;
mUiBgExecutor = uiBgExecutor; mUiBgExecutor = uiBgExecutor;
mKeyguardStateController = keyguardStateController; mKeyguardStateController = keyguardStateController;

View File

@@ -72,7 +72,6 @@ private interface KeyguardNotificationVisibilityProviderImplModule {
@SysUISingleton @SysUISingleton
private class KeyguardNotificationVisibilityProviderImpl @Inject constructor( private class KeyguardNotificationVisibilityProviderImpl @Inject constructor(
context: Context,
@Main private val handler: Handler, @Main private val handler: Handler,
private val keyguardStateController: KeyguardStateController, private val keyguardStateController: KeyguardStateController,
private val lockscreenUserManager: NotificationLockscreenUserManager, private val lockscreenUserManager: NotificationLockscreenUserManager,
@@ -82,7 +81,7 @@ private class KeyguardNotificationVisibilityProviderImpl @Inject constructor(
private val broadcastDispatcher: BroadcastDispatcher, private val broadcastDispatcher: BroadcastDispatcher,
private val secureSettings: SecureSettings, private val secureSettings: SecureSettings,
private val globalSettings: GlobalSettings private val globalSettings: GlobalSettings
) : CoreStartable(context), KeyguardNotificationVisibilityProvider { ) : CoreStartable, KeyguardNotificationVisibilityProvider {
private val showSilentNotifsUri = private val showSilentNotifsUri =
secureSettings.getUriFor(Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS) secureSettings.getUriFor(Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS)
private val onStateChangedListeners = ListenerSet<Consumer<String>>() private val onStateChangedListeners = ListenerSet<Consumer<String>>()

View File

@@ -268,8 +268,7 @@ import dagger.Lazy;
* </b> * </b>
*/ */
@SysUISingleton @SysUISingleton
public class CentralSurfacesImpl extends CoreStartable implements public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
CentralSurfaces {
private static final String BANNER_ACTION_CANCEL = private static final String BANNER_ACTION_CANCEL =
"com.android.systemui.statusbar.banner_action_cancel"; "com.android.systemui.statusbar.banner_action_cancel";
@@ -290,6 +289,7 @@ public class CentralSurfacesImpl extends CoreStartable implements
private static final UiEventLogger sUiEventLogger = new UiEventLoggerImpl(); private static final UiEventLogger sUiEventLogger = new UiEventLoggerImpl();
private final Context mContext;
private final LockscreenShadeTransitionController mLockscreenShadeTransitionController; private final LockscreenShadeTransitionController mLockscreenShadeTransitionController;
private CentralSurfacesCommandQueueCallbacks mCommandQueueCallbacks; private CentralSurfacesCommandQueueCallbacks mCommandQueueCallbacks;
private float mTransitionToFullShadeProgress = 0f; private float mTransitionToFullShadeProgress = 0f;
@@ -747,7 +747,7 @@ public class CentralSurfacesImpl extends CoreStartable implements
DeviceStateManager deviceStateManager, DeviceStateManager deviceStateManager,
WiredChargingRippleController wiredChargingRippleController, WiredChargingRippleController wiredChargingRippleController,
IDreamManager dreamManager) { IDreamManager dreamManager) {
super(context); mContext = context;
mNotificationsController = notificationsController; mNotificationsController = notificationsController;
mFragmentService = fragmentService; mFragmentService = fragmentService;
mLightBarController = lightBarController; mLightBarController = lightBarController;

View File

@@ -47,7 +47,7 @@ class KeyguardLiftController @Inject constructor(
private val asyncSensorManager: AsyncSensorManager, private val asyncSensorManager: AsyncSensorManager,
private val keyguardUpdateMonitor: KeyguardUpdateMonitor, private val keyguardUpdateMonitor: KeyguardUpdateMonitor,
private val dumpManager: DumpManager private val dumpManager: DumpManager
) : Dumpable, CoreStartable(context) { ) : Dumpable, CoreStartable {
private val pickupSensor = asyncSensorManager.getDefaultSensor(Sensor.TYPE_PICK_UP_GESTURE) private val pickupSensor = asyncSensorManager.getDefaultSensor(Sensor.TYPE_PICK_UP_GESTURE)
private var isListening = false private var isListening = false

View File

@@ -37,19 +37,20 @@ import dagger.Lazy;
* Serves as a collection of UI components, rather than showing its own UI. * Serves as a collection of UI components, rather than showing its own UI.
*/ */
@SysUISingleton @SysUISingleton
public class TvStatusBar extends CoreStartable implements CommandQueue.Callbacks { public class TvStatusBar implements CoreStartable, CommandQueue.Callbacks {
private static final String ACTION_SHOW_PIP_MENU = private static final String ACTION_SHOW_PIP_MENU =
"com.android.wm.shell.pip.tv.notification.action.SHOW_PIP_MENU"; "com.android.wm.shell.pip.tv.notification.action.SHOW_PIP_MENU";
private static final String SYSTEMUI_PERMISSION = "com.android.systemui.permission.SELF"; private static final String SYSTEMUI_PERMISSION = "com.android.systemui.permission.SELF";
private final Context mContext;
private final CommandQueue mCommandQueue; private final CommandQueue mCommandQueue;
private final Lazy<AssistManager> mAssistManagerLazy; private final Lazy<AssistManager> mAssistManagerLazy;
@Inject @Inject
public TvStatusBar(Context context, CommandQueue commandQueue, public TvStatusBar(Context context, CommandQueue commandQueue,
Lazy<AssistManager> assistManagerLazy) { Lazy<AssistManager> assistManagerLazy) {
super(context); mContext = context;
mCommandQueue = commandQueue; mCommandQueue = commandQueue;
mAssistManagerLazy = assistManagerLazy; mAssistManagerLazy = assistManagerLazy;
} }

View File

@@ -35,9 +35,9 @@ import javax.inject.Inject
*/ */
@SysUISingleton @SysUISingleton
class VpnStatusObserver @Inject constructor( class VpnStatusObserver @Inject constructor(
context: Context, private val context: Context,
private val securityController: SecurityController private val securityController: SecurityController
) : CoreStartable(context), ) : CoreStartable,
SecurityController.SecurityControllerCallback { SecurityController.SecurityControllerCallback {
private var vpnConnected = false private var vpnConnected = false
@@ -102,7 +102,7 @@ class VpnStatusObserver @Inject constructor(
.apply { .apply {
vpnName?.let { vpnName?.let {
setContentText( setContentText(
mContext.getString( context.getString(
R.string.notification_disclosure_vpn_text, it R.string.notification_disclosure_vpn_text, it
) )
) )
@@ -111,23 +111,23 @@ class VpnStatusObserver @Inject constructor(
.build() .build()
private fun createVpnConnectedNotificationBuilder() = private fun createVpnConnectedNotificationBuilder() =
Notification.Builder(mContext, NOTIFICATION_CHANNEL_TV_VPN) Notification.Builder(context, NOTIFICATION_CHANNEL_TV_VPN)
.setSmallIcon(vpnIconId) .setSmallIcon(vpnIconId)
.setVisibility(Notification.VISIBILITY_PUBLIC) .setVisibility(Notification.VISIBILITY_PUBLIC)
.setCategory(Notification.CATEGORY_SYSTEM) .setCategory(Notification.CATEGORY_SYSTEM)
.extend(Notification.TvExtender()) .extend(Notification.TvExtender())
.setOngoing(true) .setOngoing(true)
.setContentTitle(mContext.getString(R.string.notification_vpn_connected)) .setContentTitle(context.getString(R.string.notification_vpn_connected))
.setContentIntent(VpnConfig.getIntentForStatusPanel(mContext)) .setContentIntent(VpnConfig.getIntentForStatusPanel(context))
private fun createVpnDisconnectedNotification() = private fun createVpnDisconnectedNotification() =
Notification.Builder(mContext, NOTIFICATION_CHANNEL_TV_VPN) Notification.Builder(context, NOTIFICATION_CHANNEL_TV_VPN)
.setSmallIcon(vpnIconId) .setSmallIcon(vpnIconId)
.setVisibility(Notification.VISIBILITY_PUBLIC) .setVisibility(Notification.VISIBILITY_PUBLIC)
.setCategory(Notification.CATEGORY_SYSTEM) .setCategory(Notification.CATEGORY_SYSTEM)
.extend(Notification.TvExtender()) .extend(Notification.TvExtender())
.setTimeoutAfter(VPN_DISCONNECTED_NOTIFICATION_TIMEOUT_MS) .setTimeoutAfter(VPN_DISCONNECTED_NOTIFICATION_TIMEOUT_MS)
.setContentTitle(mContext.getString(R.string.notification_vpn_disconnected)) .setContentTitle(context.getString(R.string.notification_vpn_disconnected))
.build() .build()
companion object { companion object {

View File

@@ -18,13 +18,13 @@ package com.android.systemui.statusbar.tv.notifications;
import android.annotation.Nullable; import android.annotation.Nullable;
import android.app.Notification; import android.app.Notification;
import android.content.Context;
import android.service.notification.NotificationListenerService; import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification; import android.service.notification.StatusBarNotification;
import android.util.Log; import android.util.Log;
import android.util.SparseArray; import android.util.SparseArray;
import com.android.systemui.CoreStartable; import com.android.systemui.CoreStartable;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.statusbar.NotificationListener; import com.android.systemui.statusbar.NotificationListener;
import javax.inject.Inject; import javax.inject.Inject;
@@ -32,7 +32,8 @@ import javax.inject.Inject;
/** /**
* Keeps track of the notifications on TV. * Keeps track of the notifications on TV.
*/ */
public class TvNotificationHandler extends CoreStartable implements @SysUISingleton
public class TvNotificationHandler implements CoreStartable,
NotificationListener.NotificationHandler { NotificationListener.NotificationHandler {
private static final String TAG = "TvNotificationHandler"; private static final String TAG = "TvNotificationHandler";
private final NotificationListener mNotificationListener; private final NotificationListener mNotificationListener;
@@ -41,8 +42,7 @@ public class TvNotificationHandler extends CoreStartable implements
private Listener mUpdateListener; private Listener mUpdateListener;
@Inject @Inject
public TvNotificationHandler(Context context, NotificationListener notificationListener) { public TvNotificationHandler(NotificationListener notificationListener) {
super(context);
mNotificationListener = notificationListener; mNotificationListener = notificationListener;
} }

View File

@@ -35,14 +35,15 @@ import javax.inject.Inject;
* Offers control methods for the notification panel handler on TV devices. * Offers control methods for the notification panel handler on TV devices.
*/ */
@SysUISingleton @SysUISingleton
public class TvNotificationPanel extends CoreStartable implements CommandQueue.Callbacks { public class TvNotificationPanel implements CoreStartable, CommandQueue.Callbacks {
private static final String TAG = "TvNotificationPanel"; private static final String TAG = "TvNotificationPanel";
private final Context mContext;
private final CommandQueue mCommandQueue; private final CommandQueue mCommandQueue;
private final String mNotificationHandlerPackage; private final String mNotificationHandlerPackage;
@Inject @Inject
public TvNotificationPanel(Context context, CommandQueue commandQueue) { public TvNotificationPanel(Context context, CommandQueue commandQueue) {
super(context); mContext = context;
mCommandQueue = commandQueue; mCommandQueue = commandQueue;
mNotificationHandlerPackage = mContext.getResources().getString( mNotificationHandlerPackage = mContext.getResources().getString(
com.android.internal.R.string.config_notificationHandlerPackage); com.android.internal.R.string.config_notificationHandlerPackage);

View File

@@ -62,7 +62,7 @@ abstract class TemporaryViewDisplayController<T : TemporaryViewInfo, U : Tempora
@LayoutRes private val viewLayoutRes: Int, @LayoutRes private val viewLayoutRes: Int,
private val windowTitle: String, private val windowTitle: String,
private val wakeReason: String, private val wakeReason: String,
) : CoreStartable(context) { ) : CoreStartable {
/** /**
* Window layout params that will be used as a starting point for the [windowLayoutParams] of * Window layout params that will be used as a starting point for the [windowLayoutParams] of
* all subclasses. * all subclasses.

View File

@@ -100,7 +100,7 @@ import javax.inject.Inject;
* associated work profiles * associated work profiles
*/ */
@SysUISingleton @SysUISingleton
public class ThemeOverlayController extends CoreStartable implements Dumpable { public class ThemeOverlayController implements CoreStartable, Dumpable {
protected static final String TAG = "ThemeOverlayController"; protected static final String TAG = "ThemeOverlayController";
private static final boolean DEBUG = true; private static final boolean DEBUG = true;
@@ -114,6 +114,7 @@ public class ThemeOverlayController extends CoreStartable implements Dumpable {
private final SecureSettings mSecureSettings; private final SecureSettings mSecureSettings;
private final Executor mMainExecutor; private final Executor mMainExecutor;
private final Handler mBgHandler; private final Handler mBgHandler;
private final Context mContext;
private final boolean mIsMonetEnabled; private final boolean mIsMonetEnabled;
private final UserTracker mUserTracker; private final UserTracker mUserTracker;
private final DeviceProvisionedController mDeviceProvisionedController; private final DeviceProvisionedController mDeviceProvisionedController;
@@ -361,8 +362,7 @@ public class ThemeOverlayController extends CoreStartable implements Dumpable {
UserManager userManager, DeviceProvisionedController deviceProvisionedController, UserManager userManager, DeviceProvisionedController deviceProvisionedController,
UserTracker userTracker, DumpManager dumpManager, FeatureFlags featureFlags, UserTracker userTracker, DumpManager dumpManager, FeatureFlags featureFlags,
@Main Resources resources, WakefulnessLifecycle wakefulnessLifecycle) { @Main Resources resources, WakefulnessLifecycle wakefulnessLifecycle) {
super(context); mContext = context;
mIsMonetEnabled = featureFlags.isEnabled(Flags.MONET); mIsMonetEnabled = featureFlags.isEnabled(Flags.MONET);
mDeviceProvisionedController = deviceProvisionedController; mDeviceProvisionedController = deviceProvisionedController;
mBroadcastDispatcher = broadcastDispatcher; mBroadcastDispatcher = broadcastDispatcher;

View File

@@ -50,13 +50,14 @@ import javax.inject.Inject;
* Controls display of text toasts. * Controls display of text toasts.
*/ */
@SysUISingleton @SysUISingleton
public class ToastUI extends CoreStartable implements CommandQueue.Callbacks { public class ToastUI implements CoreStartable, CommandQueue.Callbacks {
// values from NotificationManagerService#LONG_DELAY and NotificationManagerService#SHORT_DELAY // values from NotificationManagerService#LONG_DELAY and NotificationManagerService#SHORT_DELAY
private static final int TOAST_LONG_TIME = 3500; // 3.5 seconds private static final int TOAST_LONG_TIME = 3500; // 3.5 seconds
private static final int TOAST_SHORT_TIME = 2000; // 2 seconds private static final int TOAST_SHORT_TIME = 2000; // 2 seconds
private static final String TAG = "ToastUI"; private static final String TAG = "ToastUI";
private final Context mContext;
private final CommandQueue mCommandQueue; private final CommandQueue mCommandQueue;
private final INotificationManager mNotificationManager; private final INotificationManager mNotificationManager;
private final IAccessibilityManager mIAccessibilityManager; private final IAccessibilityManager mIAccessibilityManager;
@@ -90,7 +91,7 @@ public class ToastUI extends CoreStartable implements CommandQueue.Callbacks {
@Nullable IAccessibilityManager accessibilityManager, @Nullable IAccessibilityManager accessibilityManager,
ToastFactory toastFactory, ToastLogger toastLogger ToastFactory toastFactory, ToastLogger toastLogger
) { ) {
super(context); mContext = context;
mCommandQueue = commandQueue; mCommandQueue = commandQueue;
mNotificationManager = notificationManager; mNotificationManager = notificationManager;
mIAccessibilityManager = accessibilityManager; mIAccessibilityManager = accessibilityManager;
@@ -179,7 +180,7 @@ public class ToastUI extends CoreStartable implements CommandQueue.Callbacks {
} }
@Override @Override
protected void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {
if (newConfig.orientation != mOrientation) { if (newConfig.orientation != mOrientation) {
mOrientation = newConfig.orientation; mOrientation = newConfig.orientation;
if (mToast != null) { if (mToast != null) {

View File

@@ -203,9 +203,9 @@ public abstract class TvSystemUIModule {
@Provides @Provides
@SysUISingleton @SysUISingleton
static TvNotificationHandler provideTvNotificationHandler(Context context, static TvNotificationHandler provideTvNotificationHandler(
NotificationListener notificationListener) { NotificationListener notificationListener) {
return new TvNotificationHandler(context, notificationListener); return new TvNotificationHandler(notificationListener);
} }
/** /**

View File

@@ -21,7 +21,6 @@ import android.app.Notification;
import android.app.Notification.Action; import android.app.Notification.Action;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.app.ActivityManager;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@@ -56,11 +55,12 @@ import javax.inject.Inject;
/** */ /** */
@SysUISingleton @SysUISingleton
public class StorageNotification extends CoreStartable { public class StorageNotification implements CoreStartable {
private static final String TAG = "StorageNotification"; private static final String TAG = "StorageNotification";
private static final String ACTION_SNOOZE_VOLUME = "com.android.systemui.action.SNOOZE_VOLUME"; private static final String ACTION_SNOOZE_VOLUME = "com.android.systemui.action.SNOOZE_VOLUME";
private static final String ACTION_FINISH_WIZARD = "com.android.systemui.action.FINISH_WIZARD"; private static final String ACTION_FINISH_WIZARD = "com.android.systemui.action.FINISH_WIZARD";
private final Context mContext;
// TODO: delay some notifications to avoid bumpy fast operations // TODO: delay some notifications to avoid bumpy fast operations
@@ -69,7 +69,7 @@ public class StorageNotification extends CoreStartable {
@Inject @Inject
public StorageNotification(Context context) { public StorageNotification(Context context) {
super(context); mContext = context;
} }
private static class MoveInfo { private static class MoveInfo {

View File

@@ -48,7 +48,7 @@ constructor(
private val dialogLaunchAnimator: DialogLaunchAnimator, private val dialogLaunchAnimator: DialogLaunchAnimator,
private val interactor: UserInteractor, private val interactor: UserInteractor,
private val featureFlags: FeatureFlags, private val featureFlags: FeatureFlags,
) : CoreStartable(context) { ) : CoreStartable {
private var currentDialog: Dialog? = null private var currentDialog: Dialog? = null

View File

@@ -32,7 +32,8 @@ import java.util.Arrays;
import javax.inject.Inject; import javax.inject.Inject;
// NOT Singleton. Started per-user. // NOT Singleton. Started per-user.
public class NotificationChannels extends CoreStartable { /** */
public class NotificationChannels implements CoreStartable {
public static String ALERTS = "ALR"; public static String ALERTS = "ALR";
public static String SCREENSHOTS_HEADSUP = "SCN_HEADSUP"; public static String SCREENSHOTS_HEADSUP = "SCN_HEADSUP";
// Deprecated. Please use or create a more specific channel that users will better understand // Deprecated. Please use or create a more specific channel that users will better understand
@@ -45,9 +46,11 @@ public class NotificationChannels extends CoreStartable {
public static String INSTANT = "INS"; public static String INSTANT = "INS";
public static String SETUP = "STP"; public static String SETUP = "STP";
private final Context mContext;
@Inject @Inject
public NotificationChannels(Context context) { public NotificationChannels(Context context) {
super(context); mContext = context;
} }
public static void createAll(Context context) { public static void createAll(Context context) {

View File

@@ -564,12 +564,13 @@ public class GarbageMonitor implements Dumpable {
/** */ /** */
@SysUISingleton @SysUISingleton
public static class Service extends CoreStartable implements Dumpable { public static class Service implements CoreStartable, Dumpable {
private final Context mContext;
private final GarbageMonitor mGarbageMonitor; private final GarbageMonitor mGarbageMonitor;
@Inject @Inject
public Service(Context context, GarbageMonitor garbageMonitor) { public Service(Context context, GarbageMonitor garbageMonitor) {
super(context); mContext = context;
mGarbageMonitor = garbageMonitor; mGarbageMonitor = garbageMonitor;
} }

View File

@@ -31,18 +31,19 @@ import java.io.PrintWriter;
import javax.inject.Inject; import javax.inject.Inject;
@SysUISingleton @SysUISingleton
public class VolumeUI extends CoreStartable { public class VolumeUI implements CoreStartable {
private static final String TAG = "VolumeUI"; private static final String TAG = "VolumeUI";
private static boolean LOGD = Log.isLoggable(TAG, Log.DEBUG); private static boolean LOGD = Log.isLoggable(TAG, Log.DEBUG);
private final Handler mHandler = new Handler(); private final Handler mHandler = new Handler();
private boolean mEnabled; private boolean mEnabled;
private final Context mContext;
private VolumeDialogComponent mVolumeComponent; private VolumeDialogComponent mVolumeComponent;
@Inject @Inject
public VolumeUI(Context context, VolumeDialogComponent volumeDialogComponent) { public VolumeUI(Context context, VolumeDialogComponent volumeDialogComponent) {
super(context); mContext = context;
mVolumeComponent = volumeDialogComponent; mVolumeComponent = volumeDialogComponent;
} }
@@ -59,8 +60,7 @@ public class VolumeUI extends CoreStartable {
} }
@Override @Override
protected void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (!mEnabled) return; if (!mEnabled) return;
mVolumeComponent.onConfigurationChanged(newConfig); mVolumeComponent.onConfigurationChanged(newConfig);
} }

View File

@@ -89,8 +89,10 @@ import javax.inject.Inject;
* -> WMShell starts and binds SysUI with Shell components via exported Shell interfaces * -> WMShell starts and binds SysUI with Shell components via exported Shell interfaces
*/ */
@SysUISingleton @SysUISingleton
public final class WMShell extends CoreStartable public final class WMShell implements
implements CommandQueue.Callbacks, ProtoTraceable<SystemUiTraceProto> { CoreStartable,
CommandQueue.Callbacks,
ProtoTraceable<SystemUiTraceProto> {
private static final String TAG = WMShell.class.getName(); private static final String TAG = WMShell.class.getName();
private static final int INVALID_SYSUI_STATE_MASK = private static final int INVALID_SYSUI_STATE_MASK =
SYSUI_STATE_DIALOG_SHOWING SYSUI_STATE_DIALOG_SHOWING
@@ -102,6 +104,7 @@ public final class WMShell extends CoreStartable
| SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED | SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED
| SYSUI_STATE_QUICK_SETTINGS_EXPANDED; | SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
private final Context mContext;
// Shell interfaces // Shell interfaces
private final ShellInterface mShell; private final ShellInterface mShell;
private final Optional<Pip> mPipOptional; private final Optional<Pip> mPipOptional;
@@ -163,7 +166,8 @@ public final class WMShell extends CoreStartable
private WakefulnessLifecycle.Observer mWakefulnessObserver; private WakefulnessLifecycle.Observer mWakefulnessObserver;
@Inject @Inject
public WMShell(Context context, public WMShell(
Context context,
ShellInterface shell, ShellInterface shell,
Optional<Pip> pipOptional, Optional<Pip> pipOptional,
Optional<SplitScreen> splitScreenOptional, Optional<SplitScreen> splitScreenOptional,
@@ -179,7 +183,7 @@ public final class WMShell extends CoreStartable
WakefulnessLifecycle wakefulnessLifecycle, WakefulnessLifecycle wakefulnessLifecycle,
UserTracker userTracker, UserTracker userTracker,
@Main Executor sysUiMainExecutor) { @Main Executor sysUiMainExecutor) {
super(context); mContext = context;
mShell = shell; mShell = shell;
mCommandQueue = commandQueue; mCommandQueue = commandQueue;
mConfigurationController = configurationController; mConfigurationController = configurationController;

View File

@@ -17,7 +17,6 @@
package com.android.keyguard package com.android.keyguard
import android.hardware.biometrics.BiometricSourceType import android.hardware.biometrics.BiometricSourceType
import org.mockito.Mockito.verify
import android.testing.AndroidTestingRunner import android.testing.AndroidTestingRunner
import androidx.test.filters.SmallTest import androidx.test.filters.SmallTest
import com.android.internal.logging.InstanceId import com.android.internal.logging.InstanceId
@@ -30,9 +29,10 @@ import org.junit.Before
import org.junit.Test import org.junit.Test
import org.junit.runner.RunWith import org.junit.runner.RunWith
import org.mockito.ArgumentCaptor import org.mockito.ArgumentCaptor
import org.mockito.Captor
import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.anyInt
import org.mockito.Captor
import org.mockito.Mock import org.mockito.Mock
import org.mockito.Mockito.verify
import org.mockito.Mockito.verifyNoMoreInteractions import org.mockito.Mockito.verifyNoMoreInteractions
import org.mockito.Mockito.`when` as whenever import org.mockito.Mockito.`when` as whenever
import org.mockito.MockitoAnnotations import org.mockito.MockitoAnnotations
@@ -63,7 +63,6 @@ class KeyguardBiometricLockoutLoggerTest : SysuiTestCase() {
whenever(keyguardUpdateMonitor.strongAuthTracker).thenReturn(strongAuthTracker) whenever(keyguardUpdateMonitor.strongAuthTracker).thenReturn(strongAuthTracker)
whenever(sessionTracker.getSessionId(anyInt())).thenReturn(sessionId) whenever(sessionTracker.getSessionId(anyInt())).thenReturn(sessionId)
keyguardBiometricLockoutLogger = KeyguardBiometricLockoutLogger( keyguardBiometricLockoutLogger = KeyguardBiometricLockoutLogger(
mContext,
uiEventLogger, uiEventLogger,
keyguardUpdateMonitor, keyguardUpdateMonitor,
sessionTracker) sessionTracker)

View File

@@ -231,7 +231,7 @@ public class ScreenDecorationsTest extends SysuiTestCase {
} }
@Override @Override
protected void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
mExecutor.runAllReady(); mExecutor.runAllReady();
} }

View File

@@ -71,7 +71,7 @@ public class ComplicationTypesUpdaterTest extends SysuiTestCase {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
when(mDreamBackend.getEnabledComplications()).thenReturn(new HashSet<>()); when(mDreamBackend.getEnabledComplications()).thenReturn(new HashSet<>());
mController = new ComplicationTypesUpdater(mContext, mDreamBackend, mExecutor, mController = new ComplicationTypesUpdater(mDreamBackend, mExecutor,
mSecureSettings, mDreamOverlayStateController); mSecureSettings, mDreamOverlayStateController);
} }

View File

@@ -82,7 +82,6 @@ public class DreamClockTimeComplicationTest extends SysuiTestCase {
public void testComplicationAdded() { public void testComplicationAdded() {
final DreamClockTimeComplication.Registrant registrant = final DreamClockTimeComplication.Registrant registrant =
new DreamClockTimeComplication.Registrant( new DreamClockTimeComplication.Registrant(
mContext,
mDreamOverlayStateController, mDreamOverlayStateController,
mComplication); mComplication);
registrant.start(); registrant.start();

View File

@@ -115,7 +115,7 @@ public class DreamHomeControlsComplicationTest extends SysuiTestCase {
@Test @Test
public void complicationAvailability_serviceNotAvailable_noFavorites_doNotAddComplication() { public void complicationAvailability_serviceNotAvailable_noFavorites_doNotAddComplication() {
final DreamHomeControlsComplication.Registrant registrant = final DreamHomeControlsComplication.Registrant registrant =
new DreamHomeControlsComplication.Registrant(mContext, mComplication, new DreamHomeControlsComplication.Registrant(mComplication,
mDreamOverlayStateController, mControlsComponent); mDreamOverlayStateController, mControlsComponent);
registrant.start(); registrant.start();
@@ -128,7 +128,7 @@ public class DreamHomeControlsComplicationTest extends SysuiTestCase {
@Test @Test
public void complicationAvailability_serviceAvailable_noFavorites_doNotAddComplication() { public void complicationAvailability_serviceAvailable_noFavorites_doNotAddComplication() {
final DreamHomeControlsComplication.Registrant registrant = final DreamHomeControlsComplication.Registrant registrant =
new DreamHomeControlsComplication.Registrant(mContext, mComplication, new DreamHomeControlsComplication.Registrant(mComplication,
mDreamOverlayStateController, mControlsComponent); mDreamOverlayStateController, mControlsComponent);
registrant.start(); registrant.start();
@@ -141,7 +141,7 @@ public class DreamHomeControlsComplicationTest extends SysuiTestCase {
@Test @Test
public void complicationAvailability_serviceNotAvailable_haveFavorites_doNotAddComplication() { public void complicationAvailability_serviceNotAvailable_haveFavorites_doNotAddComplication() {
final DreamHomeControlsComplication.Registrant registrant = final DreamHomeControlsComplication.Registrant registrant =
new DreamHomeControlsComplication.Registrant(mContext, mComplication, new DreamHomeControlsComplication.Registrant(mComplication,
mDreamOverlayStateController, mControlsComponent); mDreamOverlayStateController, mControlsComponent);
registrant.start(); registrant.start();
@@ -154,7 +154,7 @@ public class DreamHomeControlsComplicationTest extends SysuiTestCase {
@Test @Test
public void complicationAvailability_serviceAvailable_haveFavorites_addComplication() { public void complicationAvailability_serviceAvailable_haveFavorites_addComplication() {
final DreamHomeControlsComplication.Registrant registrant = final DreamHomeControlsComplication.Registrant registrant =
new DreamHomeControlsComplication.Registrant(mContext, mComplication, new DreamHomeControlsComplication.Registrant(mComplication,
mDreamOverlayStateController, mControlsComponent); mDreamOverlayStateController, mControlsComponent);
registrant.start(); registrant.start();

View File

@@ -24,7 +24,6 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import android.app.smartspace.SmartspaceTarget; import android.app.smartspace.SmartspaceTarget;
import android.content.Context;
import android.testing.AndroidTestingRunner; import android.testing.AndroidTestingRunner;
import android.view.View; import android.view.View;
@@ -48,8 +47,6 @@ import java.util.Collections;
@SmallTest @SmallTest
@RunWith(AndroidTestingRunner.class) @RunWith(AndroidTestingRunner.class)
public class SmartSpaceComplicationTest extends SysuiTestCase { public class SmartSpaceComplicationTest extends SysuiTestCase {
@Mock
private Context mContext;
@Mock @Mock
private DreamSmartspaceController mSmartspaceController; private DreamSmartspaceController mSmartspaceController;
@@ -80,7 +77,6 @@ public class SmartSpaceComplicationTest extends SysuiTestCase {
private SmartSpaceComplication.Registrant getRegistrant() { private SmartSpaceComplication.Registrant getRegistrant() {
return new SmartSpaceComplication.Registrant( return new SmartSpaceComplication.Registrant(
mContext,
mDreamOverlayStateController, mDreamOverlayStateController,
mComplication, mComplication,
mSmartspaceController); mSmartspaceController);

View File

@@ -82,7 +82,6 @@ public class SessionTrackerTest extends SysuiTestCase {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
mSessionTracker = new SessionTracker( mSessionTracker = new SessionTracker(
mContext,
mStatusBarService, mStatusBarService,
mAuthController, mAuthController,
mKeyguardUpdateMonitor, mKeyguardUpdateMonitor,

View File

@@ -73,7 +73,7 @@ public class MediaDreamSentinelTest extends SysuiTestCase {
@Test @Test
public void testOnMediaDataLoaded_complicationAddition() { public void testOnMediaDataLoaded_complicationAddition() {
final MediaDreamSentinel sentinel = new MediaDreamSentinel(mContext, mMediaDataManager, final MediaDreamSentinel sentinel = new MediaDreamSentinel(mMediaDataManager,
mDreamOverlayStateController, mMediaEntryComplication, mFeatureFlags); mDreamOverlayStateController, mMediaEntryComplication, mFeatureFlags);
sentinel.start(); sentinel.start();
@@ -94,7 +94,7 @@ public class MediaDreamSentinelTest extends SysuiTestCase {
@Test @Test
public void testOnMediaDataRemoved_complicationRemoval() { public void testOnMediaDataRemoved_complicationRemoval() {
final MediaDreamSentinel sentinel = new MediaDreamSentinel(mContext, mMediaDataManager, final MediaDreamSentinel sentinel = new MediaDreamSentinel(mMediaDataManager,
mDreamOverlayStateController, mMediaEntryComplication, mFeatureFlags); mDreamOverlayStateController, mMediaEntryComplication, mFeatureFlags);
sentinel.start(); sentinel.start();
@@ -114,7 +114,7 @@ public class MediaDreamSentinelTest extends SysuiTestCase {
@Test @Test
public void testOnMediaDataLoaded_complicationRemoval() { public void testOnMediaDataLoaded_complicationRemoval() {
final MediaDreamSentinel sentinel = new MediaDreamSentinel(mContext, mMediaDataManager, final MediaDreamSentinel sentinel = new MediaDreamSentinel(mMediaDataManager,
mDreamOverlayStateController, mMediaEntryComplication, mFeatureFlags); mDreamOverlayStateController, mMediaEntryComplication, mFeatureFlags);
sentinel.start(); sentinel.start();
@@ -139,7 +139,7 @@ public class MediaDreamSentinelTest extends SysuiTestCase {
public void testOnMediaDataLoaded_mediaComplicationDisabled_doesNotAddComplication() { public void testOnMediaDataLoaded_mediaComplicationDisabled_doesNotAddComplication() {
when(mFeatureFlags.isEnabled(DREAM_MEDIA_COMPLICATION)).thenReturn(false); when(mFeatureFlags.isEnabled(DREAM_MEDIA_COMPLICATION)).thenReturn(false);
final MediaDreamSentinel sentinel = new MediaDreamSentinel(mContext, mMediaDataManager, final MediaDreamSentinel sentinel = new MediaDreamSentinel(mMediaDataManager,
mDreamOverlayStateController, mMediaEntryComplication, mFeatureFlags); mDreamOverlayStateController, mMediaEntryComplication, mFeatureFlags);
sentinel.start(); sentinel.start();