Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b6faddb5 authored by Alejandro Nijamkin's avatar Alejandro Nijamkin
Browse files

Changes CoreStartable Dependencies to use Class.

The use of Class<CoreStartable> didn't work for cases where the root
class in the hierarchy which needs to be used as key didn't itself
extends CoreStartable, like in the next CL.

Bug: 332956676
Test: SysUIApplicationTest still passes
Test: manually verified that the crash in the bug no longer occurs after
the next CL
Flag: N/A

Change-Id: I98ad3af31b84e34a126486644ca77c5dcdbc471d
parent 18235e5f
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -300,7 +300,7 @@ public class SystemUIApplication extends Application implements

                Class<?> cls = entry.getKey();
                Dependencies dep = cls.getAnnotation(Dependencies.class);
                Class<? extends CoreStartable>[] deps = (dep == null ? null : dep.value());
                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.
@@ -324,7 +324,7 @@ public class SystemUIApplication extends Application implements
                Map.Entry<Class<?>, Provider<CoreStartable>> entry = nextQueue.removeFirst();
                Class<?> cls = entry.getKey();
                Dependencies dep = cls.getAnnotation(Dependencies.class);
                Class<? extends CoreStartable>[] deps = (dep == null ? null : dep.value());
                Class<?>[] deps = (dep == null ? null : dep.value());
                StringJoiner stringJoiner = new StringJoiner(", ");
                for (int i = 0; deps != null && i < deps.length; i++) {
                    if (!startedStartables.contains(deps[i])) {
+1 −1
Original line number Diff line number Diff line
@@ -27,4 +27,4 @@ import kotlin.reflect.KClass
@MustBeDocumented
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
annotation class Dependencies(vararg val value: KClass<out CoreStartable> = [])
annotation class Dependencies(vararg val value: KClass<*> = [])