Update dumpstate HAL to V1.1

Bug: 143184495
Test: atest VtsHalDumpstateV1_1TargetTest pass
Change-Id: I087622c49e2632d7e759a6384c5e09102e072fd7
This commit is contained in:
Hungyen Weng
2020-02-11 00:04:38 +08:00
committed by Cyan_Hsieh
parent 538ddad31b
commit 150ff07f8c
6 changed files with 61 additions and 18 deletions

View File

@@ -48,6 +48,8 @@
#define MODEM_EFS_DUMP_PROPERTY "vendor.sys.modem.diag.efsdump"
#define VENDOR_VERBOSE_LOGGING_ENABLED_PROPERTY "persist.vendor.verbose_logging_enabled"
using android::os::dumpstate::CommandOptions;
using android::os::dumpstate::DumpFileToFd;
using android::os::dumpstate::PropertiesHelper;
@@ -56,7 +58,7 @@ using android::os::dumpstate::RunCommandToFd;
namespace android {
namespace hardware {
namespace dumpstate {
namespace V1_0 {
namespace V1_1 {
namespace implementation {
#define DIAG_LOG_PREFIX "diag_log_"
@@ -459,6 +461,18 @@ static void DumpVibrator(int fd) {
// Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.
Return<void> DumpstateDevice::dumpstateBoard(const hidl_handle& handle) {
// Ignore return value, just return an empty status.
dumpstateBoard_1_1(handle, DumpstateMode::DEFAULT, 30 * 1000 /* timeoutMillis */);
return Void();
}
// Methods from ::android::hardware::dumpstate::V1_1::IDumpstateDevice follow.
Return<DumpstateStatus> DumpstateDevice::dumpstateBoard_1_1(const hidl_handle& handle,
const DumpstateMode mode,
const uint64_t timeoutMillis) {
// Unused arguments.
(void) timeoutMillis;
// Exit when dump is completed since this is a lazy HAL.
addPostCommandTask([]() {
exit(0);
@@ -466,13 +480,22 @@ Return<void> DumpstateDevice::dumpstateBoard(const hidl_handle& handle) {
if (handle == nullptr || handle->numFds < 1) {
ALOGE("no FDs\n");
return Void();
return DumpstateStatus::ILLEGAL_ARGUMENT;
}
int fd = handle->data[0];
if (fd < 0) {
ALOGE("invalid FD: %d\n", handle->data[0]);
return Void();
return DumpstateStatus::ILLEGAL_ARGUMENT;
}
if (mode == DumpstateMode::WEAR) {
// We aren't a Wear device.
ALOGE("Unsupported mode: %d\n", mode);
return DumpstateStatus::UNSUPPORTED_MODE;
} else if (mode < DumpstateMode::FULL || mode > DumpstateMode::DEFAULT) {
ALOGE("Invalid mode: %d\n", mode);
return DumpstateStatus::ILLEGAL_ARGUMENT;
}
bool modemLogging = isModemLoggingRunning();
@@ -573,11 +596,20 @@ Return<void> DumpstateDevice::dumpstateBoard(const hidl_handle& handle) {
// Keep this at the end as very long on not for humans
DumpFileToFd(fd, "WLAN FW Log Symbol Table", "/vendor/firmware/Data.msc");
return DumpstateStatus::OK;
}
Return<void> DumpstateDevice::setVerboseLoggingEnabled(const bool enable) {
android::base::SetProperty(VENDOR_VERBOSE_LOGGING_ENABLED_PROPERTY, enable ? "true" : "false");
return Void();
}
Return<bool> DumpstateDevice::getVerboseLoggingEnabled() {
return android::base::GetBoolProperty(VENDOR_VERBOSE_LOGGING_ENABLED_PROPERTY, false);
}
} // namespace implementation
} // namespace V1_0
} // namespace V1_1
} // namespace dumpstate
} // namespace hardware
} // namespace android