diff options
author | Adam Shih <adamshih@google.com> | 2023-03-27 11:42:16 +0800 |
---|---|---|
committer | Adam Shih <adamshih@google.com> | 2023-03-27 12:07:57 +0800 |
commit | a8053e022b0225bce878e5422fe33859eb409f88 (patch) | |
tree | 9b6fc79dfb4805dcde4d8a5de2cc25117913f6a6 | |
parent | b5b3cb74e5f37c7a0b55735ca9e07fc21fcf88a3 (diff) | |
download | gs-common-a8053e022b0225bce878e5422fe33859eb409f88.tar.gz |
comply with VTS requirements
Bug: 275036679
Bug: 275034315
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
Change-Id: I105f59f4c3e89e952cd89cb4ad28a5dfcc9c147f
-rw-r--r-- | gear/dumpstate/Dumpstate.cpp | 7 | ||||
-rw-r--r-- | gear/dumpstate/sepolicy/hal_dumpstate_default.te | 1 | ||||
-rw-r--r-- | gear/dumpstate/sepolicy/property.te | 2 | ||||
-rw-r--r-- | gear/dumpstate/sepolicy/property_contexts | 2 |
4 files changed, 10 insertions, 2 deletions
diff --git a/gear/dumpstate/Dumpstate.cpp b/gear/dumpstate/Dumpstate.cpp index 1e4d982..842e67d 100644 --- a/gear/dumpstate/Dumpstate.cpp +++ b/gear/dumpstate/Dumpstate.cpp @@ -154,8 +154,10 @@ ndk::ScopedAStatus Dumpstate::dumpstateBoard(const std::vector<::ndk::ScopedFile 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"); return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, @@ -171,6 +173,7 @@ ndk::ScopedAStatus Dumpstate::dumpstateBoard(const std::vector<::ndk::ScopedFile 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); diff --git a/gear/dumpstate/sepolicy/hal_dumpstate_default.te b/gear/dumpstate/sepolicy/hal_dumpstate_default.te index 3e4db45..96ff573 100644 --- a/gear/dumpstate/sepolicy/hal_dumpstate_default.te +++ b/gear/dumpstate/sepolicy/hal_dumpstate_default.te @@ -2,4 +2,5 @@ allow hal_dumpstate_default vendor_toolbox_exec:file execute_no_trans; allow hal_dumpstate_default radio_vendor_data_file:dir create_dir_perms; allow hal_dumpstate_default radio_vendor_data_file:file create_file_perms; allow hal_dumpstate_default shell_data_file:file getattr; +set_prop(hal_dumpstate_default, vendor_logger_prop) diff --git a/gear/dumpstate/sepolicy/property.te b/gear/dumpstate/sepolicy/property.te new file mode 100644 index 0000000..6a65855 --- /dev/null +++ b/gear/dumpstate/sepolicy/property.te @@ -0,0 +1,2 @@ +vendor_internal_prop(vendor_logger_prop) + diff --git a/gear/dumpstate/sepolicy/property_contexts b/gear/dumpstate/sepolicy/property_contexts new file mode 100644 index 0000000..e6b1f76 --- /dev/null +++ b/gear/dumpstate/sepolicy/property_contexts @@ -0,0 +1,2 @@ +persist.vendor.verbose_logging_enabled u:object_r:vendor_logger_prop:s0 + |