Use cid=0 to mean not specified
We're using -1 (VMADDR_CID_ANY) as a special value to mean "use
composd rather than directly connecting to a specific CID". So we
can't also use it to mean "no CID was specified, run dex2oat
directly".
The value 0 is never valid as a CID, since it's reserved as
VMADDR_CID_HYPERVISOR.
Eventually the CID parameter can just go away, and we'll have a
boolean for use composd in a VM / normal no VM.
Bug: 202696349
Test: atest ComposTestCase
Test: adb shell apex/com.android.compos/bin/composd_cmd
Test: Manually verify compilation runs in the VM.
Change-Id: I11a4814481576a62294701ed2bb2f75808a4ef71
diff --git a/odrefresh/odr_config.h b/odrefresh/odr_config.h
index 1fd1900..253bd49 100644
--- a/odrefresh/odr_config.h
+++ b/odrefresh/odr_config.h
@@ -53,7 +53,7 @@
std::string program_name_;
std::string system_server_classpath_;
ZygoteKind zygote_kind_;
- int compilation_os_address_ = -1;
+ int compilation_os_address_ = 0;
std::string boot_classpath_;
// Staging directory for artifacts. The directory must exist and will be automatically removed
@@ -123,7 +123,7 @@
const std::string& GetSystemServerClasspath() const {
return system_server_classpath_;
}
- bool UseCompilationOs() const { return compilation_os_address_ >= 0; }
+ bool UseCompilationOs() const { return compilation_os_address_ != 0; }
int GetCompilationOsAddress() const { return compilation_os_address_; }
const std::string& GetStagingDir() const {
return staging_dir_;