From 70a89c0f0274ac033785079673ca690ee056eb59 Mon Sep 17 00:00:00 2001 From: Alex Light Date: Fri, 18 Jul 2014 15:19:22 -0700 Subject: Make system use patchoat to relocate during runtime. Change DexFile.isDexOptNeededInternal to new signature so that we can determine if we need to run patchoat. Added constants for each of the different outcomes of isDexOptNeededInternal. Bug: 15358152 Change-Id: Ibe92d8b55a24bbf718b0416a21b76e5df7a2de26 --- dalvik/src/main/java/dalvik/system/DexFile.java | 43 +++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'dalvik') diff --git a/dalvik/src/main/java/dalvik/system/DexFile.java b/dalvik/src/main/java/dalvik/system/DexFile.java index 8c78312..3965b81 100644 --- a/dalvik/src/main/java/dalvik/system/DexFile.java +++ b/dalvik/src/main/java/dalvik/system/DexFile.java @@ -309,9 +309,48 @@ public final class DexFile { throws FileNotFoundException, IOException; /** + * See {@link #isDexOptNeededInternal(String, String, String, boolean)}. + * + * @hide + */ + public static final byte UP_TO_DATE = 0; + + /** + * See {@link #isDexOptNeededInternal(String, String, String, boolean)}. + * + * @hide + */ + public static final byte PATCHOAT_NEEDED = 1; + + /** + * See {@link #isDexOptNeededInternal(String, String, String, boolean)}. + * + * @hide + */ + public static final byte DEXOPT_NEEDED = 2; + + /** + * Returns UP_TO_DATE if the VM believes that the apk/jar file + * is up to date, PATCHOAT_NEEDED if it believes that the file is up + * to date but it must be relocated to match the base address offset, + * and DEXOPT_NEEDED if it believes that it is out of date and should + * be passed through "dexopt" again. + * + * @param fileName the absolute path to the apk/jar file to examine. + * @return DEXOPT_NEEDED if dexopt should be called on the file, + * PATCHOAT_NEEDED if we need to run "patchoat" on it and + * UP_TO_DATE otherwise. + * @throws java.io.FileNotFoundException if fileName is not readable, + * not a file, or not present. + * @throws java.io.IOException if fileName is not a valid apk/jar file or + * if problems occur while parsing it. + * @throws java.lang.NullPointerException if fileName is null. + * @throws dalvik.system.StaleDexCacheError if the optimized dex file + * is stale but exists on a read-only partition. + * * @hide - **/ - public static native boolean isDexOptNeededInternal(String fileName, String pkgname, + */ + public static native byte isDexOptNeededInternal(String fileName, String pkgname, String instructionSet, boolean defer) throws FileNotFoundException, IOException; } -- cgit v1.1