diff --git a/device.mk b/device.mk index d73a31ab..a9cb7f0a 100644 --- a/device.mk +++ b/device.mk @@ -347,7 +347,7 @@ PRODUCT_PACKAGES += \ # dumpstate HAL PRODUCT_PACKAGES += \ - android.hardware.dumpstate@1.0-service.gs101 + android.hardware.dumpstate@1.1-service.gs101 # AoC support PRODUCT_PACKAGES += \ diff --git a/dumpstate/Android.mk b/dumpstate/Android.mk index 983b2509..d9fee2c0 100644 --- a/dumpstate/Android.mk +++ b/dumpstate/Android.mk @@ -16,11 +16,11 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_MODULE := android.hardware.dumpstate@1.0-service.gs101 +LOCAL_MODULE := android.hardware.dumpstate@1.1-service.gs101 LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 LOCAL_LICENSE_CONDITIONS := notice LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE -LOCAL_INIT_RC := android.hardware.dumpstate@1.0-service.gs101.rc +LOCAL_INIT_RC := android.hardware.dumpstate@1.1-service.gs101.rc LOCAL_MODULE_RELATIVE_PATH := hw LOCAL_SRC_FILES := \ @@ -29,6 +29,7 @@ LOCAL_SRC_FILES := \ LOCAL_SHARED_LIBRARIES := \ android.hardware.dumpstate@1.0 \ + android.hardware.dumpstate@1.1 \ libbase \ libcutils \ libdumpstateutil \ diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index ca38f2d6..6f5e1664 100644 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -59,7 +59,7 @@ using android::os::dumpstate::RunCommandToFd; namespace android { namespace hardware { namespace dumpstate { -namespace V1_0 { +namespace V1_1 { namespace implementation { #define GPS_LOG_PREFIX "gl-" @@ -71,6 +71,8 @@ namespace implementation { typedef std::chrono::time_point timepoint_t; +const char kVerboseLoggingProperty[] = "persist.dumpstate.verbose_logging.enabled"; + void DumpstateDevice::dumpLogs(int fd, std::string srcDir, std::string destDir, int maxFileNum, const char *logPrefix) { struct dirent **dirent_list = NULL; @@ -923,15 +925,36 @@ void DumpstateDevice::dumpModem(int fd, int fdModem) // Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow. Return 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 DumpstateDevice::dumpstateBoard_1_1(const hidl_handle& handle, + const DumpstateMode mode, + const uint64_t timeoutMillis) { + // Unused arguments. + (void) timeoutMillis; + 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::PROTO) { + ALOGE("Invalid mode: %d\n", mode); + return DumpstateStatus::ILLEGAL_ARGUMENT; } dumpTextSection(fd, kAllSections); @@ -963,9 +986,18 @@ Return DumpstateDevice::dumpstateBoard(const hidl_handle &handle) { "/vendor/firmware/logstrs.bin"}); } + return DumpstateStatus::OK; +} + +Return DumpstateDevice::setVerboseLoggingEnabled(const bool enable) { + ::android::base::SetProperty(kVerboseLoggingProperty, enable ? "true" : "false"); return Void(); } +Return DumpstateDevice::getVerboseLoggingEnabled() { + return ::android::base::GetBoolProperty(kVerboseLoggingProperty, false); +} + // Since HALs that support the debug() interface are automatically invoked during // bugreport generation and we don't want to generate a second copy of the same // data that will go into dumpstate_board.txt, this function will only do @@ -993,7 +1025,7 @@ Return DumpstateDevice::debug(const hidl_handle &handle, const hidl_vec +#include #include #include #include @@ -24,10 +24,12 @@ namespace android { namespace hardware { namespace dumpstate { -namespace V1_0 { +namespace V1_1 { namespace implementation { -using ::android::hardware::dumpstate::V1_0::IDumpstateDevice; +using ::android::hardware::dumpstate::V1_1::DumpstateMode; +using ::android::hardware::dumpstate::V1_1::DumpstateStatus; +using ::android::hardware::dumpstate::V1_1::IDumpstateDevice; using ::android::hardware::hidl_array; using ::android::hardware::hidl_handle; using ::android::hardware::hidl_string; @@ -43,6 +45,13 @@ struct DumpstateDevice : public IDumpstateDevice { // Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow. Return dumpstateBoard(const hidl_handle& h) override; + // Methods from ::android::hardware::dumpstate::V1_1::IDumpstateDevice follow. + Return dumpstateBoard_1_1(const hidl_handle& h, + const DumpstateMode mode, + const uint64_t timeoutMillis) override; + Return setVerboseLoggingEnabled(const bool enable) override; + Return getVerboseLoggingEnabled() override; + // Methods from ::android::hidl::base::V1_0::IBase follow. Return debug(const hidl_handle &fd, const hidl_vec &args) override; @@ -84,4 +93,4 @@ struct DumpstateDevice : public IDumpstateDevice { } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_DUMPSTATE_V1_0_DUMPSTATEDEVICE_H +#endif // ANDROID_HARDWARE_DUMPSTATE_V1_1_DUMPSTATEDEVICE_H diff --git a/dumpstate/android.hardware.dumpstate@1.0-service.gs101.rc b/dumpstate/android.hardware.dumpstate@1.0-service.gs101.rc deleted file mode 100644 index 6fdd9380..00000000 --- a/dumpstate/android.hardware.dumpstate@1.0-service.gs101.rc +++ /dev/null @@ -1,5 +0,0 @@ -service vendor.dumpstate-1-0 /vendor/bin/hw/android.hardware.dumpstate@1.0-service.gs101 - class hal - user system - group system - interface android.hardware.dumpstate@1.0::IDumpstateDevice default diff --git a/dumpstate/android.hardware.dumpstate@1.1-service.gs101.rc b/dumpstate/android.hardware.dumpstate@1.1-service.gs101.rc new file mode 100644 index 00000000..6be0278b --- /dev/null +++ b/dumpstate/android.hardware.dumpstate@1.1-service.gs101.rc @@ -0,0 +1,6 @@ +service vendor.dumpstate-1-1 /vendor/bin/hw/android.hardware.dumpstate@1.1-service.gs101 + class hal + user system + group system + interface android.hardware.dumpstate@1.0::IDumpstateDevice default + interface android.hardware.dumpstate@1.1::IDumpstateDevice default diff --git a/dumpstate/service.cpp b/dumpstate/service.cpp index e06d4245..47172311 100644 --- a/dumpstate/service.cpp +++ b/dumpstate/service.cpp @@ -21,8 +21,8 @@ #include "DumpstateDevice.h" using ::android::hardware::configureRpcThreadpool; -using ::android::hardware::dumpstate::V1_0::IDumpstateDevice; -using ::android::hardware::dumpstate::V1_0::implementation::DumpstateDevice; +using ::android::hardware::dumpstate::V1_1::IDumpstateDevice; +using ::android::hardware::dumpstate::V1_1::implementation::DumpstateDevice; using ::android::hardware::joinRpcThreadpool; using ::android::sp; diff --git a/manifest.xml b/manifest.xml index 9c4fa889..81b21ea4 100644 --- a/manifest.xml +++ b/manifest.xml @@ -104,7 +104,7 @@ android.hardware.dumpstate hwbinder - 1.0 + 1.1 IDumpstateDevice default