Use generated wrappers for system properties.
Bug: 216639283
Test: Set properties manually and then `atest VirtualizationTestCases`.
Change-Id: I22498d8a9783bac3004900df398a899697bb8672
diff --git a/tests/Android.bp b/tests/Android.bp
index 8cfefcc..0b3a821 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -38,6 +38,7 @@
// The existence of the library in the system partition is not guaranteed.
// Let's have our own copy of it.
"android.system.virtualizationservice-cpp",
+ "PlatformProperties",
],
shared_libs: [
"libbase",
diff --git a/tests/vsock_test.cc b/tests/vsock_test.cc
index de1387e..9550651 100644
--- a/tests/vsock_test.cc
+++ b/tests/vsock_test.cc
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <android/sysprop/HypervisorProperties.sysprop.h>
#include <linux/kvm.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
@@ -30,7 +31,6 @@
#include "android-base/file.h"
#include "android-base/logging.h"
#include "android-base/parseint.h"
-#include "android-base/properties.h"
#include "android-base/unique_fd.h"
#include "android/system/virtualizationservice/VirtualMachineConfig.h"
#include "android/system/virtualizationservice/VirtualMachineRawConfig.h"
@@ -51,12 +51,13 @@
/** Returns true if the kernel supports protected VMs. */
bool isProtectedVmSupported() {
- return GetBoolProperty("ro.boot.hypervisor.protected_vm.supported", false);
+ return android::sysprop::HypervisorProperties::hypervisor_protected_vm_supported().value_or(
+ false);
}
/** Returns true if the kernel supports unprotected VMs. */
bool isUnprotectedVmSupported() {
- return GetBoolProperty("ro.boot.hypervisor.vm.supported", false);
+ return android::sysprop::HypervisorProperties::hypervisor_vm_supported().value_or(false);
}
void runTest(sp<IVirtualizationService> virtualization_service, bool protected_vm) {