Merge "[installd] Add check that classpath is up to date to getDexOptNeeded" am: 074635249a
am: 57cae5a3ea
Change-Id: Ice6c5f2012b9e7daffacafc7f01e1b32f77fa061
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp
index 6a7d845..4bb8ebe 100644
--- a/cmds/installd/dexopt.cpp
+++ b/cmds/installd/dexopt.cpp
@@ -1365,7 +1365,8 @@
// If this is for a profile guided compilation, profile_was_updated will tell whether or not
// the profile has changed.
static void exec_dexoptanalyzer(const std::string& dex_file, const std::string& instruction_set,
- const std::string& compiler_filter, bool profile_was_updated, bool downgrade) {
+ const std::string& compiler_filter, bool profile_was_updated, bool downgrade,
+ const char* class_loader_context) {
const char* dexoptanalyzer_bin =
is_debug_runtime()
? "/system/bin/dexoptanalyzerd"
@@ -1383,11 +1384,16 @@
std::string compiler_filter_arg = "--compiler-filter=" + compiler_filter;
const char* assume_profile_changed = "--assume-profile-changed";
const char* downgrade_flag = "--downgrade";
+ std::string class_loader_context_arg = "--class-loader-context=";
+ if (class_loader_context != nullptr) {
+ class_loader_context_arg += class_loader_context;
+ }
// program name, dex file, isa, filter, the final NULL
const int argc = 5 +
(profile_was_updated ? 1 : 0) +
- (downgrade ? 1 : 0);
+ (downgrade ? 1 : 0) +
+ (class_loader_context != nullptr ? 1 : 0);
const char* argv[argc];
int i = 0;
argv[i++] = dexoptanalyzer_bin;
@@ -1400,6 +1406,9 @@
if (downgrade) {
argv[i++] = downgrade_flag;
}
+ if (class_loader_context != nullptr) {
+ argv[i++] = class_loader_context;
+ }
argv[i] = NULL;
execv(dexoptanalyzer_bin, (char * const *)argv);
@@ -1480,7 +1489,8 @@
static bool process_secondary_dex_dexopt(const char* original_dex_path, const char* pkgname,
int dexopt_flags, const char* volume_uuid, int uid, const char* instruction_set,
const char* compiler_filter, bool* is_public_out, int* dexopt_needed_out,
- std::string* oat_dir_out, std::string* dex_path_out, bool downgrade) {
+ std::string* oat_dir_out, std::string* dex_path_out, bool downgrade,
+ const char* class_loader_context) {
int storage_flag;
if ((dexopt_flags & DEXOPT_STORAGE_CE) != 0) {
@@ -1550,7 +1560,7 @@
drop_capabilities(uid);
// Run dexoptanalyzer to get dexopt_needed code.
exec_dexoptanalyzer(dex_path, instruction_set, compiler_filter, profile_was_updated,
- downgrade);
+ downgrade, class_loader_context);
exit(DEXOPTANALYZER_BIN_EXEC_ERROR);
}
@@ -1606,8 +1616,7 @@
if (is_secondary_dex) {
if (process_secondary_dex_dexopt(dex_path, pkgname, dexopt_flags, volume_uuid, uid,
instruction_set, compiler_filter, &is_public, &dexopt_needed, &oat_dir_str,
- &dex_real_path,
- downgrade)) {
+ &dex_real_path, downgrade, class_loader_context)) {
oat_dir = oat_dir_str.c_str();
dex_path = dex_real_path.c_str();
if (dexopt_needed == NO_DEXOPT_NEEDED) {