Loading packages/SystemUI/src/com/android/systemui/CoreStartable.java +2 −13 Original line number Diff line number Diff line Loading @@ -33,23 +33,12 @@ import java.io.PrintWriter; * abstract fun bind(impl: FoobarStartable): CoreStartable * </pre> * * If your CoreStartable depends on different CoreStartables starting before it, you can specify * another map binding listing out its dependencies: * <pre> * @Provides * @IntoMap * @Dependencies // Important! com.android.systemui.startable.Dependencies. * @ClassKey(FoobarStartable::class) * fun providesDeps(): Set<Class<out CoreStartable>> { * return setOf(OtherStartable::class.java) * } * </pre> * * If your CoreStartable depends on different CoreStartables starting before it, use a * {@link com.android.systemui.startable.Dependencies} annotation to list out those dependencies. * * @see SystemUIApplication#startSystemUserServicesIfNeeded() */ public interface CoreStartable extends Dumpable { String STARTABLE_DEPENDENCIES = "startable_dependencies"; /** Main entry point for implementations. Called shortly after SysUI startup. */ void start(); Loading packages/SystemUI/src/com/android/systemui/SystemUIApplication.java +10 −9 Original line number Diff line number Diff line Loading @@ -44,15 +44,16 @@ import com.android.systemui.dagger.SysUIComponent; import com.android.systemui.dump.DumpManager; import com.android.systemui.process.ProcessWrapper; import com.android.systemui.res.R; import com.android.systemui.startable.Dependencies; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.util.NotificationChannels; import java.lang.reflect.InvocationTargetException; import java.util.ArrayDeque; import java.util.Arrays; import java.util.Comparator; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.StringJoiner; import java.util.TreeMap; Loading Loading @@ -306,9 +307,9 @@ public class SystemUIApplication extends Application implements Map.Entry<Class<?>, Provider<CoreStartable>> entry = queue.removeFirst(); Class<?> cls = entry.getKey(); Set<Class<? extends CoreStartable>> deps = mSysUIComponent.getStartableDependencies().get(cls); if (deps == null || startedStartables.containsAll(deps)) { Dependencies dep = cls.getAnnotation(Dependencies.class); Class<?>[] deps = (dep == null ? null : dep.value()); if (deps == null || startedStartables.containsAll(Arrays.asList(deps))) { String clsName = cls.getName(); int i = serviceIndex; // Copied to make lambda happy. timeInitialization( Loading @@ -330,12 +331,12 @@ public class SystemUIApplication extends Application implements while (!nextQueue.isEmpty()) { Map.Entry<Class<?>, Provider<CoreStartable>> entry = nextQueue.removeFirst(); Class<?> cls = entry.getKey(); Set<Class<? extends CoreStartable>> deps = mSysUIComponent.getStartableDependencies().get(cls); Dependencies dep = cls.getAnnotation(Dependencies.class); Class<?>[] deps = (dep == null ? null : dep.value()); StringJoiner stringJoiner = new StringJoiner(", "); for (Class<? extends CoreStartable> c : deps) { if (!startedStartables.contains(c)) { stringJoiner.add(c.getName()); for (int i = 0; deps != null && i < deps.length; i++) { if (!startedStartables.contains(deps[i])) { stringJoiner.add(deps[i].getName()); } } Log.e(TAG, "Failed to start " + cls.getName() Loading packages/SystemUI/src/com/android/systemui/dagger/SysUIComponent.java +0 −7 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import com.android.systemui.dagger.qualifiers.PerUser; import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.KeyguardSliceProvider; import com.android.systemui.people.PeopleProvider; import com.android.systemui.startable.Dependencies; import com.android.systemui.statusbar.NotificationInsetsModule; import com.android.systemui.statusbar.QsFrameTranslateModule; import com.android.systemui.statusbar.policy.ConfigurationController; Loading @@ -48,7 +47,6 @@ import dagger.Subcomponent; import java.util.Map; import java.util.Optional; import java.util.Set; import javax.inject.Provider; Loading Loading @@ -161,11 +159,6 @@ public interface SysUIComponent { */ @PerUser Map<Class<?>, Provider<CoreStartable>> getPerUserStartables(); /** * Returns {@link CoreStartable} dependencies if there are any. */ @Dependencies Map<Class<?>, Set<Class<? extends CoreStartable>>> getStartableDependencies(); /** * Member injection into the supplied argument. */ Loading packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +0 −9 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import com.android.keyguard.dagger.KeyguardBouncerComponent; import com.android.systemui.BootCompleteCache; import com.android.systemui.BootCompleteCacheImpl; import com.android.systemui.CameraProtectionModule; import com.android.systemui.CoreStartable; import com.android.systemui.SystemUISecondaryUserService; import com.android.systemui.accessibility.AccessibilityModule; import com.android.systemui.accessibility.data.repository.AccessibilityRepositoryModule; Loading Loading @@ -106,7 +105,6 @@ import com.android.systemui.shade.transition.LargeScreenShadeInterpolator; import com.android.systemui.shade.transition.LargeScreenShadeInterpolatorImpl; import com.android.systemui.shared.condition.Monitor; import com.android.systemui.smartspace.dagger.SmartspaceModule; import com.android.systemui.startable.Dependencies; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationShadeWindowController; Loading Loading @@ -164,14 +162,11 @@ import dagger.Module; import dagger.Provides; import dagger.multibindings.ClassKey; import dagger.multibindings.IntoMap; import dagger.multibindings.Multibinds; import kotlinx.coroutines.CoroutineScope; import java.util.Collections; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.concurrent.Executor; import javax.inject.Named; Loading Loading @@ -275,10 +270,6 @@ import javax.inject.Named; }) public abstract class SystemUIModule { @Multibinds @Dependencies abstract Map<Class<?>, Set<Class<? extends CoreStartable>>> startableDependencyMap(); @Binds abstract BootCompleteCache bindBootCompleteCache(BootCompleteCacheImpl bootCompleteCache); Loading packages/SystemUI/src/com/android/systemui/startable/Dependencies.kt +5 −3 Original line number Diff line number Diff line Loading @@ -16,8 +16,7 @@ package com.android.systemui.startable import com.android.systemui.CoreStartable import java.lang.annotation.Documented import javax.inject.Qualifier import kotlin.reflect.KClass /** * Allows a [CoreStartable] to declare that it must be started after its dependencies. Loading @@ -25,4 +24,7 @@ import javax.inject.Qualifier * This creates a partial, topological ordering. See [com.android.systemui.SystemUIApplication] for * how this ordering is enforced at runtime. */ @Qualifier @Documented @Retention(AnnotationRetention.RUNTIME) annotation class Dependencies() @MustBeDocumented @Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.RUNTIME) annotation class Dependencies(vararg val value: KClass<*> = []) Loading
packages/SystemUI/src/com/android/systemui/CoreStartable.java +2 −13 Original line number Diff line number Diff line Loading @@ -33,23 +33,12 @@ import java.io.PrintWriter; * abstract fun bind(impl: FoobarStartable): CoreStartable * </pre> * * If your CoreStartable depends on different CoreStartables starting before it, you can specify * another map binding listing out its dependencies: * <pre> * @Provides * @IntoMap * @Dependencies // Important! com.android.systemui.startable.Dependencies. * @ClassKey(FoobarStartable::class) * fun providesDeps(): Set<Class<out CoreStartable>> { * return setOf(OtherStartable::class.java) * } * </pre> * * If your CoreStartable depends on different CoreStartables starting before it, use a * {@link com.android.systemui.startable.Dependencies} annotation to list out those dependencies. * * @see SystemUIApplication#startSystemUserServicesIfNeeded() */ public interface CoreStartable extends Dumpable { String STARTABLE_DEPENDENCIES = "startable_dependencies"; /** Main entry point for implementations. Called shortly after SysUI startup. */ void start(); Loading
packages/SystemUI/src/com/android/systemui/SystemUIApplication.java +10 −9 Original line number Diff line number Diff line Loading @@ -44,15 +44,16 @@ import com.android.systemui.dagger.SysUIComponent; import com.android.systemui.dump.DumpManager; import com.android.systemui.process.ProcessWrapper; import com.android.systemui.res.R; import com.android.systemui.startable.Dependencies; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.util.NotificationChannels; import java.lang.reflect.InvocationTargetException; import java.util.ArrayDeque; import java.util.Arrays; import java.util.Comparator; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.StringJoiner; import java.util.TreeMap; Loading Loading @@ -306,9 +307,9 @@ public class SystemUIApplication extends Application implements Map.Entry<Class<?>, Provider<CoreStartable>> entry = queue.removeFirst(); Class<?> cls = entry.getKey(); Set<Class<? extends CoreStartable>> deps = mSysUIComponent.getStartableDependencies().get(cls); if (deps == null || startedStartables.containsAll(deps)) { Dependencies dep = cls.getAnnotation(Dependencies.class); Class<?>[] deps = (dep == null ? null : dep.value()); if (deps == null || startedStartables.containsAll(Arrays.asList(deps))) { String clsName = cls.getName(); int i = serviceIndex; // Copied to make lambda happy. timeInitialization( Loading @@ -330,12 +331,12 @@ public class SystemUIApplication extends Application implements while (!nextQueue.isEmpty()) { Map.Entry<Class<?>, Provider<CoreStartable>> entry = nextQueue.removeFirst(); Class<?> cls = entry.getKey(); Set<Class<? extends CoreStartable>> deps = mSysUIComponent.getStartableDependencies().get(cls); Dependencies dep = cls.getAnnotation(Dependencies.class); Class<?>[] deps = (dep == null ? null : dep.value()); StringJoiner stringJoiner = new StringJoiner(", "); for (Class<? extends CoreStartable> c : deps) { if (!startedStartables.contains(c)) { stringJoiner.add(c.getName()); for (int i = 0; deps != null && i < deps.length; i++) { if (!startedStartables.contains(deps[i])) { stringJoiner.add(deps[i].getName()); } } Log.e(TAG, "Failed to start " + cls.getName() Loading
packages/SystemUI/src/com/android/systemui/dagger/SysUIComponent.java +0 −7 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import com.android.systemui.dagger.qualifiers.PerUser; import com.android.systemui.dump.DumpManager; import com.android.systemui.keyguard.KeyguardSliceProvider; import com.android.systemui.people.PeopleProvider; import com.android.systemui.startable.Dependencies; import com.android.systemui.statusbar.NotificationInsetsModule; import com.android.systemui.statusbar.QsFrameTranslateModule; import com.android.systemui.statusbar.policy.ConfigurationController; Loading @@ -48,7 +47,6 @@ import dagger.Subcomponent; import java.util.Map; import java.util.Optional; import java.util.Set; import javax.inject.Provider; Loading Loading @@ -161,11 +159,6 @@ public interface SysUIComponent { */ @PerUser Map<Class<?>, Provider<CoreStartable>> getPerUserStartables(); /** * Returns {@link CoreStartable} dependencies if there are any. */ @Dependencies Map<Class<?>, Set<Class<? extends CoreStartable>>> getStartableDependencies(); /** * Member injection into the supplied argument. */ Loading
packages/SystemUI/src/com/android/systemui/dagger/SystemUIModule.java +0 −9 Original line number Diff line number Diff line Loading @@ -29,7 +29,6 @@ import com.android.keyguard.dagger.KeyguardBouncerComponent; import com.android.systemui.BootCompleteCache; import com.android.systemui.BootCompleteCacheImpl; import com.android.systemui.CameraProtectionModule; import com.android.systemui.CoreStartable; import com.android.systemui.SystemUISecondaryUserService; import com.android.systemui.accessibility.AccessibilityModule; import com.android.systemui.accessibility.data.repository.AccessibilityRepositoryModule; Loading Loading @@ -106,7 +105,6 @@ import com.android.systemui.shade.transition.LargeScreenShadeInterpolator; import com.android.systemui.shade.transition.LargeScreenShadeInterpolatorImpl; import com.android.systemui.shared.condition.Monitor; import com.android.systemui.smartspace.dagger.SmartspaceModule; import com.android.systemui.startable.Dependencies; import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationShadeWindowController; Loading Loading @@ -164,14 +162,11 @@ import dagger.Module; import dagger.Provides; import dagger.multibindings.ClassKey; import dagger.multibindings.IntoMap; import dagger.multibindings.Multibinds; import kotlinx.coroutines.CoroutineScope; import java.util.Collections; import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.concurrent.Executor; import javax.inject.Named; Loading Loading @@ -275,10 +270,6 @@ import javax.inject.Named; }) public abstract class SystemUIModule { @Multibinds @Dependencies abstract Map<Class<?>, Set<Class<? extends CoreStartable>>> startableDependencyMap(); @Binds abstract BootCompleteCache bindBootCompleteCache(BootCompleteCacheImpl bootCompleteCache); Loading
packages/SystemUI/src/com/android/systemui/startable/Dependencies.kt +5 −3 Original line number Diff line number Diff line Loading @@ -16,8 +16,7 @@ package com.android.systemui.startable import com.android.systemui.CoreStartable import java.lang.annotation.Documented import javax.inject.Qualifier import kotlin.reflect.KClass /** * Allows a [CoreStartable] to declare that it must be started after its dependencies. Loading @@ -25,4 +24,7 @@ import javax.inject.Qualifier * This creates a partial, topological ordering. See [com.android.systemui.SystemUIApplication] for * how this ordering is enforced at runtime. */ @Qualifier @Documented @Retention(AnnotationRetention.RUNTIME) annotation class Dependencies() @MustBeDocumented @Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.RUNTIME) annotation class Dependencies(vararg val value: KClass<*> = [])