Libcore: Expose compilation filter in DexFile
To allow checking the state of a dex file wrt/ compilation modes,
expose methods to check compiler filter strings and extend the
signature of getDexOptNeeded.
Bug: 27689078
(cherry picked from commit 643e8cb87528bb6479eb7f25120fc11de3e4a9b3)
Change-Id: I06b9d75f58c59cb07ef5170f784ea6745168efaa
diff --git a/dalvik/src/main/java/dalvik/system/DexFile.java b/dalvik/src/main/java/dalvik/system/DexFile.java
index 050688c..1d33339 100644
--- a/dalvik/src/main/java/dalvik/system/DexFile.java
+++ b/dalvik/src/main/java/dalvik/system/DexFile.java
@@ -437,39 +437,31 @@
*/
public static final int SELF_PATCHOAT_NEEDED = 3;
-
/**
- * See {@link #getDexOptNeeded(String, String, int)}.
+ * Returns whether the given filter is a valid filter.
*
* @hide
*/
- public static final int COMPILATION_TYPE_FULL = 1;
+ public native static boolean isValidCompilerFilter(String filter);
/**
- * See {@link #getDexOptNeeded(String, String, int)}.
+ * Returns whether the given filter is based on profiles.
*
* @hide
*/
- public static final int COMPILATION_TYPE_PROFILE_GUIDE = 2;
-
- /**
- * See {@link #getDexOptNeeded(String, String, int)}.
- *
- * @hide
- */
- public static final int COMPILATION_TYPE_EXTRACT_ONLY = 4;
+ public native static boolean isProfileGuidedCompilerFilter(String filter);
/**
* Returns the VM's opinion of what kind of dexopt is needed to make the
- * apk/jar file up to date, where {@code targetCompilationTypeMask} is used
- * to indicate what type of compilation the caller considers up-to-date.
+ * apk/jar file up to date, where {@code targetMode} is used to indicate what
+ * type of compilation the caller considers up-to-date, and {@code newProfile}
+ * is used to indicate whether profile information has changed recently.
*
* @param fileName the absolute path to the apk/jar file to examine.
- * @param targeCompilationTypeMask a mask of compilation types that he
- * caller considers up-to-date:
- * COMPILATION_TYPE_FULL - the apk is fully compiled.
- * COMPILATION_TYPE_PROFILE_GUIDE - the apk is profile guide compiled.
- * COMPILATION_TYPE_EXTRACT_ONLY - the apk is extracted but not compiled.
+ * @param compilerFilter a compiler filter to use for what a caller considers up-to-date.
+ * @param newProfile flag that describes whether a profile corresponding
+ * to the dex file has been recently updated and should be considered
+ * in the state of the file.
* @return NO_DEXOPT_NEEDED if the apk/jar is already up to date.
* DEX2OAT_NEEDED if dex2oat should be called on the apk/jar file.
* PATCHOAT_NEEDED if patchoat should be called on the apk/jar
@@ -485,6 +477,6 @@
* @hide
*/
public static native int getDexOptNeeded(String fileName,
- String instructionSet, int targetCompilationTypeMask)
+ String instructionSet, String compilerFilter, boolean newProfile)
throws FileNotFoundException, IOException;
}