Update dumpstate HAL to V1.1
This is a manual porting from ag/10344396. Replace the usage of "persist.vendor.verbose_logging_enabled" since we are not using this property for Whitechapel. Use the default property "persist.dumpstate.verbose_logging.enabled" instead. Test: atest VtsHalDumpstateV1_1TargetTest pass Bug: 186539439 Change-Id: I3f0d35647c0748d360b12d3be078d514f99d23d5
This commit is contained in:
parent
c1c9613145
commit
ad5196c2c2
8 changed files with 64 additions and 21 deletions
|
@ -347,7 +347,7 @@ PRODUCT_PACKAGES += \
|
||||||
|
|
||||||
# dumpstate HAL
|
# dumpstate HAL
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
android.hardware.dumpstate@1.0-service.gs101
|
android.hardware.dumpstate@1.1-service.gs101
|
||||||
|
|
||||||
# AoC support
|
# AoC support
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
|
|
|
@ -16,11 +16,11 @@
|
||||||
|
|
||||||
LOCAL_PATH:= $(call my-dir)
|
LOCAL_PATH:= $(call my-dir)
|
||||||
include $(CLEAR_VARS)
|
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_KINDS := SPDX-license-identifier-Apache-2.0
|
||||||
LOCAL_LICENSE_CONDITIONS := notice
|
LOCAL_LICENSE_CONDITIONS := notice
|
||||||
LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../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_MODULE_RELATIVE_PATH := hw
|
||||||
|
|
||||||
LOCAL_SRC_FILES := \
|
LOCAL_SRC_FILES := \
|
||||||
|
@ -29,6 +29,7 @@ LOCAL_SRC_FILES := \
|
||||||
|
|
||||||
LOCAL_SHARED_LIBRARIES := \
|
LOCAL_SHARED_LIBRARIES := \
|
||||||
android.hardware.dumpstate@1.0 \
|
android.hardware.dumpstate@1.0 \
|
||||||
|
android.hardware.dumpstate@1.1 \
|
||||||
libbase \
|
libbase \
|
||||||
libcutils \
|
libcutils \
|
||||||
libdumpstateutil \
|
libdumpstateutil \
|
||||||
|
|
|
@ -59,7 +59,7 @@ using android::os::dumpstate::RunCommandToFd;
|
||||||
namespace android {
|
namespace android {
|
||||||
namespace hardware {
|
namespace hardware {
|
||||||
namespace dumpstate {
|
namespace dumpstate {
|
||||||
namespace V1_0 {
|
namespace V1_1 {
|
||||||
namespace implementation {
|
namespace implementation {
|
||||||
|
|
||||||
#define GPS_LOG_PREFIX "gl-"
|
#define GPS_LOG_PREFIX "gl-"
|
||||||
|
@ -71,6 +71,8 @@ namespace implementation {
|
||||||
|
|
||||||
typedef std::chrono::time_point<std::chrono::steady_clock> timepoint_t;
|
typedef std::chrono::time_point<std::chrono::steady_clock> timepoint_t;
|
||||||
|
|
||||||
|
const char kVerboseLoggingProperty[] = "persist.dumpstate.verbose_logging.enabled";
|
||||||
|
|
||||||
void DumpstateDevice::dumpLogs(int fd, std::string srcDir, std::string destDir, int maxFileNum,
|
void DumpstateDevice::dumpLogs(int fd, std::string srcDir, std::string destDir, int maxFileNum,
|
||||||
const char *logPrefix) {
|
const char *logPrefix) {
|
||||||
struct dirent **dirent_list = NULL;
|
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.
|
// Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.
|
||||||
Return<void> DumpstateDevice::dumpstateBoard(const hidl_handle &handle) {
|
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;
|
||||||
|
|
||||||
if (handle == nullptr || handle->numFds < 1) {
|
if (handle == nullptr || handle->numFds < 1) {
|
||||||
ALOGE("no FDs\n");
|
ALOGE("no FDs\n");
|
||||||
return Void();
|
return DumpstateStatus::ILLEGAL_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fd = handle->data[0];
|
int fd = handle->data[0];
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
ALOGE("invalid FD: %d\n", handle->data[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);
|
dumpTextSection(fd, kAllSections);
|
||||||
|
@ -963,9 +986,18 @@ Return<void> DumpstateDevice::dumpstateBoard(const hidl_handle &handle) {
|
||||||
"/vendor/firmware/logstrs.bin"});
|
"/vendor/firmware/logstrs.bin"});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return DumpstateStatus::OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
Return<void> DumpstateDevice::setVerboseLoggingEnabled(const bool enable) {
|
||||||
|
::android::base::SetProperty(kVerboseLoggingProperty, enable ? "true" : "false");
|
||||||
return Void();
|
return Void();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Return<bool> DumpstateDevice::getVerboseLoggingEnabled() {
|
||||||
|
return ::android::base::GetBoolProperty(kVerboseLoggingProperty, false);
|
||||||
|
}
|
||||||
|
|
||||||
// Since HALs that support the debug() interface are automatically invoked during
|
// 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
|
// 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
|
// data that will go into dumpstate_board.txt, this function will only do
|
||||||
|
@ -993,7 +1025,7 @@ Return<void> DumpstateDevice::debug(const hidl_handle &handle, const hidl_vec<hi
|
||||||
|
|
||||||
|
|
||||||
} // namespace implementation
|
} // namespace implementation
|
||||||
} // namespace V1_0
|
} // namespace V1_1
|
||||||
} // namespace dumpstate
|
} // namespace dumpstate
|
||||||
} // namespace hardware
|
} // namespace hardware
|
||||||
} // namespace android
|
} // namespace android
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#ifndef ANDROID_HARDWARE_DUMPSTATE_V1_0_DUMPSTATEDEVICE_H
|
#ifndef ANDROID_HARDWARE_DUMPSTATE_V1_1_DUMPSTATEDEVICE_H
|
||||||
#define ANDROID_HARDWARE_DUMPSTATE_V1_0_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/MQDescriptor.h>
|
||||||
#include <hidl/Status.h>
|
#include <hidl/Status.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -24,10 +24,12 @@
|
||||||
namespace android {
|
namespace android {
|
||||||
namespace hardware {
|
namespace hardware {
|
||||||
namespace dumpstate {
|
namespace dumpstate {
|
||||||
namespace V1_0 {
|
namespace V1_1 {
|
||||||
namespace implementation {
|
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_array;
|
||||||
using ::android::hardware::hidl_handle;
|
using ::android::hardware::hidl_handle;
|
||||||
using ::android::hardware::hidl_string;
|
using ::android::hardware::hidl_string;
|
||||||
|
@ -43,6 +45,13 @@ struct DumpstateDevice : public IDumpstateDevice {
|
||||||
// Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.
|
// Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.
|
||||||
Return<void> dumpstateBoard(const hidl_handle& h) override;
|
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;
|
||||||
|
|
||||||
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
||||||
Return<void> debug(const hidl_handle &fd, const hidl_vec<hidl_string> &args) override;
|
Return<void> debug(const hidl_handle &fd, const hidl_vec<hidl_string> &args) override;
|
||||||
|
|
||||||
|
@ -84,4 +93,4 @@ struct DumpstateDevice : public IDumpstateDevice {
|
||||||
} // namespace hardware
|
} // namespace hardware
|
||||||
} // namespace android
|
} // namespace android
|
||||||
|
|
||||||
#endif // ANDROID_HARDWARE_DUMPSTATE_V1_0_DUMPSTATEDEVICE_H
|
#endif // ANDROID_HARDWARE_DUMPSTATE_V1_1_DUMPSTATEDEVICE_H
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
@ -21,8 +21,8 @@
|
||||||
#include "DumpstateDevice.h"
|
#include "DumpstateDevice.h"
|
||||||
|
|
||||||
using ::android::hardware::configureRpcThreadpool;
|
using ::android::hardware::configureRpcThreadpool;
|
||||||
using ::android::hardware::dumpstate::V1_0::IDumpstateDevice;
|
using ::android::hardware::dumpstate::V1_1::IDumpstateDevice;
|
||||||
using ::android::hardware::dumpstate::V1_0::implementation::DumpstateDevice;
|
using ::android::hardware::dumpstate::V1_1::implementation::DumpstateDevice;
|
||||||
using ::android::hardware::joinRpcThreadpool;
|
using ::android::hardware::joinRpcThreadpool;
|
||||||
using ::android::sp;
|
using ::android::sp;
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
<hal format = "hidl">
|
<hal format = "hidl">
|
||||||
<name>android.hardware.dumpstate</name>
|
<name>android.hardware.dumpstate</name>
|
||||||
<transport>hwbinder</transport>
|
<transport>hwbinder</transport>
|
||||||
<version>1.0</version>
|
<version>1.1</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>IDumpstateDevice</name>
|
<name>IDumpstateDevice</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue