diff options
Diffstat (limited to 'dumpstate')
-rw-r--r-- | dumpstate/Android.bp | 28 | ||||
-rw-r--r-- | dumpstate/Android.mk | 44 | ||||
-rw-r--r-- | dumpstate/Dumpstate.cpp | 719 | ||||
-rw-r--r-- | dumpstate/Dumpstate.h | 12 | ||||
-rw-r--r-- | dumpstate/OWNERS | 9 | ||||
-rw-r--r-- | dumpstate/README.txt | 1 | ||||
-rw-r--r-- | dumpstate/android.hardware.dumpstate-service.gs201.xml | 9 | ||||
-rw-r--r-- | dumpstate/android.hardware.dumpstate@1.1-service.gs201.rc | 2 |
8 files changed, 110 insertions, 714 deletions
diff --git a/dumpstate/Android.bp b/dumpstate/Android.bp new file mode 100644 index 0000000..85cdc25 --- /dev/null +++ b/dumpstate/Android.bp @@ -0,0 +1,28 @@ +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +cc_binary { + name: "android.hardware.dumpstate-service.gs201", + srcs: [ + "Dumpstate.cpp", + "service.cpp", + ], + init_rc: ["android.hardware.dumpstate@1.1-service.gs201.rc"], + vintf_fragments: ["android.hardware.dumpstate-service.gs201.xml"], + cflags: [ + "-Wall", + "-Werror", + ], + shared_libs: [ + "libbase", + "libbinder_ndk", + "libcutils", + "libdumpstateutil", + "liblog", + "libutils", + "android.hardware.dumpstate-V1-ndk", + ], + vendor: true, + relative_install_path: "hw", +} diff --git a/dumpstate/Android.mk b/dumpstate/Android.mk deleted file mode 100644 index 76202ce..0000000 --- a/dumpstate/Android.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -# Copyright 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) -LOCAL_MODULE := android.hardware.dumpstate-service.gs201 -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.1-service.gs201.rc -LOCAL_MODULE_RELATIVE_PATH := hw - -LOCAL_SRC_FILES := \ - Dumpstate.cpp \ - service.cpp - -LOCAL_SHARED_LIBRARIES := \ - libbase \ - libbinder_ndk \ - libcutils \ - libdumpstateutil \ - liblog \ - libutils \ - android.hardware.dumpstate-V1-ndk - -LOCAL_CFLAGS := -Werror -Wall - -LOCAL_MODULE_TAGS := optional -LOCAL_PROPRIETARY_MODULE := true - -include $(BUILD_EXECUTABLE) diff --git a/dumpstate/Dumpstate.cpp b/dumpstate/Dumpstate.cpp index 4921ca4..1f9e61e 100644 --- a/dumpstate/Dumpstate.cpp +++ b/dumpstate/Dumpstate.cpp @@ -15,6 +15,7 @@ */ #define LOG_TAG "dumpstate_device" +#define ATRACE_TAG ATRACE_TAG_ALWAYS #include <inttypes.h> @@ -22,6 +23,7 @@ #include <android-base/stringprintf.h> #include <android-base/properties.h> #include <android-base/unique_fd.h> +#include <cutils/trace.h> #include <log/log.h> #include <sys/stat.h> @@ -44,14 +46,10 @@ #define GPS_LOG_NUMBER_PROPERTY "persist.vendor.gps.aol.log_num" #define GPS_LOGGING_STATUS_PROPERTY "vendor.gps.aol.enabled" -#define UFS_BOOTDEVICE "ro.boot.bootdevice" - #define TCPDUMP_LOG_DIRECTORY "/data/vendor/tcpdump_logger/logs" #define TCPDUMP_NUMBER_BUGREPORT "persist.vendor.tcpdump.log.br_num" #define TCPDUMP_PERSIST_PROPERTY "persist.vendor.tcpdump.log.alwayson" -#define HW_REVISION "ro.boot.hardware.revision" - using android::os::dumpstate::CommandOptions; using android::os::dumpstate::DumpFileToFd; using android::os::dumpstate::PropertiesHelper; @@ -192,6 +190,7 @@ void dumpModemEFS(std::string destDir) { } timepoint_t startSection(int fd, const std::string §ionName) { + ATRACE_BEGIN(sectionName.c_str()); ::android::base::WriteStringToFd( "\n" "------ Section start: " + sectionName + " ------\n" @@ -200,6 +199,7 @@ timepoint_t startSection(int fd, const std::string §ionName) { } void endSection(int fd, const std::string §ionName, timepoint_t startTime) { + ATRACE_END(); auto endTime = std::chrono::steady_clock::now(); auto elapsedMsec = std::chrono::duration_cast<std::chrono::milliseconds> (endTime - startTime).count(); @@ -225,25 +225,13 @@ void endSection(int fd, const std::string §ionName, timepoint_t startTime) { Dumpstate::Dumpstate() : mTextSections{ { "wlan", [this](int fd) { dumpWlanSection(fd); } }, - { "modem", [this](int fd) { dumpModemSection(fd); } }, - { "soc", [this](int fd) { dumpSocSection(fd); } }, - { "storage", [this](int fd) { dumpStorageSection(fd); } }, { "memory", [this](int fd) { dumpMemorySection(fd); } }, { "Devfreq", [this](int fd) { dumpDevfreqSection(fd); } }, - { "cpu", [this](int fd) { dumpCpuSection(fd); } }, { "power", [this](int fd) { dumpPowerSection(fd); } }, - { "thermal", [this](int fd) { dumpThermalSection(fd); } }, - { "touch", [this](int fd) { dumpTouchSection(fd); } }, { "display", [this](int fd) { dumpDisplaySection(fd); } }, - { "sensors-usf", [this](int fd) { dumpSensorsUSFSection(fd); } }, - { "aoc", [this](int fd) { dumpAoCSection(fd); } }, - { "ramdump", [this](int fd) { dumpRamdumpSection(fd); } }, { "misc", [this](int fd) { dumpMiscSection(fd); } }, - { "gsc", [this](int fd) { dumpGscSection(fd); } }, - { "trusty", [this](int fd) { dumpTrustySection(fd); } }, { "led", [this](int fd) { dumpLEDSection(fd); } }, { "pixel-trace", [this](int fd) { dumpPixelTraceSection(fd); } }, - { "perf-metrics", [this](int fd) { dumpPerfMetricsSection(fd); } }, }, mLogSections{ { "modem", [this](int fd, const std::string &destDir) { dumpModemLogs(fd, destDir); } }, @@ -258,6 +246,7 @@ Dumpstate::Dumpstate() // if the specified section is not supported. void Dumpstate::dumpTextSection(int fd, const std::string §ionName) { bool dumpAll = (sectionName == kAllSections); + std::string dumpFiles; for (const auto §ion : mTextSections) { if (dumpAll || sectionName == section.first) { @@ -271,6 +260,31 @@ void Dumpstate::dumpTextSection(int fd, const std::string §ionName) { } } + // Execute all or designated programs under vendor/bin/dump/ + std::unique_ptr<DIR, decltype(&closedir)> dir(opendir("/vendor/bin/dump"), closedir); + if (!dir) { + ALOGE("Fail To Open Dir vendor/bin/dump/"); + ::android::base::WriteStringToFd("Fail To Open Dir vendor/bin/dump/\n", fd); + return; + } + dirent *entry; + while ((entry = readdir(dir.get())) != nullptr) { + // Skip '.', '..' + if (entry->d_name[0] == '.') { + continue; + } + std::string bin(entry->d_name); + dumpFiles = dumpFiles + " " + bin; + if (dumpAll || sectionName == bin) { + auto startTime = startSection(fd, bin); + RunCommandToFd(fd, "/vendor/bin/dump/"+bin, {"/vendor/bin/dump/"+bin}); + endSection(fd, bin, startTime); + if (!dumpAll) { + return; + } + } + } + if (dumpAll) { return; } @@ -281,6 +295,7 @@ void Dumpstate::dumpTextSection(int fd, const std::string §ionName) { for (const auto §ion : mTextSections) { ::android::base::WriteStringToFd(" " + section.first, fd); } + ::android::base::WriteStringToFd(dumpFiles, fd); ::android::base::WriteStringToFd("\nNote: sections with attachments (e.g. modem) are" "not avalable from the command line.\n", fd); } @@ -491,461 +506,6 @@ void Dumpstate::dumpPowerSection(int fd) { } -// Dump items related to thermal -void Dumpstate::dumpThermalSection(int fd) { - RunCommandToFd(fd, "Temperatures", {"/vendor/bin/sh", "-c", - "for f in /sys/class/thermal/thermal* ; do " - "type=`cat $f/type` ; temp=`cat $f/temp` ; echo \"$type: $temp\" ; " - "done"}); - RunCommandToFd(fd, "Cooling Device Current State", {"/vendor/bin/sh", "-c", - "for f in /sys/class/thermal/cooling* ; do " - "type=`cat $f/type` ; temp=`cat $f/cur_state` ; echo \"$type: $temp\" ; " - "done"}); - RunCommandToFd(fd, "Cooling Device User Vote State", {"/vendor/bin/sh", "-c", - "for f in /sys/class/thermal/cooling* ; do " - "if [ ! -f $f/user_vote ]; then continue; fi; " - "type=`cat $f/type` ; temp=`cat $f/user_vote` ; echo \"$type: $temp\" ; " - "done"}); - RunCommandToFd(fd, "Cooling Device Time in State", {"/vendor/bin/sh", "-c", "for f in /sys/class/thermal/cooling* ; " - "do type=`cat $f/type` ; temp=`cat $f/stats/time_in_state_ms` ; echo \"$type:\n$temp\" ; done"}); - RunCommandToFd(fd, "Cooling Device Trans Table", {"/vendor/bin/sh", "-c", "for f in /sys/class/thermal/cooling* ; " - "do type=`cat $f/type` ; temp=`cat $f/stats/trans_table` ; echo \"$type:\n$temp\" ; done"}); - RunCommandToFd(fd, "Cooling Device State2Power Table", {"/vendor/bin/sh", "-c", - "for f in /sys/class/thermal/cooling* ; do " - "if [ ! -f $f/state2power_table ]; then continue; fi; " - "type=`cat $f/type` ; state2power_table=`cat $f/state2power_table` ; echo \"$type: $state2power_table\" ; " - "done"}); - DumpFileToFd(fd, "TMU state:", "/sys/module/gs_thermal/parameters/tmu_reg_dump_state"); - DumpFileToFd(fd, "TMU current temperature:", "/sys/module/gs_thermal/parameters/tmu_reg_dump_current_temp"); - DumpFileToFd(fd, "TMU_TOP rise thresholds:", "/sys/module/gs_thermal/parameters/tmu_top_reg_dump_rise_thres"); - DumpFileToFd(fd, "TMU_TOP fall thresholds:", "/sys/module/gs_thermal/parameters/tmu_top_reg_dump_fall_thres"); - DumpFileToFd(fd, "TMU_SUB rise thresholds:", "/sys/module/gs_thermal/parameters/tmu_sub_reg_dump_rise_thres"); - DumpFileToFd(fd, "TMU_SUB fall thresholds:", "/sys/module/gs_thermal/parameters/tmu_sub_reg_dump_fall_thres"); - DumpFileToFd(fd, "Temperature Residency Metrics:", "/sys/kernel/metrics/temp_residency/temp_residency_all/stats"); -} - -// Dump items related to touch -void Dumpstate::dumpTouchSection(int fd) { - const char stm_cmd_path[4][50] = {"/sys/class/spi_master/spi11/spi11.0", - "/proc/fts/driver_test", - "/sys/class/spi_master/spi6/spi6.0", - "/proc/fts_ext/driver_test"}; - const char fst2_cmd_path[2][50] = {"/sys/class/spi_master/spi0/spi0.0", - "/proc/fts/driver_test"}; - const char lsi_spi_path[] = "/sys/devices/virtual/sec/tsp"; - const char syna_cmd_path[] = "/sys/class/spi_master/spi0/spi0.0/synaptics_tcm.0/sysfs"; - const char focaltech_cmd_path[] = "/proc/focaltech_touch"; - const char gti0_cmd_path[] = "/sys/devices/virtual/goog_touch_interface/gti.0"; - const char gti0_procfs_path[] = "/proc/goog_touch_interface/gti.0"; - char cmd[256]; - - if (!access(focaltech_cmd_path, R_OK)) { - ::android::base::WriteStringToFd("\n<<<<<< FOCALTECH >>>>>>\n\n", fd); - - // Enable: force touch active - snprintf(cmd, sizeof(cmd), "echo 21 > %s/force_active", focaltech_cmd_path); - RunCommandToFd(fd, "Enable Force Touch Active", {"/vendor/bin/sh", "-c", cmd}); - - // Touch Firmware Version - snprintf(cmd, sizeof(cmd), "%s/FW_Version", focaltech_cmd_path); - DumpFileToFd(fd, "Touch Firmware Version", cmd); - - // Touch INT PIN Test - snprintf(cmd, sizeof(cmd), "%s/INT_PIN", focaltech_cmd_path); - DumpFileToFd(fd, "Touch INT PIN Test", cmd); - - // Get Raw Data - Delta - snprintf(cmd, sizeof(cmd), "%s/selftest/Panel_Differ", focaltech_cmd_path); - DumpFileToFd(fd, "Get Raw Data - Panel_Differ", cmd); - - // Get Raw Data - Raw - snprintf(cmd, sizeof(cmd), "%s/selftest/Rawdata", focaltech_cmd_path); - DumpFileToFd(fd, "Get Raw Data - Raw", cmd); - - // Get Raw Data - Baseline - snprintf(cmd, sizeof(cmd), "%s/selftest/Baseline", focaltech_cmd_path); - DumpFileToFd(fd, "Get Raw Data - Baseline", cmd); - - // Get Raw Data - Noise - snprintf(cmd, sizeof(cmd), "%s/selftest/Noise", focaltech_cmd_path); - DumpFileToFd(fd, "Get Raw Data - Noise", cmd); - - // Get Raw Data - Uniformity - snprintf(cmd, sizeof(cmd), "%s/selftest/Rawdata_Uniformity", focaltech_cmd_path); - DumpFileToFd(fd, "Get Raw Data - Uniformity", cmd); - - // Get Scap_CB - snprintf(cmd, sizeof(cmd), "%s/selftest/Scap_CB", focaltech_cmd_path); - DumpFileToFd(fd, "Get Scap_CB", cmd); - - // Get Scap_CB - Raw - snprintf(cmd, sizeof(cmd), "%s/selftest/Scap_Rawdata", focaltech_cmd_path); - DumpFileToFd(fd, "Get Scap_Rawdata", cmd); - - // Get Short Test - snprintf(cmd, sizeof(cmd), "%s/selftest/Short", focaltech_cmd_path); - DumpFileToFd(fd, "Get Short Test", cmd); - - // Get HeatMap(ms,ss) - snprintf(cmd, sizeof(cmd), "%s/selftest/Strength", focaltech_cmd_path); - DumpFileToFd(fd, "Get HeatMap(ms,ss)", cmd); - - // Disable: force touch active - snprintf(cmd, sizeof(cmd), "echo 20 > %s/force_active", focaltech_cmd_path); - RunCommandToFd(fd, "Disable Force Touch Active", {"/vendor/bin/sh", "-c", cmd}); - } - - if (!access(syna_cmd_path, R_OK)) { - ::android::base::WriteStringToFd("\n<<<<<< SYNA >>>>>>\n\n", fd); - - // Enable: force touch active - snprintf(cmd, sizeof(cmd), "echo 21 > %s/force_active", syna_cmd_path); - RunCommandToFd(fd, "Enable Force Touch Active", {"/vendor/bin/sh", "-c", cmd}); - - // Touch Firmware Information - snprintf(cmd, sizeof(cmd), "%s/info", syna_cmd_path); - DumpFileToFd(fd, "Touch Firmware Information", cmd); - - // Get Raw Data - Delta - snprintf(cmd, sizeof(cmd), - "echo 12 > %s/get_raw_data && cat %s/get_raw_data", syna_cmd_path, syna_cmd_path); - RunCommandToFd(fd, "Get Raw Data - Delta", {"/vendor/bin/sh", "-c", cmd}); - - // Get Raw Data - Raw - snprintf(cmd, sizeof(cmd), - "echo 13 > %s/get_raw_data && cat %s/get_raw_data", syna_cmd_path, syna_cmd_path); - RunCommandToFd(fd, "Get Raw Data - Raw", {"/vendor/bin/sh", "-c", cmd}); - - // Get Raw Data - Baseline - snprintf(cmd, sizeof(cmd), - "echo 14 > %s/get_raw_data && cat %s/get_raw_data", syna_cmd_path, syna_cmd_path); - RunCommandToFd(fd, "Get Raw Data - Baseline", {"/vendor/bin/sh", "-c", cmd}); - - // Disable: force touch active - snprintf(cmd, sizeof(cmd), "echo 20 > %s/force_active", syna_cmd_path); - RunCommandToFd(fd, "Disable Force Touch Active", {"/vendor/bin/sh", "-c", cmd}); - } - - for (int i = 0; i < 4; i += 2) { // ftm5 - snprintf(cmd, sizeof(cmd), "%s", stm_cmd_path[i]); - if (access(cmd, R_OK)) - continue; - ::android::base::WriteStringToFd("\n<<<<<< FTM5 >>>>>>\n\n", fd); - - snprintf(cmd, sizeof(cmd), "%s", stm_cmd_path[i + 1]); - if (!access(cmd, R_OK)) { - snprintf(cmd, sizeof(cmd), "echo A0 01 01 > %s", stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Force Set AP as Bus Owner with Bugreport Flag", - {"/vendor/bin/sh", "-c", cmd}); - } - - snprintf(cmd, sizeof(cmd), "%s/appid", stm_cmd_path[i]); - if (!access(cmd, R_OK)) { - // Touch firmware version - DumpFileToFd(fd, "STM touch firmware version", cmd); - - // Touch controller status - snprintf(cmd, sizeof(cmd), "%s/status", stm_cmd_path[i]); - DumpFileToFd(fd, "STM touch status", cmd); - - // Mutual raw data - snprintf(cmd, sizeof(cmd), - "echo 13 00 01 > %s/stm_fts_cmd && cat %s/stm_fts_cmd", - stm_cmd_path[i], stm_cmd_path[i]); - RunCommandToFd(fd, "Mutual Raw", {"/vendor/bin/sh", "-c", cmd}); - - // Mutual strength data - snprintf(cmd, sizeof(cmd), - "echo 17 01 > %s/stm_fts_cmd && cat %s/stm_fts_cmd", - stm_cmd_path[i], stm_cmd_path[i]); - RunCommandToFd(fd, "Mutual Strength", {"/vendor/bin/sh", "-c", cmd}); - - // Self raw data - snprintf(cmd, sizeof(cmd), - "echo 15 00 01 > %s/stm_fts_cmd && cat %s/stm_fts_cmd", - stm_cmd_path[i], stm_cmd_path[i]); - RunCommandToFd(fd, "Self Raw", {"/vendor/bin/sh", "-c", cmd}); - } - - snprintf(cmd, sizeof(cmd), "%s", stm_cmd_path[i + 1]); - if (!access(cmd, R_OK)) { - snprintf(cmd, sizeof(cmd), "echo 23 00 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Mutual Raw Data", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 23 03 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Mutual Baseline Data", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 23 02 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Mutual Strength Data", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 24 00 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Self Raw Data", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 24 03 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Self Baseline Data", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 24 02 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Self Strength Data", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 32 10 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Mutual Compensation", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 32 11 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Mutual Low Power Compensation", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 33 12 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Self Compensation", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 34 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Golden Mutual Raw Data", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 01 FA 20 00 00 24 80 > %s", - stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Packaging Plant - HW reset", - {"/vendor/bin/sh", "-c", cmd}); - snprintf(cmd, sizeof(cmd), "echo 01 FA 20 00 00 68 08 > %s", - stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Packaging Plant - Hibernate Memory", - {"/vendor/bin/sh", "-c", cmd}); - snprintf(cmd, sizeof(cmd), - "echo 02 FB 00 04 3F D8 00 10 01 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Packaging Plant - Read 16 bytes from Address 0x00041FD8", - {"/vendor/bin/sh", "-c", cmd}); - } - - snprintf(cmd, sizeof(cmd), "%s/stm_fts_cmd", stm_cmd_path[i]); - if (!access(cmd, R_OK)) { - // ITO raw data - snprintf(cmd, sizeof(cmd), - "echo 01 > %s/stm_fts_cmd && cat %s/stm_fts_cmd", - stm_cmd_path[i], stm_cmd_path[i]); - RunCommandToFd(fd, "ITO Raw", {"/vendor/bin/sh", "-c", cmd}); - } - - snprintf(cmd, sizeof(cmd), "%s", stm_cmd_path[i + 1]); - if (!access(cmd, R_OK)) { - snprintf(cmd, sizeof(cmd), "echo A0 00 01 > %s", stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Restore Bus Owner", - {"/vendor/bin/sh", "-c", cmd}); - } - } - - for (int i = 0; i < 2; i += 2) { // fst2 - snprintf(cmd, sizeof(cmd), "%s", fst2_cmd_path[i]); - if (!access(cmd, R_OK)) { - ::android::base::WriteStringToFd("\n<<<<<< FST2 >>>>>>\n\n", fd); - - snprintf(cmd, sizeof(cmd), "%s", fst2_cmd_path[i + 1]); - if (!access(cmd, R_OK)) { - // Enable: force touch active - snprintf(cmd, sizeof(cmd), "echo 21 01 > %s", fst2_cmd_path[i + 1]); - RunCommandToFd(fd, "Force Set AP as Bus Owner with Bugreport Flag", - {"/vendor/bin/sh", "-c", cmd}); - - // Golden Mutual Raw Data - snprintf(cmd, sizeof(cmd), "echo 0B 00 23 40 > %s;" - "echo 02 B7 00 10 04 E0 01 > %s ; cat %s;" - "echo 02 B7 04 F0 04 E0 01 > %s ; cat %s;", - fst2_cmd_path[i + 1], fst2_cmd_path[i + 1], fst2_cmd_path[i + 1], - fst2_cmd_path[i + 1], fst2_cmd_path[i + 1]); - RunCommandToFd(fd, "Golden Mutual Raw Data", {"/vendor/bin/sh", "-c", cmd}); - - // Restore Bus Owner - snprintf(cmd, sizeof(cmd), "echo 21 00 > %s", fst2_cmd_path[i + 1]); - RunCommandToFd(fd, "Restore Bus Owner", {"/vendor/bin/sh", "-c", cmd}); - } - } - } - - if (!access(lsi_spi_path, R_OK)) { - ::android::base::WriteStringToFd("\n<<<<<< LSI >>>>>>\n\n", fd); - - // Enable: force touch active - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "force_touch_active,1", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "Force Touch Active", {"/vendor/bin/sh", "-c", cmd}); - - // Firmware info - snprintf(cmd, sizeof(cmd), "%s/fw_version", lsi_spi_path); - DumpFileToFd(fd, "LSI firmware version", cmd); - - // Touch status - snprintf(cmd, sizeof(cmd), "%s/status", lsi_spi_path); - DumpFileToFd(fd, "LSI touch status", cmd); - - // Calibration info - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "get_mis_cal_info", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "Calibration info", {"/vendor/bin/sh", "-c", cmd}); - - // Mutual strength - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "run_delta_read_all", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "Mutual Strength", {"/vendor/bin/sh", "-c", cmd}); - - // Self strength - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "run_self_delta_read_all", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "Self Strength", {"/vendor/bin/sh", "-c", cmd}); - - // Raw cap - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "run_rawcap_read_all", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "Mutual Raw Cap", {"/vendor/bin/sh", "-c", cmd}); - - // Self raw cap - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "run_self_rawcap_read_all", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "Self Raw Cap", {"/vendor/bin/sh", "-c", cmd}); - - // TYPE_AMBIENT_DATA - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "run_rawdata_read_type,3", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "TYPE_AMBIENT_DATA", {"/vendor/bin/sh", "-c", cmd}); - - // TYPE_DECODED_DATA - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "run_rawdata_read_type,5", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "TYPE_DECODED_DATA", {"/vendor/bin/sh", "-c", cmd}); - - // TYPE_NOI_P2P_MIN - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "run_rawdata_read_type,30", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "TYPE_NOI_P2P_MIN", {"/vendor/bin/sh", "-c", cmd}); - - // TYPE_NOI_P2P_MAX - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "run_rawdata_read_type,31", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "TYPE_NOI_P2P_MAX", {"/vendor/bin/sh", "-c", cmd}); - - // Disable: force touch active - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "force_touch_active,0", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "Force Touch Active", {"/vendor/bin/sh", "-c", cmd}); - } - - if (!access(gti0_cmd_path, R_OK)) { - const char *heatmap_path = gti0_cmd_path; - - if (!access(gti0_procfs_path, R_OK)) - heatmap_path = gti0_procfs_path; - ::android::base::WriteStringToFd("\n<<<<<< GTI0 >>>>>>\n\n", fd); - - // Enable: force touch active - snprintf(cmd, sizeof(cmd), "echo 1 > %s/force_active", gti0_cmd_path); - RunCommandToFd(fd, "Force Touch Active", {"/vendor/bin/sh", "-c", cmd}); - - // Touch Firmware Version - snprintf(cmd, sizeof(cmd), "%s/fw_ver", gti0_cmd_path); - DumpFileToFd(fd, "Touch Firmware Version", cmd); - - // Get Mutual Sensing Data - Baseline - snprintf(cmd, sizeof(cmd), "cat %s/ms_base", heatmap_path); - RunCommandToFd(fd, "Get Mutual Sensing Data - Baseline", {"/vendor/bin/sh", "-c", cmd}); - - // Get Mutual Sensing Data - Delta - snprintf(cmd, sizeof(cmd), "cat %s/ms_diff", heatmap_path); - RunCommandToFd(fd, "Get Mutual Sensing Data - Delta", {"/vendor/bin/sh", "-c", cmd}); - - // Get Mutual Sensing Data - Raw - snprintf(cmd, sizeof(cmd), "cat %s/ms_raw", heatmap_path); - RunCommandToFd(fd, "Get Mutual Sensing Data - Raw", {"/vendor/bin/sh", "-c", cmd}); - - // Get Self Sensing Data - Baseline - snprintf(cmd, sizeof(cmd), "cat %s/ss_base", heatmap_path); - RunCommandToFd(fd, "Get Self Sensing Data - Baseline", {"/vendor/bin/sh", "-c", cmd}); - - // Get Self Sensing Data - Delta - snprintf(cmd, sizeof(cmd), "cat %s/ss_diff", heatmap_path); - RunCommandToFd(fd, "Get Self Sensing Data - Delta", {"/vendor/bin/sh", "-c", cmd}); - - // Get Self Sensing Data - Raw - snprintf(cmd, sizeof(cmd), "cat %s/ss_raw", heatmap_path); - RunCommandToFd(fd, "Get Self Sensing Data - Raw", {"/vendor/bin/sh", "-c", cmd}); - - // Self Test - snprintf(cmd, sizeof(cmd), "cat %s/self_test", gti0_cmd_path); - RunCommandToFd(fd, "Self Test", {"/vendor/bin/sh", "-c", cmd}); - - // Disable: force touch active - snprintf(cmd, sizeof(cmd), "echo 0 > %s/force_active", gti0_cmd_path); - RunCommandToFd(fd, "Disable Force Touch Active", {"/vendor/bin/sh", "-c", cmd}); - } -} - -// Dump items related to SoC -void Dumpstate::dumpSocSection(int fd) { - DumpFileToFd(fd, "AP HW TUNE", "/sys/devices/system/chip-id/ap_hw_tune_str"); - DumpFileToFd(fd, "EVT VERSION", "/sys/devices/system/chip-id/evt_ver"); - DumpFileToFd(fd, "LOT ID", "/sys/devices/system/chip-id/lot_id"); - DumpFileToFd(fd, "PRODUCT ID", "/sys/devices/system/chip-id/product_id"); - DumpFileToFd(fd, "REVISION", "/sys/devices/system/chip-id/revision"); - DumpFileToFd(fd, "RAW STR", "/sys/devices/system/chip-id/raw_str"); -} - -// Dump items related to CPUs -void Dumpstate::dumpCpuSection(int fd) { - DumpFileToFd(fd, "CPU present", "/sys/devices/system/cpu/present"); - DumpFileToFd(fd, "CPU online", "/sys/devices/system/cpu/online"); - RunCommandToFd(fd, "CPU time-in-state", {"/vendor/bin/sh", "-c", - "for cpu in /sys/devices/system/cpu/cpu*; do " - "f=$cpu/cpufreq/stats/time_in_state; " - "if [ ! -f $f ]; then continue; fi; " - "echo $f:; cat $f; " - "done"}); - RunCommandToFd(fd, "CPU cpuidle", {"/vendor/bin/sh", "-c", - "for cpu in /sys/devices/system/cpu/cpu*; do " - "for d in $cpu/cpuidle/state*; do " - "if [ ! -d $d ]; then continue; fi; " - "echo \"$d: `cat $d/name` `cat $d/desc` `cat $d/time` `cat $d/usage`\"; " - "done; " - "done"}); - DumpFileToFd(fd, "INTERRUPTS", "/proc/interrupts"); -} - // Dump items related to Devfreq & BTS void Dumpstate::dumpDevfreqSection(int fd) { DumpFileToFd(fd, "MIF DVFS", @@ -990,80 +550,26 @@ void Dumpstate::dumpMemorySection(int fd) { "done"}); } -static void DumpF2FS(int fd) { - DumpFileToFd(fd, "F2FS", "/sys/kernel/debug/f2fs/status"); - RunCommandToFd(fd, "F2FS - fsck time (ms)", {"/vendor/bin/sh", "-c", "getprop ro.boottime.init.fsck.data"}); - RunCommandToFd(fd, "F2FS - checkpoint=disable time (ms)", {"/vendor/bin/sh", "-c", "getprop ro.boottime.init.mount.data"}); -} - -static void DumpUFS(int fd) { - DumpFileToFd(fd, "UFS model", "/sys/block/sda/device/model"); - DumpFileToFd(fd, "UFS rev", "/sys/block/sda/device/rev"); - DumpFileToFd(fd, "UFS size", "/sys/block/sda/size"); - - DumpFileToFd(fd, "UFS Slow IO Read", "/dev/sys/block/bootdevice/slowio_read_cnt"); - DumpFileToFd(fd, "UFS Slow IO Write", "/dev/sys/block/bootdevice/slowio_write_cnt"); - DumpFileToFd(fd, "UFS Slow IO Unmap", "/dev/sys/block/bootdevice/slowio_unmap_cnt"); - DumpFileToFd(fd, "UFS Slow IO Sync", "/dev/sys/block/bootdevice/slowio_sync_cnt"); - - RunCommandToFd(fd, "UFS err_stats", {"/vendor/bin/sh", "-c", - "path=\"/dev/sys/block/bootdevice/err_stats\"; " - "for node in `ls $path/* | grep -v reset_err_status`; do " - "printf \"%s:%d\\n\" $(basename $node) $(cat $node); done;"}); - - - RunCommandToFd(fd, "UFS io_stats", {"/vendor/bin/sh", "-c", - "path=\"/dev/sys/block/bootdevice/io_stats\"; " - "printf \"\\t\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "ReadCnt ReadBytes WriteCnt WriteBytes RWCnt RWBytes; " - "str=$(cat $path/*_start); arr=($str); " - "printf \"Started: \\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[1]} ${arr[0]} ${arr[5]} ${arr[4]} ${arr[3]} ${arr[2]}; " - "str=$(cat $path/*_complete); arr=($str); " - "printf \"Completed: \\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[1]} ${arr[0]} ${arr[5]} ${arr[4]} ${arr[3]} ${arr[2]}; " - "str=$(cat $path/*_maxdiff); arr=($str); " - "printf \"MaxDiff: \\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\\n\" " - "${arr[1]} ${arr[0]} ${arr[5]} ${arr[4]} ${arr[3]} ${arr[2]}; "}); - - RunCommandToFd(fd, "UFS req_stats", {"/vendor/bin/sh", "-c", - "path=\"/dev/sys/block/bootdevice/req_stats\"; " - "printf \"\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "All Write Read Security Flush Discard; " - "str=$(cat $path/*_min); arr=($str); " - "printf \"Min:\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[0]} ${arr[5]} ${arr[3]} ${arr[4]} ${arr[2]} ${arr[1]}; " - "str=$(cat $path/*_max); arr=($str); " - "printf \"Max:\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[0]} ${arr[5]} ${arr[3]} ${arr[4]} ${arr[2]} ${arr[1]}; " - "str=$(cat $path/*_avg); arr=($str); " - "printf \"Avg.:\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[0]} ${arr[5]} ${arr[3]} ${arr[4]} ${arr[2]} ${arr[1]}; " - "str=$(cat $path/*_sum); arr=($str); " - "printf \"Count:\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\\n\" " - "${arr[0]} ${arr[5]} ${arr[3]} ${arr[4]} ${arr[2]} ${arr[1]};"}); - - std::string ufs_health = "for f in $(find /dev/sys/block/bootdevice/health_descriptor -type f); do if [[ -r $f && -f $f ]]; then echo --- $f; cat $f; echo ''; fi; done"; - RunCommandToFd(fd, "UFS health", {"/vendor/bin/sh", "-c", ufs_health.c_str()}); -} - -// Dump items related to storage -void Dumpstate::dumpStorageSection(int fd) { - DumpF2FS(fd); - DumpUFS(fd); -} - // Dump items related to display void Dumpstate::dumpDisplaySection(int fd) { - DumpFileToFd(fd, "CRTC-0 underrun count", "/sys/kernel/debug/dri/0/crtc-0/underrun_cnt"); - DumpFileToFd(fd, "CRTC-0 crc count", "/sys/kernel/debug/dri/0/crtc-0/crc_cnt"); - DumpFileToFd(fd, "CRTC-0 ecc count", "/sys/kernel/debug/dri/0/crtc-0/ecc_cnt"); - DumpFileToFd(fd, "CRTC-0 idma err count", "/sys/kernel/debug/dri/0/crtc-0/idma_err_cnt"); + // Dump counters for decon drivers + const std::string decon_device_sysfs_path("/sys/class/drm/card0/device/"); + for(int i = 0; i <= 2; ++i){ + const std::string decon_num_str = std::to_string(i); + const std::string decon_counter_path = decon_device_sysfs_path + + "decon" + decon_num_str + + "/counters"; + if (access(decon_counter_path.c_str(), R_OK) == 0){ + DumpFileToFd(fd, "DECON-" + decon_num_str + " counters", + decon_counter_path); + } + else{ + ::android::base::WriteStringToFd("No counters for DECON-" + + decon_num_str + " found at path (" + decon_counter_path + ")\n", + fd); + } + } DumpFileToFd(fd, "CRTC-0 event log", "/sys/kernel/debug/dri/0/crtc-0/event"); - DumpFileToFd(fd, "CRTC-1 underrun count", "/sys/kernel/debug/dri/0/crtc-1/underrun_cnt"); - DumpFileToFd(fd, "CRTC-1 crc count", "/sys/kernel/debug/dri/0/crtc-1/crc_cnt"); - DumpFileToFd(fd, "CRTC-1 ecc count", "/sys/kernel/debug/dri/0/crtc-1/ecc_cnt"); - DumpFileToFd(fd, "CRTC-1 idma err count", "/sys/kernel/debug/dri/0/crtc-1/idma_err_cnt"); DumpFileToFd(fd, "CRTC-1 event log", "/sys/kernel/debug/dri/0/crtc-1/event"); RunCommandToFd(fd, "libdisplaycolor", {"/vendor/bin/dumpsys", "displaycolor", "-v"}, CommandOptions::WithTimeout(2).Build()); @@ -1071,114 +577,28 @@ void Dumpstate::dumpDisplaySection(int fd) { DumpFileToFd(fd, "Primary panel extra info", "/sys/devices/platform/exynos-drm/primary-panel/panel_extinfo"); DumpFileToFd(fd, "Secondary panel name", "/sys/devices/platform/exynos-drm/secondary-panel/panel_name"); DumpFileToFd(fd, "Secondary panel extra info", "/sys/devices/platform/exynos-drm/secondary-panel/panel_extinfo"); -} - -// Dump items related to AoC -void Dumpstate::dumpAoCSection(int fd) { - DumpFileToFd(fd, "AoC Service Status", "/sys/devices/platform/19000000.aoc/services"); - DumpFileToFd(fd, "AoC Restarts", "/sys/devices/platform/19000000.aoc/restart_count"); - DumpFileToFd(fd, "AoC Coredumps", "/sys/devices/platform/19000000.aoc/coredump_count"); - DumpFileToFd(fd, "AoC ring buf wake", "/sys/devices/platform/19000000.aoc/control/ring_buffer_wakeup"); - DumpFileToFd(fd, "AoC host ipc wake", "/sys/devices/platform/19000000.aoc/control/host_ipc_wakeup"); - DumpFileToFd(fd, "AoC usf wake", "/sys/devices/platform/19000000.aoc/control/usf_wakeup"); - DumpFileToFd(fd, "AoC audio wake", "/sys/devices/platform/19000000.aoc/control/audio_wakeup"); - DumpFileToFd(fd, "AoC logging wake", "/sys/devices/platform/19000000.aoc/control/logging_wakeup"); - DumpFileToFd(fd, "AoC hotword wake", "/sys/devices/platform/19000000.aoc/control/hotword_wakeup"); - RunCommandToFd(fd, "AoC memory exception wake", - {"/vendor/bin/sh", "-c", "cat /sys/devices/platform/19000000.aoc/control/memory_exception"}, - CommandOptions::WithTimeout(2).Build()); - RunCommandToFd(fd, "AoC memory votes A32", - {"/vendor/bin/sh", "-c", "cat /sys/devices/platform/19000000.aoc/control/memory_votes_a32"}, - CommandOptions::WithTimeout(2).Build()); - RunCommandToFd(fd, "AoC memory votes FF1", - {"/vendor/bin/sh", "-c", "cat /sys/devices/platform/19000000.aoc/control/memory_votes_ff1"}, - CommandOptions::WithTimeout(2).Build()); - RunCommandToFd(fd, "AoC Heap Stats (A32)", - {"/vendor/bin/sh", "-c", "echo 'dbg heap -c 1' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug"}, - CommandOptions::WithTimeout(1).Build()); - RunCommandToFd(fd, "AoC Heap Stats (F1)", - {"/vendor/bin/sh", "-c", "echo 'dbg heap -c 2' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug"}, - CommandOptions::WithTimeout(1).Build()); - RunCommandToFd(fd, "AoC Heap Stats (HF0)", - {"/vendor/bin/sh", "-c", "echo 'dbg heap -c 3' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug"}, - CommandOptions::WithTimeout(1).Build()); - RunCommandToFd(fd, "AoC Heap Stats (HF1)", - {"/vendor/bin/sh", "-c", "echo 'dbg heap -c 4' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug"}, - CommandOptions::WithTimeout(1).Build()); -} - -// Dump items related to sensors usf. -void Dumpstate::dumpSensorsUSFSection(int fd) { - CommandOptions options = CommandOptions::WithTimeout(2).Build(); - RunCommandToFd(fd, "USF statistics", - {"/vendor/bin/sh", "-c", "usf_stats get --all"}, - options); if (!PropertiesHelper::IsUserBuild()) { - // Not a user build, if this is also not a production device dump the USF registry. - std::string hwRev = ::android::base::GetProperty(HW_REVISION, ""); - if (hwRev.find("PROTO") != std::string::npos || - hwRev.find("EVT") != std::string::npos || - hwRev.find("DVT") != std::string::npos) { - RunCommandToFd(fd, "USF Registry", - {"/vendor/bin/sh", "-c", "usf_reg_edit save -"}, - options); - RunCommandToFd(fd, "USF Last Stat Buffer", - {"/vendor/bin/sh", "-c", "cat /data/vendor/sensors/debug/stats.history"}, - options); - } + RunCommandToFd(fd, "HWC Fence States", {"/vendor/bin/sh", "-c", + "for f in $(ls /data/vendor/log/hwc/*_hwc_fence_state*.txt); do " + "echo $f ; cat $f ; done"}, + CommandOptions::WithTimeout(2).Build()); + RunCommandToFd(fd, "HWC Error Logs", {"/vendor/bin/sh", "-c", + "for f in $(ls /data/vendor/log/hwc/*_hwc_error_log*.txt); do " + "echo $f ; cat $f ; done"}, + CommandOptions::WithTimeout(2).Build()); + RunCommandToFd(fd, "HWC Debug Dumps", {"/vendor/bin/sh", "-c", + "for f in $(ls /data/vendor/log/hwc/*_hwc_debug*.dump); do " + "echo $f ; cat $f ; done"}, + CommandOptions::WithTimeout(2).Build()); } } -// Gzip binary data and dump to fd in base64 format. Cmd to decode is also attached. -void dumpGzippedFileInBase64ToFd(int fd, const char* title, const char* file_path) { - auto cmd = ::android::base::StringPrintf("echo 'base64 -d <<EOF | gunzip' ; " - "/vendor/bin/gzip < \"%s\" | /vendor/bin/base64 ; " - "echo 'EOF'", file_path); - RunCommandToFd(fd, title, - {"/vendor/bin/sh", "-c", cmd.c_str()}, - CommandOptions::WithTimeout(10).Build()); -} - -struct abl_log_header { - uint64_t i; - uint64_t size; - char buf[]; -} __attribute__((packed)); - -// Dump items related to ramdump. -void Dumpstate::dumpRamdumpSection(int fd) { - std::string abl_log; - if (::android::base::ReadFileToString("/mnt/vendor/ramdump/abl.log", &abl_log)) { - const struct abl_log_header *header = (const struct abl_log_header*) abl_log.c_str(); - ::android::base::WriteStringToFd(::android::base::StringPrintf( - "------ Ramdump misc file: abl.log (i:0x%" PRIx64 " size:0x%" PRIx64 ") ------\n%s\n", - header->i, header->size, std::string(header->buf, header->i).c_str()), fd); - } else { - ::android::base::WriteStringToFd("*** Ramdump misc file: abl.log: File not found\n", fd); - } - dumpGzippedFileInBase64ToFd( - fd, "Ramdump misc file: acpm.lst (gzipped in base64)", "/mnt/vendor/ramdump/acpm.lst"); - dumpGzippedFileInBase64ToFd( - fd, "Ramdump misc file: s2d.lst (gzipped in base64)", "/mnt/vendor/ramdump/s2d.lst"); -} - // Dump items that don't fit well into any other section void Dumpstate::dumpMiscSection(int fd) { RunCommandToFd(fd, "VENDOR PROPERTIES", {"/vendor/bin/getprop"}); DumpFileToFd(fd, "VENDOR PROC DUMP", "/proc/vendor_sched/dump_task"); } -// Dump items related to GSC -void Dumpstate::dumpGscSection(int fd) { - RunCommandToFd(fd, "Citadel VERSION", {"vendor/bin/hw/citadel_updater", "-lv"}); - RunCommandToFd(fd, "Citadel STATS", {"vendor/bin/hw/citadel_updater", "--stats"}); - RunCommandToFd(fd, "GSC DEBUG DUMP", {"vendor/bin/hw/citadel_updater", "-D"}); -} - -void Dumpstate::dumpTrustySection(int fd) { - RunCommandToFd(fd, "Trusty TEE0 Logs", {"/vendor/bin/sh", "-c", "cat /dev/trusty-log0"}, CommandOptions::WithTimeout(1).Build()); -} - // Dump items related to LED void Dumpstate::dumpLEDSection(int fd) { struct stat buffer; @@ -1194,18 +614,6 @@ void Dumpstate::dumpLEDSection(int fd) { } } -void Dumpstate::dumpModemSection(int fd) { - DumpFileToFd(fd, "Modem Stat", "/data/vendor/modem_stat/debug.txt"); - RunCommandToFd(fd, "Modem SSR history", {"/vendor/bin/sh", "-c", - "for f in $(ls /data/vendor/ssrdump/crashinfo_modem*); do " - "echo $f ; cat $f ; done"}, - CommandOptions::WithTimeout(2).Build()); - RunCommandToFd(fd, "RFSD error log", {"/vendor/bin/sh", "-c", - "for f in $(ls /data/vendor/log/rfsd/rfslog_*); do " - "echo $f ; cat $f ; done"}, - CommandOptions::WithTimeout(2).Build()); -} - void Dumpstate::dumpModemLogs(int fd, const std::string &destDir) { std::string extendedLogDir = MODEM_EXTENDED_LOG_DIRECTORY; std::string modemLogHistoryDir = MODEM_LOG_HISTORY_DIRECTORY; @@ -1365,14 +773,10 @@ void Dumpstate::dumpPixelTraceSection(int fd) { DumpFileToFd(fd, "Pixel trace", "/sys/kernel/tracing/instances/pixel/trace"); } -void Dumpstate::dumpPerfMetricsSection(int fd) { - DumpFileToFd(fd, "Long running IRQ metrics", "/sys/kernel/metrics/irq/long_irq_metrics"); - DumpFileToFd(fd, "Resume latency metrics", "/sys/kernel/metrics/resume_latency/resume_latency_metrics"); -} - ndk::ScopedAStatus Dumpstate::dumpstateBoard(const std::vector<::ndk::ScopedFileDescriptor>& in_fds, IDumpstateDevice::DumpstateMode in_mode, int64_t in_timeoutMillis) { + ATRACE_BEGIN("dumpstateBoard"); // Unused arguments. (void) in_timeoutMillis; @@ -1409,6 +813,7 @@ ndk::ScopedAStatus Dumpstate::dumpstateBoard(const std::vector<::ndk::ScopedFile dumpTextSection(fd, kAllSections); + ATRACE_END(); return ndk::ScopedAStatus::ok(); } diff --git a/dumpstate/Dumpstate.h b/dumpstate/Dumpstate.h index 805c1cb..f615a45 100644 --- a/dumpstate/Dumpstate.h +++ b/dumpstate/Dumpstate.h @@ -53,25 +53,13 @@ class Dumpstate : public BnDumpstateDevice { // Text sections that can be dumped individually on the command line in // addition to being included in full dumps void dumpWlanSection(int fd); - void dumpModemSection(int fd); void dumpPowerSection(int fd); - void dumpThermalSection(int fd); - void dumpTouchSection(int fd); - void dumpSocSection(int fd); - void dumpCpuSection(int fd); void dumpDevfreqSection(int fd); void dumpMemorySection(int fd); - void dumpStorageSection(int fd); void dumpDisplaySection(int fd); - void dumpSensorsUSFSection(int fd); - void dumpAoCSection(int fd); - void dumpRamdumpSection(int fd); void dumpMiscSection(int fd); - void dumpGscSection(int fd); - void dumpTrustySection(int fd); void dumpLEDSection(int fd); void dumpPixelTraceSection(int fd); - void dumpPerfMetricsSection(int fd); void dumpLogSection(int fd, int fdModem); diff --git a/dumpstate/OWNERS b/dumpstate/OWNERS new file mode 100644 index 0000000..5859d10 --- /dev/null +++ b/dumpstate/OWNERS @@ -0,0 +1,9 @@ +aaronding@google.com +rurumihong@google.com +adamshih@google.com +wilsonsung@google.com +lucaswei@google.com +cyanhsieh@google.com +rogerliao@google.com +cyuanjen@google.com +robinpeng@google.com diff --git a/dumpstate/README.txt b/dumpstate/README.txt new file mode 100644 index 0000000..b279bda --- /dev/null +++ b/dumpstate/README.txt @@ -0,0 +1 @@ +Please refer to go/pixel-recycle to modularize your code in this space. diff --git a/dumpstate/android.hardware.dumpstate-service.gs201.xml b/dumpstate/android.hardware.dumpstate-service.gs201.xml new file mode 100644 index 0000000..5e51b28 --- /dev/null +++ b/dumpstate/android.hardware.dumpstate-service.gs201.xml @@ -0,0 +1,9 @@ +<manifest version="1.0" type="device"> + <hal format="aidl"> + <name>android.hardware.dumpstate</name> + <interface> + <name>IDumpstateDevice</name> + <instance>default</instance> + </interface> + </hal> +</manifest> diff --git a/dumpstate/android.hardware.dumpstate@1.1-service.gs201.rc b/dumpstate/android.hardware.dumpstate@1.1-service.gs201.rc index 65456d1..f2452dc 100644 --- a/dumpstate/android.hardware.dumpstate@1.1-service.gs201.rc +++ b/dumpstate/android.hardware.dumpstate@1.1-service.gs201.rc @@ -1,5 +1,5 @@ service vendor.dumpstate-default /vendor/bin/hw/android.hardware.dumpstate-service.gs201 class hal user system - group system + group system shell interface aidl android.hardware.dumpstate.IDumpstateDevice/default |