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

Commit f1fb9e7f authored by Winson's avatar Winson
Browse files

Use correct actor string for OverlayableInfo

Need to use second, which is the actual value. Was using
the key and thus the overlayable name and tests were
failing trying to validate against this invalid actor
string.

Also moved NO_NAMED_ACTORS failure down a step, as that
was masking the core issue.

Also adds the missing overlay tests to the
com.android.server.om TEST_MAPPING. The imports tag
was not used to avoid importing all of the core tests.

Bug: 145923978

Test: atest android.appsecurity.cts.OverlayHostTest

Change-Id: I9cb790cf8966e7eaf7554feccf960a3debb1a0c3
parent b6a5575a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -221,7 +221,7 @@ static jobject NativeGetOverlayableInfo(JNIEnv* env, jclass /*clazz*/, jlong ptr
    return nullptr;
  }

  jstring actor_string = env->NewStringUTF(actor->first.c_str());
  jstring actor_string = env->NewStringUTF(actor->second.c_str());
  if (env->ExceptionCheck() || actor_string == nullptr) {
    jniThrowException(env, "java/io/IOException", "Error reading overlayable from APK");
    return 0;
+4 −4
Original line number Diff line number Diff line
@@ -53,10 +53,6 @@ public class OverlayActorEnforcer {
     */
    static Pair<String, ActorState> getPackageNameForActor(String actorUriString,
            Map<String, Map<String, String>> namedActors) {
        if (namedActors.isEmpty()) {
            return Pair.create(null, ActorState.NO_NAMED_ACTORS);
        }

        Uri actorUri = Uri.parse(actorUriString);

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

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

        String actorNamespace = actorUri.getAuthority();
        Map<String, String> namespace = namedActors.get(actorNamespace);
        if (namespace == null) {
+14 −0
Original line number Diff line number Diff line
@@ -7,6 +7,20 @@
          "include-filter": "com.android.server.om."
        }
      ]
    },
    {
      "name": "OverlayDeviceTests"
    },
    {
      "name": "OverlayHostTests"
    },
    {
      "name": "CtsAppSecurityHostTestCases",
      "options": [
        {
          "include-filter": "android.appsecurity.cts.OverlayHostTest"
        }
      ]
    }
  ]
}