Loading cmds/idmap2/TEST_MAPPING +5 −0 Original line number Diff line number Diff line Loading @@ -3,5 +3,10 @@ { "name" : "idmap2_tests" } ], "imports": [ { "path": "frameworks/base/services/core/java/com/android/server/om" } ] } cmds/idmap2/idmap2d/Idmap2Service.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -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); } Loading core/java/android/app/ResourcesManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -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; } } Loading @@ -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); } Loading core/tests/overlaytests/host/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -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", Loading core/tests/overlaytests/host/src/com/android/server/om/hosttest/InstallOverlayTests.java +7 −8 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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 Loading
cmds/idmap2/TEST_MAPPING +5 −0 Original line number Diff line number Diff line Loading @@ -3,5 +3,10 @@ { "name" : "idmap2_tests" } ], "imports": [ { "path": "frameworks/base/services/core/java/com/android/server/om" } ] }
cmds/idmap2/idmap2d/Idmap2Service.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -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); } Loading
core/java/android/app/ResourcesManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -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; } } Loading @@ -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); } Loading
core/tests/overlaytests/host/Android.bp +1 −1 Original line number Diff line number Diff line Loading @@ -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", Loading
core/tests/overlaytests/host/src/com/android/server/om/hosttest/InstallOverlayTests.java +7 −8 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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