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

Commit 0503fa56 authored by Ryan Mitchell's avatar Ryan Mitchell
Browse files

Do not fail idmap scan if one idmap fails to generate

If one static overlay fails to have its idmap generated, continue
scanning other overlays.

Bug: 130324774
Test: idmap2_tests and manual
Change-Id: I06a74c844ebc81dcfb5b50e8c9a30a68c7e4ffb0
parent 52e1f7a1
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -210,7 +210,9 @@ Result<Unit> Scan(const std::vector<std::string>& args) {

      const auto create_ok = Create(create_args);
      if (!create_ok) {
        return Error(create_ok.GetError(), "failed to create idmap");
        LOG(WARNING) << "failed to create idmap for overlay apk path \"" << overlay.apk_path
                     << "\": " << create_ok.GetError().GetMessage();
        continue;
      }
    }

+18 −0
Original line number Diff line number Diff line
@@ -261,6 +261,24 @@ TEST_F(Idmap2BinaryTests, Scan) {
  ASSERT_THAT(result, NotNull());
  ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr;
  ASSERT_EQ(result->stdout, "");

  // the signature idmap failing to generate should not cause scanning to fail
  // clang-format off
  result = ExecuteBinary({"idmap2",
                          "scan",
                          "--input-directory", GetTestDataPath(),
                          "--recursive",
                          "--target-package-name", "test.target",
                          "--target-apk-path", GetTargetApkPath(),
                          "--output-directory", GetTempDirPath(),
                          "--override-policy", "public"});
  // clang-format on
  ASSERT_THAT(result, NotNull());
  ASSERT_EQ(result->status, EXIT_SUCCESS) << result->stderr;
  ASSERT_EQ(result->stdout, expected.str());
  unlink(idmap_static_no_name_path.c_str());
  unlink(idmap_static_2_path.c_str());
  unlink(idmap_static_1_path.c_str());
}

TEST_F(Idmap2BinaryTests, Lookup) {
+3 −1
Original line number Diff line number Diff line
@@ -19,5 +19,7 @@
    <application android:hasCode="false"/>
    <overlay
        android:targetPackage="test.target"
        android:targetName="TestResources"/>
        android:targetName="TestResources"
        android:isStatic="true"
        android:priority="10"/>
</manifest>