Make dumpstate HAL lazy.
Bug: 78509314
Test: HAL isn't running
Test: adb bugreport HAL runs
Test: HAL isn't running after bugreport finishes
Test: manually inspect state using `lshal` and logs
using `adb logcat | grep android.hardware.dump`
(cherry picked from commit 711b806727c85d91cf805db4f78b4a9609e2bf43)
Change-Id: Ic48c2f4cc5abaa641e331a07af2d5d75c692b01b
diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp
index 5174e79..a7d6155 100755
--- a/dumpstate/DumpstateDevice.cpp
+++ b/dumpstate/DumpstateDevice.cpp
@@ -21,7 +21,9 @@
#include <android-base/properties.h>
#include <android-base/unique_fd.h>
#include <cutils/properties.h>
+#include <hidl/HidlBinderSupport.h>
#include <libgen.h>
+
#include <log/log.h>
#include <stdlib.h>
#include <string>
@@ -115,6 +117,11 @@
// Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.
Return<void> DumpstateDevice::dumpstateBoard(const hidl_handle& handle) {
+ // Exit when dump is completed since this is a lazy HAL.
+ addPostCommandTask([]() {
+ exit(0);
+ });
+
if (handle == nullptr || handle->numFds < 1) {
ALOGE("no FDs\n");
return Void();
diff --git a/dumpstate/android.hardware.dumpstate@1.0-service.marlin.rc b/dumpstate/android.hardware.dumpstate@1.0-service.marlin.rc
index 4ae80be..2299a69 100644
--- a/dumpstate/android.hardware.dumpstate@1.0-service.marlin.rc
+++ b/dumpstate/android.hardware.dumpstate@1.0-service.marlin.rc
@@ -3,3 +3,5 @@
user system
group system
interface android.hardware.dumpstate@1.0::IDumpstateDevice default
+ oneshot
+ disabled