Control use of dex2oat64 by device property
Gate use of 64-bit dex2oat by device property.
Bug: 153380900
Test: atest -c installd_dexopt_test
Change-Id: I103e0079ea5e54d0c5657ccb5db7c95adbda106c
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp
index 9566cf6..3c04435 100644
--- a/cmds/installd/dexopt.cpp
+++ b/cmds/installd/dexopt.cpp
@@ -429,8 +429,17 @@
MapPropertyToArg("dalvik.vm.dex2oat-very-large", "--very-large-app-threshold=%s");
+
+ // Decide whether to use dex2oat64.
+ bool use_dex2oat64 = false;
+ // Check whether the device even supports 64-bit ABIs.
+ if (!GetProperty("ro.product.cpu.abilist64", "").empty()) {
+ use_dex2oat64 = GetBoolProperty("dalvik.vm.dex2oat64.enabled", false);
+ }
const char* dex2oat_bin = select_execution_binary(
- kDex2oatPath, kDex2oatDebugPath, background_job_compile);
+ (use_dex2oat64 ? kDex2oat64Path : kDex2oat32Path),
+ (use_dex2oat64 ? kDex2oatDebug64Path : kDex2oatDebug32Path),
+ background_job_compile);
bool generate_minidebug_info = kEnableMinidebugInfo &&
GetBoolProperty(kMinidebugInfoSystemProperty, kMinidebugInfoSystemPropertyDefault);