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

Commit 5cd7b27c authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[res] Skip all actor logic when no actors are defined" into main

parents 8d22a50c 9cd2aaf9
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -50,6 +50,10 @@ public class OverlayActorEnforcer {
     */
     */
    static Pair<String, ActorState> getPackageNameForActor(@NonNull String actorUriString,
    static Pair<String, ActorState> getPackageNameForActor(@NonNull String actorUriString,
            @NonNull Map<String, Map<String, String>> namedActors) {
            @NonNull Map<String, Map<String, String>> namedActors) {
        if (namedActors.isEmpty()) {
            return Pair.create(null, ActorState.NO_NAMED_ACTORS);
        }

        Uri actorUri = Uri.parse(actorUriString);
        Uri actorUri = Uri.parse(actorUriString);


        String actorScheme = actorUri.getScheme();
        String actorScheme = actorUri.getScheme();
@@ -58,10 +62,6 @@ public class OverlayActorEnforcer {
            return Pair.create(null, ActorState.INVALID_OVERLAYABLE_ACTOR_NAME);
            return Pair.create(null, ActorState.INVALID_OVERLAYABLE_ACTOR_NAME);
        }
        }


        if (namedActors.isEmpty()) {
            return Pair.create(null, ActorState.NO_NAMED_ACTORS);
        }

        String actorNamespace = actorUri.getAuthority();
        String actorNamespace = actorUri.getAuthority();
        Map<String, String> namespace = namedActors.get(actorNamespace);
        Map<String, String> namespace = namedActors.get(actorNamespace);
        if (ArrayUtils.isEmpty(namespace)) {
        if (ArrayUtils.isEmpty(namespace)) {
+2 −0
Original line number Original line Diff line number Diff line
@@ -196,6 +196,8 @@ class OverlayActorEnforcerTests {
                },
                },
                ActorState.INVALID_OVERLAYABLE_ACTOR_NAME withCases {
                ActorState.INVALID_OVERLAYABLE_ACTOR_NAME withCases {
                    fun TestState.mockActor(actorUri: String) {
                    fun TestState.mockActor(actorUri: String) {
                        namedActorsMap = mapOf(VALID_NAMESPACE to
                                mapOf(VALID_ACTOR_NAME to VALID_ACTOR_PKG))
                        targetOverlayableInfo = OverlayableInfo(OVERLAYABLE_NAME, actorUri)
                        targetOverlayableInfo = OverlayableInfo(OVERLAYABLE_NAME, actorUri)
                    }
                    }
                    failure("wrongScheme") {
                    failure("wrongScheme") {