comply with VTS requirements
Bug: 275142299
Test:
atest VtsHalDumpstateTargetTest:PerInstanceAndMode/DumpstateAidlPerModeTest#TestOk/0_android_hardware_dumpstate_IDumpstateDevice_default_FULL
atest VtsHalDumpstateTargetTest:PerInstance/DumpstateAidlGeneralTest#TestInvalidModeArgument_Negative/0_android_hardware_dumpstate_IDumpstateDevice_default
Built pass on target-userdebug and aosp_target-userdebug
Change-Id: I0cf742fa15649899757ef80bd240948ae2aa66a3
diff --git a/gear/dumpstate/Dumpstate.cpp b/gear/dumpstate/Dumpstate.cpp
index 1e4d982..8abc237 100644
--- a/gear/dumpstate/Dumpstate.cpp
+++ b/gear/dumpstate/Dumpstate.cpp
@@ -154,7 +154,11 @@
int64_t in_timeoutMillis) {
// Unused arguments.
(void) in_timeoutMillis;
- (void) in_mode;
+
+ if (in_mode < IDumpstateDevice::DumpstateMode::FULL || in_mode > IDumpstateDevice::DumpstateMode::PROTO) {
+ ALOGE("Invalid mode: %d\n", in_mode);
+ return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, "Invalid mode");
+ }
if (in_fds.size() < 1) {
ALOGE("no FDs\n");
@@ -171,6 +175,7 @@
if (in_fds.size() < 2) {
ALOGE("no FD for dumpstate_board binary\n");
+ dumpTextSection(fd, "");
} else {
int fd_bin = in_fds[1].get();
dumpLogSection(fd, fd_bin);