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 ca775941f3)

Change-Id: I04d195c12def4bf1136ed8c6b3dc439b640de7b2
This commit is contained in:
Andreas Gampe
2014-11-18 11:48:22 -08:00
committed by Jeff Hao
parent 8f7b84e037
commit cd9c6f508f

View File

@@ -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");