Merge changes from topic "b205725937-core-startable"
* changes: Remove config_additionalSystemUIServiceComponents Remove config_systemUIServiceComponents from SystemUI.
This commit is contained in:
@@ -24,29 +24,6 @@
|
||||
<string name="config_systemUIFactoryComponent" translatable="false">
|
||||
com.android.systemui.tv.TvSystemUIFactory
|
||||
</string>
|
||||
<!-- SystemUI Services: The classes of the stuff to start. -->
|
||||
<string-array name="config_systemUIServiceComponents" translatable="false">
|
||||
<item>com.android.systemui.util.NotificationChannels</item>
|
||||
<item>com.android.systemui.volume.VolumeUI</item>
|
||||
<item>com.android.systemui.privacy.television.TvOngoingPrivacyChip</item>
|
||||
<item>com.android.systemui.statusbar.tv.TvStatusBar</item>
|
||||
<item>com.android.systemui.statusbar.tv.notifications.TvNotificationPanel</item>
|
||||
<item>com.android.systemui.statusbar.tv.notifications.TvNotificationHandler</item>
|
||||
<item>com.android.systemui.statusbar.tv.VpnStatusObserver</item>
|
||||
<item>com.android.systemui.globalactions.GlobalActionsComponent</item>
|
||||
<item>com.android.systemui.usb.StorageNotification</item>
|
||||
<item>com.android.systemui.power.PowerUI</item>
|
||||
<item>com.android.systemui.media.RingtonePlayer</item>
|
||||
<item>com.android.systemui.keyboard.KeyboardUI</item>
|
||||
<item>com.android.systemui.shortcut.ShortcutKeyDispatcher</item>
|
||||
<item>@string/config_systemUIVendorServiceComponent</item>
|
||||
<item>com.android.systemui.SliceBroadcastRelayHandler</item>
|
||||
<item>com.android.systemui.statusbar.notification.InstantAppNotifier</item>
|
||||
<item>com.android.systemui.accessibility.WindowMagnification</item>
|
||||
<item>com.android.systemui.toast.ToastUI</item>
|
||||
<item>com.android.systemui.wmshell.WMShell</item>
|
||||
<item>com.android.systemui.media.systemsounds.HomeSoundEffectController</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Svelte specific logic, see RecentsConfiguration.SVELTE_* constants. -->
|
||||
<integer name="recents_svelte_level">3</integer>
|
||||
|
||||
@@ -292,43 +292,6 @@
|
||||
<!-- SystemUIFactory component -->
|
||||
<string name="config_systemUIFactoryComponent" translatable="false">com.android.systemui.SystemUIFactory</string>
|
||||
|
||||
<!-- SystemUI Services: The classes of base stuff to start by default for all
|
||||
configurations. -->
|
||||
<string-array name="config_systemUIServiceComponents" translatable="false">
|
||||
<item>com.android.systemui.util.NotificationChannels</item>
|
||||
<item>com.android.systemui.keyguard.KeyguardViewMediator</item>
|
||||
<item>com.android.keyguard.KeyguardBiometricLockoutLogger</item>
|
||||
<item>com.android.systemui.recents.Recents</item>
|
||||
<item>com.android.systemui.volume.VolumeUI</item>
|
||||
<item>com.android.systemui.statusbar.phone.StatusBar</item>
|
||||
<item>com.android.systemui.usb.StorageNotification</item>
|
||||
<item>com.android.systemui.power.PowerUI</item>
|
||||
<item>com.android.systemui.media.RingtonePlayer</item>
|
||||
<item>com.android.systemui.keyboard.KeyboardUI</item>
|
||||
<item>com.android.systemui.shortcut.ShortcutKeyDispatcher</item>
|
||||
<item>@string/config_systemUIVendorServiceComponent</item>
|
||||
<item>com.android.systemui.util.leak.GarbageMonitor$Service</item>
|
||||
<item>com.android.systemui.LatencyTester</item>
|
||||
<item>com.android.systemui.globalactions.GlobalActionsComponent</item>
|
||||
<item>com.android.systemui.ScreenDecorations</item>
|
||||
<item>com.android.systemui.biometrics.AuthController</item>
|
||||
<item>com.android.systemui.log.SessionTracker</item>
|
||||
<item>com.android.systemui.SliceBroadcastRelayHandler</item>
|
||||
<item>com.android.systemui.statusbar.notification.InstantAppNotifier</item>
|
||||
<item>com.android.systemui.theme.ThemeOverlayController</item>
|
||||
<item>com.android.systemui.accessibility.WindowMagnification</item>
|
||||
<item>com.android.systemui.accessibility.SystemActions</item>
|
||||
<item>com.android.systemui.toast.ToastUI</item>
|
||||
<item>com.android.systemui.wmshell.WMShell</item>
|
||||
<item>com.android.systemui.clipboardoverlay.ClipboardListener</item>
|
||||
</string-array>
|
||||
|
||||
<!-- SystemUI Services: The classes of the additional stuff to start. Services here are
|
||||
specified as an overlay to provide configuration-specific services that
|
||||
supplement those listed in config_systemUIServiceComponents. -->
|
||||
<string-array name="config_additionalSystemUIServiceComponents" translatable="false">
|
||||
</string-array>
|
||||
|
||||
<!-- QS tile shape store width. negative implies fill configuration instead of stroke-->
|
||||
<dimen name="config_qsTileStrokeWidthActive">-1dp</dimen>
|
||||
<dimen name="config_qsTileStrokeWidthInactive">-1dp</dimen>
|
||||
|
||||
@@ -49,8 +49,11 @@ import com.android.systemui.util.NotificationChannels;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import javax.inject.Provider;
|
||||
|
||||
/**
|
||||
* Application class for SystemUI.
|
||||
@@ -181,17 +184,16 @@ public class SystemUIApplication extends Application implements
|
||||
*/
|
||||
|
||||
public void startServicesIfNeeded() {
|
||||
final String[] names = SystemUIFactory.getInstance()
|
||||
.getSystemUIServiceComponents(getResources());
|
||||
final String[] additionalNames = SystemUIFactory.getInstance()
|
||||
.getAdditionalSystemUIServiceComponents(getResources());
|
||||
final String vendorComponent = SystemUIFactory.getInstance()
|
||||
.getVendorComponent(getResources());
|
||||
|
||||
final ArrayList<String> serviceComponents = new ArrayList<>();
|
||||
Collections.addAll(serviceComponents, names);
|
||||
Collections.addAll(serviceComponents, additionalNames);
|
||||
|
||||
startServicesIfNeeded(/* metricsPrefix= */ "StartServices",
|
||||
serviceComponents.toArray(new String[serviceComponents.size()]));
|
||||
// Sort the startables so that we get a deterministic ordering.
|
||||
// TODO: make #start idempotent and require users of CoreStartable to call it.
|
||||
Map<Class<?>, Provider<CoreStartable>> sortedStartables = new TreeMap<>(
|
||||
Comparator.comparing(Class::getName));
|
||||
sortedStartables.putAll(SystemUIFactory.getInstance().getStartableComponents());
|
||||
startServicesIfNeeded(
|
||||
sortedStartables, "StartServices", vendorComponent);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -201,16 +203,22 @@ public class SystemUIApplication extends Application implements
|
||||
* <p>This method must only be called from the main thread.</p>
|
||||
*/
|
||||
void startSecondaryUserServicesIfNeeded() {
|
||||
String[] names = SystemUIFactory.getInstance().getSystemUIServiceComponentsPerUser(
|
||||
getResources());
|
||||
startServicesIfNeeded(/* metricsPrefix= */ "StartSecondaryServices", names);
|
||||
// Sort the startables so that we get a deterministic ordering.
|
||||
Map<Class<?>, Provider<CoreStartable>> sortedStartables = new TreeMap<>(
|
||||
Comparator.comparing(Class::getName));
|
||||
sortedStartables.putAll(SystemUIFactory.getInstance().getStartableComponentsPerUser());
|
||||
startServicesIfNeeded(
|
||||
sortedStartables, "StartSecondaryServices", null);
|
||||
}
|
||||
|
||||
private void startServicesIfNeeded(String metricsPrefix, String[] services) {
|
||||
private void startServicesIfNeeded(
|
||||
Map<Class<?>, Provider<CoreStartable>> startables,
|
||||
String metricsPrefix,
|
||||
String vendorComponent) {
|
||||
if (mServicesStarted) {
|
||||
return;
|
||||
}
|
||||
mServices = new CoreStartable[services.length];
|
||||
mServices = new CoreStartable[startables.size() + (vendorComponent == null ? 0 : 1)];
|
||||
|
||||
if (!mBootCompleteCache.isBootComplete()) {
|
||||
// check to see if maybe it was already completed long before we began
|
||||
@@ -230,36 +238,29 @@ public class SystemUIApplication extends Application implements
|
||||
TimingsTraceLog log = new TimingsTraceLog("SystemUIBootTiming",
|
||||
Trace.TRACE_TAG_APP);
|
||||
log.traceBegin(metricsPrefix);
|
||||
final int N = services.length;
|
||||
for (int i = 0; i < N; i++) {
|
||||
String clsName = services[i];
|
||||
if (DEBUG) Log.d(TAG, "loading: " + clsName);
|
||||
log.traceBegin(metricsPrefix + clsName);
|
||||
long ti = System.currentTimeMillis();
|
||||
try {
|
||||
CoreStartable obj = mComponentHelper.resolveCoreStartable(clsName);
|
||||
if (obj == null) {
|
||||
Constructor constructor = Class.forName(clsName).getConstructor(Context.class);
|
||||
obj = (CoreStartable) constructor.newInstance(this);
|
||||
}
|
||||
mServices[i] = obj;
|
||||
} catch (ClassNotFoundException
|
||||
| NoSuchMethodException
|
||||
| IllegalAccessException
|
||||
| InstantiationException
|
||||
| InvocationTargetException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
|
||||
if (DEBUG) Log.d(TAG, "running: " + mServices[i]);
|
||||
mServices[i].start();
|
||||
log.traceEnd();
|
||||
int i = 0;
|
||||
for (Map.Entry<Class<?>, Provider<CoreStartable>> entry : startables.entrySet()) {
|
||||
String clsName = entry.getKey().getName();
|
||||
int j = i; // Copied to make lambda happy.
|
||||
timeInitialization(
|
||||
clsName,
|
||||
() -> mServices[j] = startStartable(clsName, entry.getValue()),
|
||||
log,
|
||||
metricsPrefix);
|
||||
i++;
|
||||
}
|
||||
|
||||
// Warn if initialization of component takes too long
|
||||
ti = System.currentTimeMillis() - ti;
|
||||
if (ti > 1000) {
|
||||
Log.w(TAG, "Initialization of " + clsName + " took " + ti + " ms");
|
||||
}
|
||||
if (vendorComponent != null) {
|
||||
timeInitialization(
|
||||
vendorComponent,
|
||||
() -> mServices[mServices.length - 1] =
|
||||
startAdditionalStartable(vendorComponent),
|
||||
log,
|
||||
metricsPrefix);
|
||||
}
|
||||
|
||||
for (i = 0; i < mServices.length; i++) {
|
||||
if (mBootCompleteCache.isBootComplete()) {
|
||||
mServices[i].onBootCompleted();
|
||||
}
|
||||
@@ -272,6 +273,50 @@ public class SystemUIApplication extends Application implements
|
||||
mServicesStarted = true;
|
||||
}
|
||||
|
||||
private void timeInitialization(String clsName, Runnable init, TimingsTraceLog log,
|
||||
String metricsPrefix) {
|
||||
long ti = System.currentTimeMillis();
|
||||
log.traceBegin(metricsPrefix + " " + clsName);
|
||||
init.run();
|
||||
log.traceEnd();
|
||||
|
||||
// Warn if initialization of component takes too long
|
||||
ti = System.currentTimeMillis() - ti;
|
||||
if (ti > 1000) {
|
||||
Log.w(TAG, "Initialization of " + clsName + " took " + ti + " ms");
|
||||
}
|
||||
}
|
||||
|
||||
private CoreStartable startAdditionalStartable(String clsName) {
|
||||
CoreStartable startable;
|
||||
if (DEBUG) Log.d(TAG, "loading: " + clsName);
|
||||
try {
|
||||
Constructor<?> constructor = Class.forName(clsName).getConstructor(
|
||||
Context.class);
|
||||
startable = (CoreStartable) constructor.newInstance(this);
|
||||
} catch (ClassNotFoundException
|
||||
| NoSuchMethodException
|
||||
| IllegalAccessException
|
||||
| InstantiationException
|
||||
| InvocationTargetException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
|
||||
return startStartable(startable);
|
||||
}
|
||||
|
||||
private CoreStartable startStartable(String clsName, Provider<CoreStartable> provider) {
|
||||
if (DEBUG) Log.d(TAG, "loading: " + clsName);
|
||||
return startStartable(provider.get());
|
||||
}
|
||||
|
||||
private CoreStartable startStartable(CoreStartable startable) {
|
||||
if (DEBUG) Log.d(TAG, "running: " + startable);
|
||||
startable.start();
|
||||
|
||||
return startable;
|
||||
}
|
||||
|
||||
// TODO(b/217567642): add unit tests? There doesn't seem to be a SystemUiApplicationTest...
|
||||
@Override
|
||||
public boolean addDumpable(Dumpable dumpable) {
|
||||
|
||||
@@ -32,10 +32,13 @@ import com.android.systemui.navigationbar.gestural.BackGestureTfClassifierProvid
|
||||
import com.android.systemui.screenshot.ScreenshotNotificationSmartActionsProvider;
|
||||
import com.android.wm.shell.transition.ShellTransitions;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import javax.inject.Provider;
|
||||
|
||||
/**
|
||||
* Class factory to provide customizable SystemUI components.
|
||||
*/
|
||||
@@ -190,24 +193,24 @@ public class SystemUIFactory {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of system UI components that should be started.
|
||||
* Returns the list of {@link CoreStartable} components that should be started at startup.
|
||||
*/
|
||||
public String[] getSystemUIServiceComponents(Resources resources) {
|
||||
return resources.getStringArray(R.array.config_systemUIServiceComponents);
|
||||
public Map<Class<?>, Provider<CoreStartable>> getStartableComponents() {
|
||||
return mSysUIComponent.getStartables();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of additional system UI components that should be started.
|
||||
*/
|
||||
public String[] getAdditionalSystemUIServiceComponents(Resources resources) {
|
||||
return resources.getStringArray(R.array.config_additionalSystemUIServiceComponents);
|
||||
public String getVendorComponent(Resources resources) {
|
||||
return resources.getString(R.string.config_systemUIVendorServiceComponent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of system UI components that should be started per user.
|
||||
* Returns the list of {@link CoreStartable} components that should be started per user.
|
||||
*/
|
||||
public String[] getSystemUIServiceComponentsPerUser(Resources resources) {
|
||||
return resources.getStringArray(R.array.config_systemUIServiceComponentsPerUser);
|
||||
public Map<Class<?>, Provider<CoreStartable>> getStartableComponentsPerUser() {
|
||||
return mSysUIComponent.getPerUserStartables();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,7 +20,6 @@ import android.app.Activity;
|
||||
import android.app.Service;
|
||||
import android.content.BroadcastReceiver;
|
||||
|
||||
import com.android.systemui.CoreStartable;
|
||||
import com.android.systemui.recents.RecentsImplementation;
|
||||
|
||||
/**
|
||||
@@ -36,9 +35,6 @@ public interface ContextComponentHelper {
|
||||
/** Turns a classname into an instance of the class or returns null. */
|
||||
Service resolveService(String className);
|
||||
|
||||
/** Turns a classname into an instance of the class or returns null. */
|
||||
CoreStartable resolveCoreStartable(String className);
|
||||
|
||||
/** Turns a classname into an instance of the class or returns null. */
|
||||
BroadcastReceiver resolveBroadcastReceiver(String className);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import android.app.Activity;
|
||||
import android.app.Service;
|
||||
import android.content.BroadcastReceiver;
|
||||
|
||||
import com.android.systemui.CoreStartable;
|
||||
import com.android.systemui.recents.RecentsImplementation;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -35,19 +34,16 @@ import javax.inject.Provider;
|
||||
public class ContextComponentResolver implements ContextComponentHelper {
|
||||
private final Map<Class<?>, Provider<Activity>> mActivityCreators;
|
||||
private final Map<Class<?>, Provider<Service>> mServiceCreators;
|
||||
private final Map<Class<?>, Provider<CoreStartable>> mSystemUICreators;
|
||||
private final Map<Class<?>, Provider<RecentsImplementation>> mRecentsCreators;
|
||||
private final Map<Class<?>, Provider<BroadcastReceiver>> mBroadcastReceiverCreators;
|
||||
|
||||
@Inject
|
||||
ContextComponentResolver(Map<Class<?>, Provider<Activity>> activityCreators,
|
||||
Map<Class<?>, Provider<Service>> serviceCreators,
|
||||
Map<Class<?>, Provider<CoreStartable>> systemUICreators,
|
||||
Map<Class<?>, Provider<RecentsImplementation>> recentsCreators,
|
||||
Map<Class<?>, Provider<BroadcastReceiver>> broadcastReceiverCreators) {
|
||||
mActivityCreators = activityCreators;
|
||||
mServiceCreators = serviceCreators;
|
||||
mSystemUICreators = systemUICreators;
|
||||
mRecentsCreators = recentsCreators;
|
||||
mBroadcastReceiverCreators = broadcastReceiverCreators;
|
||||
}
|
||||
@@ -84,14 +80,6 @@ public class ContextComponentResolver implements ContextComponentHelper {
|
||||
return resolve(className, mServiceCreators);
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks up the SystemUI class name to see if Dagger has an instance of it.
|
||||
*/
|
||||
@Override
|
||||
public CoreStartable resolveCoreStartable(String className) {
|
||||
return resolve(className, mSystemUICreators);
|
||||
}
|
||||
|
||||
private <T> T resolve(String className, Map<Class<?>, Provider<T>> creators) {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(className);
|
||||
|
||||
@@ -18,9 +18,11 @@ package com.android.systemui.dagger;
|
||||
|
||||
import com.android.keyguard.clock.ClockOptionsProvider;
|
||||
import com.android.systemui.BootCompleteCacheImpl;
|
||||
import com.android.systemui.CoreStartable;
|
||||
import com.android.systemui.Dependency;
|
||||
import com.android.systemui.InitController;
|
||||
import com.android.systemui.SystemUIAppComponentFactory;
|
||||
import com.android.systemui.dagger.qualifiers.PerUser;
|
||||
import com.android.systemui.dump.DumpManager;
|
||||
import com.android.systemui.keyguard.KeyguardSliceProvider;
|
||||
import com.android.systemui.media.taptotransfer.MediaTttCommandLineHelper;
|
||||
@@ -51,8 +53,11 @@ import com.android.wm.shell.startingsurface.StartingSurface;
|
||||
import com.android.wm.shell.tasksurfacehelper.TaskSurfaceHelper;
|
||||
import com.android.wm.shell.transition.ShellTransitions;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.inject.Provider;
|
||||
|
||||
import dagger.BindsInstance;
|
||||
import dagger.Subcomponent;
|
||||
|
||||
@@ -65,6 +70,7 @@ import dagger.Subcomponent;
|
||||
DependencyProvider.class,
|
||||
SystemUIBinder.class,
|
||||
SystemUIModule.class,
|
||||
SystemUICoreStartableModule.class,
|
||||
SystemUIDefaultModule.class})
|
||||
public interface SysUIComponent {
|
||||
|
||||
@@ -220,6 +226,16 @@ public interface SysUIComponent {
|
||||
/** */
|
||||
Optional<MediaTttCommandLineHelper> getMediaTttCommandLineHelper();
|
||||
|
||||
/**
|
||||
* Returns {@link CoreStartable}s that should be started with the application.
|
||||
*/
|
||||
Map<Class<?>, Provider<CoreStartable>> getStartables();
|
||||
|
||||
/**
|
||||
* Returns {@link CoreStartable}s that should be started for every user.
|
||||
*/
|
||||
@PerUser Map<Class<?>, Provider<CoreStartable>> getPerUserStartables();
|
||||
|
||||
/**
|
||||
* Member injection into the supplied argument.
|
||||
*/
|
||||
|
||||
@@ -16,46 +16,11 @@
|
||||
|
||||
package com.android.systemui.dagger;
|
||||
|
||||
import com.android.keyguard.KeyguardBiometricLockoutLogger;
|
||||
import com.android.systemui.CoreStartable;
|
||||
import com.android.systemui.LatencyTester;
|
||||
import com.android.systemui.ScreenDecorations;
|
||||
import com.android.systemui.SliceBroadcastRelayHandler;
|
||||
import com.android.systemui.accessibility.SystemActions;
|
||||
import com.android.systemui.accessibility.WindowMagnification;
|
||||
import com.android.systemui.biometrics.AuthController;
|
||||
import com.android.systemui.clipboardoverlay.ClipboardListener;
|
||||
import com.android.systemui.dreams.DreamOverlayRegistrant;
|
||||
import com.android.systemui.dreams.SmartSpaceComplication;
|
||||
import com.android.systemui.dreams.complication.DreamClockDateComplication;
|
||||
import com.android.systemui.dreams.complication.DreamClockTimeComplication;
|
||||
import com.android.systemui.dreams.complication.DreamWeatherComplication;
|
||||
import com.android.systemui.globalactions.GlobalActionsComponent;
|
||||
import com.android.systemui.keyguard.KeyguardViewMediator;
|
||||
import com.android.systemui.keyguard.dagger.KeyguardModule;
|
||||
import com.android.systemui.log.SessionTracker;
|
||||
import com.android.systemui.media.dream.MediaDreamSentinel;
|
||||
import com.android.systemui.media.systemsounds.HomeSoundEffectController;
|
||||
import com.android.systemui.power.PowerUI;
|
||||
import com.android.systemui.privacy.television.TvOngoingPrivacyChip;
|
||||
import com.android.systemui.recents.Recents;
|
||||
import com.android.systemui.recents.RecentsModule;
|
||||
import com.android.systemui.shortcut.ShortcutKeyDispatcher;
|
||||
import com.android.systemui.statusbar.dagger.StatusBarModule;
|
||||
import com.android.systemui.statusbar.notification.InstantAppNotifier;
|
||||
import com.android.systemui.statusbar.phone.StatusBar;
|
||||
import com.android.systemui.statusbar.tv.TvStatusBar;
|
||||
import com.android.systemui.statusbar.tv.notifications.TvNotificationPanel;
|
||||
import com.android.systemui.theme.ThemeOverlayController;
|
||||
import com.android.systemui.toast.ToastUI;
|
||||
import com.android.systemui.util.leak.GarbageMonitor;
|
||||
import com.android.systemui.volume.VolumeUI;
|
||||
import com.android.systemui.wmshell.WMShell;
|
||||
|
||||
import dagger.Binds;
|
||||
import dagger.Module;
|
||||
import dagger.multibindings.ClassKey;
|
||||
import dagger.multibindings.IntoMap;
|
||||
|
||||
/**
|
||||
* SystemUI objects that are injectable should go here.
|
||||
@@ -66,196 +31,4 @@ import dagger.multibindings.IntoMap;
|
||||
KeyguardModule.class,
|
||||
})
|
||||
public abstract class SystemUIBinder {
|
||||
/** Inject into AuthController. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(AuthController.class)
|
||||
public abstract CoreStartable bindAuthController(AuthController service);
|
||||
|
||||
/** Inject into SessionTracker. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(SessionTracker.class)
|
||||
public abstract CoreStartable bindSessionTracker(SessionTracker service);
|
||||
|
||||
/** Inject into GarbageMonitor.Service. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(GarbageMonitor.Service.class)
|
||||
public abstract CoreStartable bindGarbageMonitorService(GarbageMonitor.Service sysui);
|
||||
|
||||
/** Inject into ClipboardListener. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(ClipboardListener.class)
|
||||
public abstract CoreStartable bindClipboardListener(ClipboardListener sysui);
|
||||
|
||||
/** Inject into GlobalActionsComponent. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(GlobalActionsComponent.class)
|
||||
public abstract CoreStartable bindGlobalActionsComponent(GlobalActionsComponent sysui);
|
||||
|
||||
/** Inject into InstantAppNotifier. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(InstantAppNotifier.class)
|
||||
public abstract CoreStartable bindInstantAppNotifier(InstantAppNotifier sysui);
|
||||
|
||||
/** Inject into KeyguardViewMediator. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(KeyguardViewMediator.class)
|
||||
public abstract CoreStartable bindKeyguardViewMediator(KeyguardViewMediator sysui);
|
||||
|
||||
/** Inject into KeyguardBiometricLockoutLogger. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(KeyguardBiometricLockoutLogger.class)
|
||||
public abstract CoreStartable bindKeyguardBiometricLockoutLogger(
|
||||
KeyguardBiometricLockoutLogger sysui);
|
||||
|
||||
/** Inject into LatencyTests. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(LatencyTester.class)
|
||||
public abstract CoreStartable bindLatencyTester(LatencyTester sysui);
|
||||
|
||||
/** Inject into PowerUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(PowerUI.class)
|
||||
public abstract CoreStartable bindPowerUI(PowerUI sysui);
|
||||
|
||||
/** Inject into Recents. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(Recents.class)
|
||||
public abstract CoreStartable bindRecents(Recents sysui);
|
||||
|
||||
/** Inject into ScreenDecorations. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(ScreenDecorations.class)
|
||||
public abstract CoreStartable bindScreenDecorations(ScreenDecorations sysui);
|
||||
|
||||
/** Inject into ShortcutKeyDispatcher. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(ShortcutKeyDispatcher.class)
|
||||
public abstract CoreStartable bindsShortcutKeyDispatcher(ShortcutKeyDispatcher sysui);
|
||||
|
||||
/** Inject into SliceBroadcastRelayHandler. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(SliceBroadcastRelayHandler.class)
|
||||
public abstract CoreStartable bindSliceBroadcastRelayHandler(SliceBroadcastRelayHandler sysui);
|
||||
|
||||
/** Inject into StatusBar. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(StatusBar.class)
|
||||
public abstract CoreStartable bindsStatusBar(StatusBar sysui);
|
||||
|
||||
/** Inject into SystemActions. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(SystemActions.class)
|
||||
public abstract CoreStartable bindSystemActions(SystemActions sysui);
|
||||
|
||||
/** Inject into ThemeOverlayController. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(ThemeOverlayController.class)
|
||||
public abstract CoreStartable bindThemeOverlayController(ThemeOverlayController sysui);
|
||||
|
||||
/** Inject into ToastUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(ToastUI.class)
|
||||
public abstract CoreStartable bindToastUI(ToastUI service);
|
||||
|
||||
/** Inject into TvStatusBar. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(TvStatusBar.class)
|
||||
public abstract CoreStartable bindsTvStatusBar(TvStatusBar sysui);
|
||||
|
||||
/** Inject into TvNotificationPanel. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(TvNotificationPanel.class)
|
||||
public abstract CoreStartable bindsTvNotificationPanel(TvNotificationPanel sysui);
|
||||
|
||||
/** Inject into TvOngoingPrivacyChip. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(TvOngoingPrivacyChip.class)
|
||||
public abstract CoreStartable bindsTvOngoingPrivacyChip(TvOngoingPrivacyChip sysui);
|
||||
|
||||
/** Inject into VolumeUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(VolumeUI.class)
|
||||
public abstract CoreStartable bindVolumeUI(VolumeUI sysui);
|
||||
|
||||
/** Inject into WindowMagnification. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(WindowMagnification.class)
|
||||
public abstract CoreStartable bindWindowMagnification(WindowMagnification sysui);
|
||||
|
||||
/** Inject into WMShell. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(WMShell.class)
|
||||
public abstract CoreStartable bindWMShell(WMShell sysui);
|
||||
|
||||
/** Inject into HomeSoundEffectController. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(HomeSoundEffectController.class)
|
||||
public abstract CoreStartable bindHomeSoundEffectController(HomeSoundEffectController sysui);
|
||||
|
||||
/** Inject into DreamOverlay. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(DreamOverlayRegistrant.class)
|
||||
public abstract CoreStartable bindDreamOverlayRegistrant(
|
||||
DreamOverlayRegistrant dreamOverlayRegistrant);
|
||||
|
||||
/** Inject into SmartSpaceComplication.Registrant */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(SmartSpaceComplication.Registrant.class)
|
||||
public abstract CoreStartable bindSmartSpaceComplicationRegistrant(
|
||||
SmartSpaceComplication.Registrant registrant);
|
||||
|
||||
/** Inject into MediaDreamSentinel. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(MediaDreamSentinel.class)
|
||||
public abstract CoreStartable bindMediaDreamSentinel(
|
||||
MediaDreamSentinel sentinel);
|
||||
|
||||
/** Inject into DreamClockTimeComplication.Registrant */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(DreamClockTimeComplication.Registrant.class)
|
||||
public abstract CoreStartable bindDreamClockTimeComplicationRegistrant(
|
||||
DreamClockTimeComplication.Registrant registrant);
|
||||
|
||||
/** Inject into DreamClockDateComplication.Registrant */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(DreamClockDateComplication.Registrant.class)
|
||||
public abstract CoreStartable bindDreamClockDateComplicationRegistrant(
|
||||
DreamClockDateComplication.Registrant registrant);
|
||||
|
||||
/** Inject into DreamWeatherComplication.Registrant */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(DreamWeatherComplication.Registrant.class)
|
||||
public abstract CoreStartable bindDreamWeatherComplicationRegistrant(
|
||||
DreamWeatherComplication.Registrant registrant);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.systemui.dagger
|
||||
|
||||
import com.android.keyguard.KeyguardBiometricLockoutLogger
|
||||
import com.android.systemui.CoreStartable
|
||||
import com.android.systemui.LatencyTester
|
||||
import com.android.systemui.ScreenDecorations
|
||||
import com.android.systemui.SliceBroadcastRelayHandler
|
||||
import com.android.systemui.accessibility.SystemActions
|
||||
import com.android.systemui.accessibility.WindowMagnification
|
||||
import com.android.systemui.biometrics.AuthController
|
||||
import com.android.systemui.clipboardoverlay.ClipboardListener
|
||||
import com.android.systemui.dagger.qualifiers.PerUser
|
||||
import com.android.systemui.globalactions.GlobalActionsComponent
|
||||
import com.android.systemui.keyboard.KeyboardUI
|
||||
import com.android.systemui.keyguard.KeyguardViewMediator
|
||||
import com.android.systemui.log.SessionTracker
|
||||
import com.android.systemui.media.RingtonePlayer
|
||||
import com.android.systemui.power.PowerUI
|
||||
import com.android.systemui.recents.Recents
|
||||
import com.android.systemui.shortcut.ShortcutKeyDispatcher
|
||||
import com.android.systemui.statusbar.notification.InstantAppNotifier
|
||||
import com.android.systemui.theme.ThemeOverlayController
|
||||
import com.android.systemui.toast.ToastUI
|
||||
import com.android.systemui.usb.StorageNotification
|
||||
import com.android.systemui.util.NotificationChannels
|
||||
import com.android.systemui.util.leak.GarbageMonitor
|
||||
import com.android.systemui.volume.VolumeUI
|
||||
import com.android.systemui.wmshell.WMShell
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.multibindings.ClassKey
|
||||
import dagger.multibindings.IntoMap
|
||||
|
||||
/**
|
||||
* Collection of {@link CoreStartable}s that should be run on AOSP.
|
||||
*/
|
||||
@Module
|
||||
abstract class SystemUICoreStartableModule {
|
||||
/** Inject into AuthController. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(AuthController::class)
|
||||
abstract fun bindAuthController(service: AuthController): CoreStartable
|
||||
|
||||
/** Inject into ClipboardListener. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(ClipboardListener::class)
|
||||
abstract fun bindClipboardListener(sysui: ClipboardListener): CoreStartable
|
||||
|
||||
/** Inject into GarbageMonitor.Service. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(GarbageMonitor::class)
|
||||
abstract fun bindGarbageMonitorService(sysui: GarbageMonitor.Service): CoreStartable
|
||||
|
||||
/** Inject into GlobalActionsComponent. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(GlobalActionsComponent::class)
|
||||
abstract fun bindGlobalActionsComponent(sysui: GlobalActionsComponent): CoreStartable
|
||||
|
||||
/** Inject into InstantAppNotifier. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(InstantAppNotifier::class)
|
||||
abstract fun bindInstantAppNotifier(sysui: InstantAppNotifier): CoreStartable
|
||||
|
||||
/** Inject into KeyboardUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(KeyboardUI::class)
|
||||
abstract fun bindKeyboardUI(sysui: KeyboardUI): CoreStartable
|
||||
|
||||
/** Inject into KeyguardBiometricLockoutLogger */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(KeyguardBiometricLockoutLogger::class)
|
||||
abstract fun bindKeyguardBiometricLockoutLogger(
|
||||
sysui: KeyguardBiometricLockoutLogger
|
||||
): CoreStartable
|
||||
|
||||
/** Inject into KeyguardViewMediator. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(KeyguardViewMediator::class)
|
||||
abstract fun bindKeyguardViewMediator(sysui: KeyguardViewMediator): CoreStartable
|
||||
|
||||
/** Inject into LatencyTests. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(LatencyTester::class)
|
||||
abstract fun bindLatencyTester(sysui: LatencyTester): CoreStartable
|
||||
|
||||
/** Inject into NotificationChannels. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(NotificationChannels::class)
|
||||
@PerUser
|
||||
abstract fun bindNotificationChannels(sysui: NotificationChannels): CoreStartable
|
||||
|
||||
/** Inject into PowerUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(PowerUI::class)
|
||||
abstract fun bindPowerUI(sysui: PowerUI): CoreStartable
|
||||
|
||||
/** Inject into Recents. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(Recents::class)
|
||||
abstract fun bindRecents(sysui: Recents): CoreStartable
|
||||
|
||||
/** Inject into RingtonePlayer. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(RingtonePlayer::class)
|
||||
abstract fun bind(sysui: RingtonePlayer): CoreStartable
|
||||
|
||||
/** Inject into ScreenDecorations. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(ScreenDecorations::class)
|
||||
abstract fun bindScreenDecorations(sysui: ScreenDecorations): CoreStartable
|
||||
|
||||
/** Inject into SessionTracker. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(SessionTracker::class)
|
||||
abstract fun bindSessionTracker(service: SessionTracker): CoreStartable
|
||||
|
||||
/** Inject into ShortcutKeyDispatcher. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(ShortcutKeyDispatcher::class)
|
||||
abstract fun bindShortcutKeyDispatcher(sysui: ShortcutKeyDispatcher): CoreStartable
|
||||
|
||||
/** Inject into SliceBroadcastRelayHandler. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(SliceBroadcastRelayHandler::class)
|
||||
abstract fun bindSliceBroadcastRelayHandler(sysui: SliceBroadcastRelayHandler): CoreStartable
|
||||
|
||||
/** Inject into StorageNotification. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(StorageNotification::class)
|
||||
abstract fun bindStorageNotification(sysui: StorageNotification): CoreStartable
|
||||
|
||||
/** Inject into SystemActions. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(SystemActions::class)
|
||||
abstract fun bindSystemActions(sysui: SystemActions): CoreStartable
|
||||
|
||||
/** Inject into ThemeOverlayController. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(ThemeOverlayController::class)
|
||||
abstract fun bindThemeOverlayController(sysui: ThemeOverlayController): CoreStartable
|
||||
|
||||
/** Inject into ToastUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(ToastUI::class)
|
||||
abstract fun bindToastUI(service: ToastUI): CoreStartable
|
||||
|
||||
/** Inject into VolumeUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(VolumeUI::class)
|
||||
abstract fun bindVolumeUI(sysui: VolumeUI): CoreStartable
|
||||
|
||||
/** Inject into WindowMagnification. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(WindowMagnification::class)
|
||||
abstract fun bindWindowMagnification(sysui: WindowMagnification): CoreStartable
|
||||
|
||||
/** Inject into WMShell. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(WMShell::class)
|
||||
abstract fun bindWMShell(sysui: WMShell): CoreStartable
|
||||
}
|
||||
@@ -48,6 +48,7 @@ import com.android.systemui.statusbar.CommandQueue;
|
||||
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
|
||||
import com.android.systemui.statusbar.NotificationLockscreenUserManagerImpl;
|
||||
import com.android.systemui.statusbar.NotificationShadeWindowController;
|
||||
import com.android.systemui.statusbar.dagger.StartStatusBarModule;
|
||||
import com.android.systemui.statusbar.notification.NotificationEntryManager;
|
||||
import com.android.systemui.statusbar.notification.collection.provider.VisualStabilityProvider;
|
||||
import com.android.systemui.statusbar.notification.collection.render.GroupMembershipManager;
|
||||
@@ -86,6 +87,7 @@ import dagger.Provides;
|
||||
MediaModule.class,
|
||||
PowerModule.class,
|
||||
QSModule.class,
|
||||
StartStatusBarModule.class,
|
||||
VolumeModule.class
|
||||
})
|
||||
public abstract class SystemUIDefaultModule {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (C) 2019 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.systemui.dagger.qualifiers;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
|
||||
import javax.inject.Qualifier;
|
||||
|
||||
@Qualifier
|
||||
@Documented
|
||||
@Retention(RUNTIME)
|
||||
public @interface PerUser {
|
||||
}
|
||||
@@ -19,6 +19,7 @@ package com.android.systemui.dump
|
||||
import android.content.Context
|
||||
import android.os.SystemClock
|
||||
import android.os.Trace
|
||||
import com.android.systemui.CoreStartable
|
||||
import com.android.systemui.R
|
||||
import com.android.systemui.dump.DumpHandler.Companion.PRIORITY_ARG_CRITICAL
|
||||
import com.android.systemui.dump.DumpHandler.Companion.PRIORITY_ARG_HIGH
|
||||
@@ -27,6 +28,7 @@ import com.android.systemui.log.LogBuffer
|
||||
import java.io.FileDescriptor
|
||||
import java.io.PrintWriter
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Provider
|
||||
|
||||
/**
|
||||
* Oversees SystemUI's output during bug reports (and dumpsys in general)
|
||||
@@ -80,7 +82,8 @@ import javax.inject.Inject
|
||||
class DumpHandler @Inject constructor(
|
||||
private val context: Context,
|
||||
private val dumpManager: DumpManager,
|
||||
private val logBufferEulogizer: LogBufferEulogizer
|
||||
private val logBufferEulogizer: LogBufferEulogizer,
|
||||
private val startables: MutableMap<Class<*>, Provider<CoreStartable>>
|
||||
) {
|
||||
/**
|
||||
* Dump the diagnostics! Behavior can be controlled via [args].
|
||||
@@ -173,12 +176,21 @@ class DumpHandler @Inject constructor(
|
||||
pw.println("SystemUiServiceComponents configuration:")
|
||||
pw.print("vendor component: ")
|
||||
pw.println(context.resources.getString(R.string.config_systemUIVendorServiceComponent))
|
||||
dumpServiceList(pw, "global", R.array.config_systemUIServiceComponents)
|
||||
val services: MutableList<String> = startables.keys
|
||||
.map({ cls: Class<*> -> cls.simpleName })
|
||||
.toMutableList()
|
||||
|
||||
services.add(context.resources.getString(R.string.config_systemUIVendorServiceComponent))
|
||||
dumpServiceList(pw, "global", services.toTypedArray())
|
||||
dumpServiceList(pw, "per-user", R.array.config_systemUIServiceComponentsPerUser)
|
||||
}
|
||||
|
||||
private fun dumpServiceList(pw: PrintWriter, type: String, resId: Int) {
|
||||
val services: Array<String>? = context.resources.getStringArray(resId)
|
||||
val services: Array<String> = context.resources.getStringArray(resId)
|
||||
dumpServiceList(pw, type, services)
|
||||
}
|
||||
|
||||
private fun dumpServiceList(pw: PrintWriter, type: String, services: Array<String>?) {
|
||||
pw.print(type)
|
||||
pw.print(": ")
|
||||
if (services == null) {
|
||||
|
||||
@@ -52,6 +52,7 @@ import com.android.settingslib.bluetooth.LocalBluetoothProfileManager;
|
||||
import com.android.systemui.CoreStartable;
|
||||
import com.android.systemui.Dependency;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.dagger.SysUISingleton;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
@@ -60,6 +61,10 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/** */
|
||||
@SysUISingleton
|
||||
public class KeyboardUI extends CoreStartable implements InputManager.OnTabletModeChangedListener {
|
||||
private static final String TAG = "KeyboardUI";
|
||||
private static final boolean DEBUG = false;
|
||||
@@ -117,6 +122,7 @@ public class KeyboardUI extends CoreStartable implements InputManager.OnTabletMo
|
||||
|
||||
private int mState;
|
||||
|
||||
@Inject
|
||||
public KeyboardUI(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@@ -38,16 +38,20 @@ import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.systemui.CoreStartable;
|
||||
import com.android.systemui.dagger.SysUISingleton;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/**
|
||||
* Service that offers to play ringtones by {@link Uri}, since our process has
|
||||
* {@link android.Manifest.permission#READ_EXTERNAL_STORAGE}.
|
||||
*/
|
||||
@SysUISingleton
|
||||
public class RingtonePlayer extends CoreStartable {
|
||||
private static final String TAG = "RingtonePlayer";
|
||||
private static final boolean LOGD = false;
|
||||
@@ -59,6 +63,7 @@ public class RingtonePlayer extends CoreStartable {
|
||||
private final NotificationPlayer mAsyncPlayer = new NotificationPlayer(TAG);
|
||||
private final HashMap<IBinder, Client> mClients = new HashMap<IBinder, Client>();
|
||||
|
||||
@Inject
|
||||
public RingtonePlayer(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.systemui.statusbar.dagger
|
||||
|
||||
import com.android.systemui.CoreStartable
|
||||
import com.android.systemui.statusbar.phone.StatusBar
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.multibindings.ClassKey
|
||||
import dagger.multibindings.IntoMap
|
||||
|
||||
@Module
|
||||
interface StartStatusBarModule {
|
||||
/** Start the StatusBar */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(StatusBar::class)
|
||||
abstract fun bindsStatusBar(statusBar: StatusBar): CoreStartable
|
||||
}
|
||||
@@ -204,7 +204,7 @@ public interface NotificationsModule {
|
||||
static VisualStabilityManager provideVisualStabilityManager(
|
||||
NotificationEntryManager notificationEntryManager,
|
||||
VisualStabilityProvider visualStabilityProvider,
|
||||
Handler handler,
|
||||
@Main Handler handler,
|
||||
StatusBarStateController statusBarStateController,
|
||||
WakefulnessLifecycle wakefulnessLifecycle,
|
||||
DumpManager dumpManager) {
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.android.keyguard.ViewMediatorCallback;
|
||||
import com.android.keyguard.dagger.KeyguardBouncerComponent;
|
||||
import com.android.systemui.DejankUtils;
|
||||
import com.android.systemui.classifier.FalsingCollector;
|
||||
import com.android.systemui.dagger.qualifiers.Main;
|
||||
import com.android.systemui.keyguard.DismissCallbackRegistry;
|
||||
import com.android.systemui.shared.system.SysUiStatsLog;
|
||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||
@@ -115,7 +116,7 @@ public class KeyguardBouncer {
|
||||
BouncerExpansionCallback expansionCallback,
|
||||
KeyguardStateController keyguardStateController,
|
||||
KeyguardUpdateMonitor keyguardUpdateMonitor,
|
||||
KeyguardBypassController keyguardBypassController, Handler handler,
|
||||
KeyguardBypassController keyguardBypassController, @Main Handler handler,
|
||||
KeyguardSecurityModel keyguardSecurityModel,
|
||||
KeyguardBouncerComponent.Factory keyguardBouncerComponentFactory) {
|
||||
mContext = context;
|
||||
@@ -647,7 +648,7 @@ public class KeyguardBouncer {
|
||||
DismissCallbackRegistry dismissCallbackRegistry, FalsingCollector falsingCollector,
|
||||
KeyguardStateController keyguardStateController,
|
||||
KeyguardUpdateMonitor keyguardUpdateMonitor,
|
||||
KeyguardBypassController keyguardBypassController, Handler handler,
|
||||
KeyguardBypassController keyguardBypassController, @Main Handler handler,
|
||||
KeyguardSecurityModel keyguardSecurityModel,
|
||||
KeyguardBouncerComponent.Factory keyguardBouncerComponentFactory) {
|
||||
mContext = context;
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
/*
|
||||
* Copyright (C) 2021 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.systemui.tv
|
||||
|
||||
import com.android.systemui.CoreStartable
|
||||
import com.android.systemui.SliceBroadcastRelayHandler
|
||||
import com.android.systemui.accessibility.WindowMagnification
|
||||
import com.android.systemui.dagger.qualifiers.PerUser
|
||||
import com.android.systemui.globalactions.GlobalActionsComponent
|
||||
import com.android.systemui.keyboard.KeyboardUI
|
||||
import com.android.systemui.media.RingtonePlayer
|
||||
import com.android.systemui.media.systemsounds.HomeSoundEffectController
|
||||
import com.android.systemui.power.PowerUI
|
||||
import com.android.systemui.privacy.television.TvOngoingPrivacyChip
|
||||
import com.android.systemui.shortcut.ShortcutKeyDispatcher
|
||||
import com.android.systemui.statusbar.notification.InstantAppNotifier
|
||||
import com.android.systemui.statusbar.tv.TvStatusBar
|
||||
import com.android.systemui.statusbar.tv.VpnStatusObserver
|
||||
import com.android.systemui.statusbar.tv.notifications.TvNotificationHandler
|
||||
import com.android.systemui.statusbar.tv.notifications.TvNotificationPanel
|
||||
import com.android.systemui.toast.ToastUI
|
||||
import com.android.systemui.usb.StorageNotification
|
||||
import com.android.systemui.util.NotificationChannels
|
||||
import com.android.systemui.volume.VolumeUI
|
||||
import com.android.systemui.wmshell.WMShell
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.multibindings.ClassKey
|
||||
import dagger.multibindings.IntoMap
|
||||
|
||||
/**
|
||||
* Collection of {@link CoreStartable}s that should be run on TV.
|
||||
*/
|
||||
@Module
|
||||
abstract class TVSystemUICoreStartableModule {
|
||||
/** Inject into GlobalActionsComponent. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(GlobalActionsComponent::class)
|
||||
abstract fun bindGlobalActionsComponent(sysui: GlobalActionsComponent): CoreStartable
|
||||
|
||||
/** Inject into HomeSoundEffectController. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(HomeSoundEffectController::class)
|
||||
abstract fun bindHomeSoundEffectController(sysui: HomeSoundEffectController): CoreStartable
|
||||
|
||||
/** Inject into InstantAppNotifier. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(InstantAppNotifier::class)
|
||||
abstract fun bindInstantAppNotifier(sysui: InstantAppNotifier): CoreStartable
|
||||
|
||||
/** Inject into KeyboardUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(KeyboardUI::class)
|
||||
abstract fun bindKeyboardUI(sysui: KeyboardUI): CoreStartable
|
||||
|
||||
/** Inject into NotificationChannels. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(NotificationChannels::class)
|
||||
@PerUser
|
||||
abstract fun bindNotificationChannels(sysui: NotificationChannels): CoreStartable
|
||||
|
||||
/** Inject into PowerUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(PowerUI::class)
|
||||
abstract fun bindPowerUI(sysui: PowerUI): CoreStartable
|
||||
|
||||
/** Inject into RingtonePlayer. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(RingtonePlayer::class)
|
||||
abstract fun bind(sysui: RingtonePlayer): CoreStartable
|
||||
|
||||
/** Inject into ShortcutKeyDispatcher. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(ShortcutKeyDispatcher::class)
|
||||
abstract fun bindShortcutKeyDispatcher(sysui: ShortcutKeyDispatcher): CoreStartable
|
||||
|
||||
/** Inject into SliceBroadcastRelayHandler. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(SliceBroadcastRelayHandler::class)
|
||||
abstract fun bindSliceBroadcastRelayHandler(sysui: SliceBroadcastRelayHandler): CoreStartable
|
||||
|
||||
/** Inject into StorageNotification. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(StorageNotification::class)
|
||||
abstract fun bindStorageNotification(sysui: StorageNotification): CoreStartable
|
||||
|
||||
/** Inject into ToastUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(ToastUI::class)
|
||||
abstract fun bindToastUI(service: ToastUI): CoreStartable
|
||||
|
||||
/** Inject into TvNotificationHandler. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(TvNotificationHandler::class)
|
||||
abstract fun bindTvNotificationHandler(sysui: TvNotificationHandler): CoreStartable
|
||||
|
||||
/** Inject into TvNotificationPanel. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(TvNotificationPanel::class)
|
||||
abstract fun bindTvNotificationPanel(sysui: TvNotificationPanel): CoreStartable
|
||||
|
||||
/** Inject into TvOngoingPrivacyChip. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(TvOngoingPrivacyChip::class)
|
||||
abstract fun bindTvOngoingPrivacyChip(sysui: TvOngoingPrivacyChip): CoreStartable
|
||||
|
||||
/** Inject into TvStatusBar. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(TvStatusBar::class)
|
||||
abstract fun bindTvStatusBar(sysui: TvStatusBar): CoreStartable
|
||||
|
||||
/** Inject into VolumeUI. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(VolumeUI::class)
|
||||
abstract fun bindVolumeUI(sysui: VolumeUI): CoreStartable
|
||||
|
||||
/** Inject into VpnStatusObserver. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(VpnStatusObserver::class)
|
||||
abstract fun bindVpnStatusObserver(sysui: VpnStatusObserver): CoreStartable
|
||||
|
||||
/** Inject into WindowMagnification. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(WindowMagnification::class)
|
||||
abstract fun bindWindowMagnification(sysui: WindowMagnification): CoreStartable
|
||||
|
||||
/** Inject into WMShell. */
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(WMShell::class)
|
||||
abstract fun bindWMShell(sysui: WMShell): CoreStartable
|
||||
}
|
||||
@@ -34,6 +34,7 @@ import dagger.Subcomponent;
|
||||
DependencyProvider.class,
|
||||
SystemUIBinder.class,
|
||||
SystemUIModule.class,
|
||||
TVSystemUICoreStartableModule.class,
|
||||
TvSystemUIModule.class,
|
||||
TvSystemUIBinder.class})
|
||||
public interface TvSysUIComponent extends SysUIComponent {
|
||||
|
||||
@@ -16,28 +16,13 @@
|
||||
|
||||
package com.android.systemui.tv;
|
||||
|
||||
import com.android.systemui.CoreStartable;
|
||||
import com.android.systemui.dagger.GlobalRootComponent;
|
||||
import com.android.systemui.statusbar.tv.VpnStatusObserver;
|
||||
import com.android.systemui.statusbar.tv.notifications.TvNotificationHandler;
|
||||
|
||||
import dagger.Binds;
|
||||
import dagger.Module;
|
||||
import dagger.multibindings.ClassKey;
|
||||
import dagger.multibindings.IntoMap;
|
||||
|
||||
@Module
|
||||
interface TvSystemUIBinder {
|
||||
@Binds
|
||||
GlobalRootComponent bindGlobalRootComponent(TvGlobalRootComponent globalRootComponent);
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(TvNotificationHandler.class)
|
||||
CoreStartable bindTvNotificationHandler(TvNotificationHandler systemui);
|
||||
|
||||
@Binds
|
||||
@IntoMap
|
||||
@ClassKey(VpnStatusObserver.class)
|
||||
CoreStartable bindVpnStatusObserver(VpnStatusObserver systemui);
|
||||
}
|
||||
|
||||
@@ -46,10 +46,15 @@ import com.android.internal.R;
|
||||
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
|
||||
import com.android.systemui.CoreStartable;
|
||||
import com.android.systemui.SystemUIApplication;
|
||||
import com.android.systemui.dagger.SysUISingleton;
|
||||
import com.android.systemui.util.NotificationChannels;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
/** */
|
||||
@SysUISingleton
|
||||
public class StorageNotification extends CoreStartable {
|
||||
private static final String TAG = "StorageNotification";
|
||||
|
||||
@@ -61,6 +66,7 @@ public class StorageNotification extends CoreStartable {
|
||||
private NotificationManager mNotificationManager;
|
||||
private StorageManager mStorageManager;
|
||||
|
||||
@Inject
|
||||
public StorageNotification(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,9 @@ import com.android.wm.shell.pip.tv.TvPipNotificationController;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
// NOT Singleton. Started per-user.
|
||||
public class NotificationChannels extends CoreStartable {
|
||||
public static String ALERTS = "ALR";
|
||||
public static String SCREENSHOTS_HEADSUP = "SCN_HEADSUP";
|
||||
@@ -38,6 +41,7 @@ public class NotificationChannels extends CoreStartable {
|
||||
public static String TVPIP = TvPipNotificationController.NOTIFICATION_CHANNEL; // "TVPIP"
|
||||
public static String HINTS = "HNT";
|
||||
|
||||
@Inject
|
||||
public NotificationChannels(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class DumpHandlerTest : SysuiTestCase() {
|
||||
fun setUp() {
|
||||
MockitoAnnotations.initMocks(this)
|
||||
|
||||
dumpHandler = DumpHandler(mContext, dumpManager, logBufferEulogizer)
|
||||
dumpHandler = DumpHandler(mContext, dumpManager, logBufferEulogizer, mutableMapOf())
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user