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

Commit 7cfbff64 authored by Ryan Mitchell's avatar Ryan Mitchell Committed by Automerger Merge Worker
Browse files

Merge changes from topic "invalidate_idmap" into rvc-dev am: 6cb79cdf

Change-Id: I8e4b6280fcfc2623f982f9ea3bb3f0349d05482c
parents 500f7931 6cb79cdf
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -3,5 +3,10 @@
    {
      "name" : "idmap2_tests"
    }
  ],
  "imports": [
    {
      "path": "frameworks/base/services/core/java/com/android/server/om"
    }
  ]
}
+6 −0
Original line number Diff line number Diff line
@@ -149,15 +149,21 @@ Status Idmap2Service::createIdmap(const std::string& target_apk_path,
    return error(idmap.GetErrorMessage());
  }

  // idmap files are mapped with mmap in libandroidfw. Deleting and recreating the idmap guarantees
  // that existing memory maps will continue to be valid and unaffected.
  unlink(idmap_path.c_str());

  umask(kIdmapFilePermissionMask);
  std::ofstream fout(idmap_path);
  if (fout.fail()) {
    return error("failed to open idmap path " + idmap_path);
  }

  BinaryStreamVisitor visitor(fout);
  (*idmap)->accept(&visitor);
  fout.close();
  if (fout.fail()) {
    unlink(idmap_path.c_str());
    return error("failed to write to idmap path " + idmap_path);
  }

+2 −2
Original line number Diff line number Diff line
@@ -344,7 +344,7 @@ public class ResourcesManager {
        ApkAssets apkAssets = null;
        if (mLoadedApkAssets != null) {
            apkAssets = mLoadedApkAssets.get(newKey);
            if (apkAssets != null) {
            if (apkAssets != null && apkAssets.isUpToDate()) {
                return apkAssets;
            }
        }
@@ -353,7 +353,7 @@ public class ResourcesManager {
        final WeakReference<ApkAssets> apkAssetsRef = mCachedApkAssets.get(newKey);
        if (apkAssetsRef != null) {
            apkAssets = apkAssetsRef.get();
            if (apkAssets != null) {
            if (apkAssets != null && apkAssets.isUpToDate()) {
                if (mLoadedApkAssets != null) {
                    mLoadedApkAssets.put(newKey, apkAssets);
                }
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ java_test_host {
    name: "OverlayHostTests",
    srcs: ["src/**/*.java"],
    libs: ["tradefed"],
    test_suites: ["general-tests"],
    test_suites: ["device-tests"],
    target_required: [
        "OverlayHostTests_NonPlatformSignatureOverlay",
        "OverlayHostTests_PlatformSignatureStaticOverlay",
+7 −8
Original line number Diff line number Diff line
@@ -78,14 +78,9 @@ public class InstallOverlayTests extends BaseHostJUnit4Test {
    }

    @Test
    public void failToInstallPlatformSignedStaticOverlay() throws Exception {
        try {
    public void installedIsStaticOverlayIsMutable() throws Exception {
        installPackage("OverlayHostTests_PlatformSignatureStaticOverlay.apk");
            fail("installed a static overlay");
        } catch (Exception e) {
            // Expected.
        }
        assertFalse(overlayManagerContainsPackage(SIG_OVERLAY_PACKAGE_NAME));
        assertTrue(isOverlayMutable(SIG_OVERLAY_PACKAGE_NAME));
    }

    @Test
@@ -229,6 +224,10 @@ public class InstallOverlayTests extends BaseHostJUnit4Test {
        return shell("cmd overlay list").contains(pkg);
    }

    private boolean isOverlayMutable(String pkg) throws Exception {
        return shell("cmd overlay dump ismutable " + pkg).contains("true");
    }

    private String shell(final String cmd) throws Exception {
        return getDevice().executeShellCommand(cmd);
    }
Loading