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

@@ -134,7 +134,7 @@ PRODUCT_PRODUCT_PROPERTIES +=\
# Dumpstate HAL
PRODUCT_PACKAGES += \
android.hardware.dumpstate@1.0-service.redfin
android.hardware.dumpstate@1.1-service.redfin
#per device
PRODUCT_COPY_FILES += \

View File

@@ -16,8 +16,8 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := android.hardware.dumpstate@1.0-service.redfin
LOCAL_INIT_RC := android.hardware.dumpstate@1.0-service.redfin.rc
LOCAL_MODULE := android.hardware.dumpstate@1.1-service.redfin
LOCAL_INIT_RC := android.hardware.dumpstate@1.1-service.redfin.rc
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SRC_FILES := \
@@ -26,6 +26,7 @@ LOCAL_SRC_FILES := \
LOCAL_SHARED_LIBRARIES := \
android.hardware.dumpstate@1.0 \
android.hardware.dumpstate@1.1 \
libbase \
libcutils \
libdumpstateutil \

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

View File

@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_HARDWARE_DUMPSTATE_V1_0_DUMPSTATEDEVICE_H
#define ANDROID_HARDWARE_DUMPSTATE_V1_0_DUMPSTATEDEVICE_H
#ifndef ANDROID_HARDWARE_DUMPSTATE_V1_1_DUMPSTATEDEVICE_H
#define ANDROID_HARDWARE_DUMPSTATE_V1_1_DUMPSTATEDEVICE_H
#include <android/hardware/dumpstate/1.0/IDumpstateDevice.h>
#include <android/hardware/dumpstate/1.1/IDumpstateDevice.h>
#include <hidl/MQDescriptor.h>
#include <hidl/Status.h>
#include <string>
@@ -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;
@@ -40,15 +42,22 @@ struct DumpstateDevice : public IDumpstateDevice {
// Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.
Return<void> dumpstateBoard(const hidl_handle& h) override;
// Methods from ::android::hardware::dumpstate::V1_1::IDumpstateDevice follow.
Return<DumpstateStatus> dumpstateBoard_1_1(const hidl_handle& h,
const DumpstateMode mode,
const uint64_t timeoutMillis) override;
Return<void> setVerboseLoggingEnabled(const bool enable) override;
Return<bool> getVerboseLoggingEnabled() override;
void dumpLogs(int fd, std::string srcDir, std::string destDir, int maxFileNum,
const char *logPrefix);
void dumpModem(int fd, int fdModem);
};
} // namespace implementation
} // namespace V1_0
} // namespace V1_1
} // namespace dumpstate
} // namespace hardware
} // namespace android
#endif // ANDROID_HARDWARE_DUMPSTATE_V1_0_DUMPSTATEDEVICE_H
#endif // ANDROID_HARDWARE_DUMPSTATE_V1_1_DUMPSTATEDEVICE_H

View File

@@ -1,8 +1,9 @@
service vendor.dumpstate-1-0 /vendor/bin/hw/android.hardware.dumpstate@1.0-service.redfin
service vendor.dumpstate-1-1 /vendor/bin/hw/android.hardware.dumpstate@1.1-service.redfin
class hal
user system
group system vendor_rfs
interface android.hardware.dumpstate@1.0::IDumpstateDevice default
interface android.hardware.dumpstate@1.1::IDumpstateDevice default
oneshot
disabled

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define LOG_TAG "android.hardware.dumpstate@1.0-service.redfin"
#define LOG_TAG "android.hardware.dumpstate@1.1-service.redfin"
#include <hidl/HidlSupport.h>
#include <hidl/HidlTransportSupport.h>
@@ -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;