[API] Use vm_payload API in microdroid benchmark tests
Bug: 243512047
Test: atest MicrodroidBenchmarks
Change-Id: I8a894868eaeb79cc78e88d164e4a3c651c967141
diff --git a/tests/benchmark/Android.bp b/tests/benchmark/Android.bp
index acd0f09..e3f4685 100644
--- a/tests/benchmark/Android.bp
+++ b/tests/benchmark/Android.bp
@@ -46,6 +46,7 @@
"libbinder_ndk",
"libbinder_rpc_unstable",
"liblog",
+ "libvm_payload",
],
}
diff --git a/tests/benchmark/src/native/benchmarkbinary.cpp b/tests/benchmark/src/native/benchmarkbinary.cpp
index 8694ef9..36784b9 100644
--- a/tests/benchmark/src/native/benchmarkbinary.cpp
+++ b/tests/benchmark/src/native/benchmarkbinary.cpp
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <time.h>
#include <unistd.h>
+#include <vm_payload.h>
#include <binder_rpc_unstable.hpp>
#include <fstream>
@@ -157,19 +158,8 @@
Result<void> run_io_benchmark_tests() {
auto test_service = ndk::SharedRefBase::make<IOBenchmarkService>();
auto callback = []([[maybe_unused]] void* param) {
- // Tell microdroid_manager that we're ready.
- // If we can't, abort in order to fail fast - the host won't proceed without
- // receiving the onReady signal.
- ndk::SpAIBinder binder(
- RpcClient(VMADDR_CID_HOST, IVirtualMachineService::VM_BINDER_SERVICE_PORT));
- auto vm_service = IVirtualMachineService::fromBinder(binder);
- if (vm_service == nullptr) {
- LOG(ERROR) << "failed to connect VirtualMachineService\n";
- abort();
- }
- if (auto status = vm_service->notifyPayloadReady(); !status.isOk()) {
- LOG(ERROR) << "failed to notify payload ready to virtualizationservice: "
- << status.getDescription();
+ if (!notify_payload_ready()) {
+ LOG(ERROR) << "failed to notify payload ready to virtualizationservice";
abort();
}
};