summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2014-11-18 11:48:22 -0800
committerJeff Hao <jeffhao@google.com>2014-11-18 15:14:06 -0800
commitcd9c6f508f99bdadab2a7c397c38c47f05e9cb7c (patch)
tree096a74d07f681ade0d2a1b753f87028ea89c2ce1
parent8f7b84e037e35db9d3b46873bc1adf712b307cbe (diff)
Frameworks/base: Compiled-classes support
Let AndroidRuntime check for /system/etc/compiled-classes and push it to the runtime for boot image creation. Bug: 18410571 (cherry picked from commit ca775941f3b7981aabf3a6a3b84d6c94f4f76aff) Change-Id: I04d195c12def4bf1136ed8c6b3dc439b640de7b2
-rw-r--r--core/jni/AndroidRuntime.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 1f4105fdca98..3275730124a7 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -356,6 +356,15 @@ static int hasDir(const char* dir)
return 0;
}
+static bool hasFile(const char* file) {
+ struct stat s;
+ int res = stat(file, &s);
+ if (res == 0) {
+ return S_ISREG(s.st_mode);
+ }
+ return false;
+}
+
/*
* Read the persistent locale.
*/
@@ -772,6 +781,13 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv)
addOption("--image-classes-zip=/system/framework/framework.jar");
addOption("-Ximage-compiler-option");
addOption("--image-classes=preloaded-classes");
+
+ // If there is a compiled-classes file, push it.
+ if (hasFile("/system/etc/compiled-classes")) {
+ addOption("-Ximage-compiler-option");
+ addOption("--compiled-classes=/system/etc/compiled-classes");
+ }
+
property_get("dalvik.vm.image-dex2oat-flags", dex2oatImageFlagsBuf, "");
parseExtraOpts(dex2oatImageFlagsBuf, "-Ximage-compiler-option");