summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BoardConfig.mk2
-rw-r--r--dumpstate/Android.mk29
-rw-r--r--dumpstate/DumpstateDevice.cpp76
-rw-r--r--dumpstate/DumpstateDevice.h50
-rw-r--r--dumpstate/NOTICE2
-rw-r--r--dumpstate/android.hardware.dumpstate@1.0-service.angler.rc4
-rw-r--r--dumpstate/dumpstate.cpp43
-rw-r--r--dumpstate/service.cpp35
-rw-r--r--sepolicy/file_contexts1
-rw-r--r--sepolicy/hal_dumpstate_impl.te9
10 files changed, 197 insertions, 54 deletions
diff --git a/BoardConfig.mk b/BoardConfig.mk
index d2d9b80..b7830f9 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -85,8 +85,6 @@ BOARD_CACHEIMAGE_PARTITION_SIZE := 104857600
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_FLASH_BLOCK_SIZE := 131072
-BOARD_HAL_STATIC_LIBRARIES := libdumpstate.angler
-
TARGET_AUX_OS_VARIANT_LIST := angler
TARGET_RECOVERY_FSTAB = device/huawei/angler/fstab.angler
diff --git a/dumpstate/Android.mk b/dumpstate/Android.mk
index 3f263f1..0ab008b 100644
--- a/dumpstate/Android.mk
+++ b/dumpstate/Android.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2015 The Android Open Source Project
+# Copyright (C) 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.
@@ -12,15 +12,28 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_STATIC_LIBRARIES := libdumpstateheaders
+LOCAL_PATH := $(call my-dir)
-LOCAL_SRC_FILES := dumpstate.cpp
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.dumpstate@1.0-service.angler
+LOCAL_INIT_RC := android.hardware.dumpstate@1.0-service.angler.rc
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := \
+ DumpstateDevice.cpp \
+ service.cpp
-LOCAL_MODULE := libdumpstate.angler
+LOCAL_SHARED_LIBRARIES := \
+ android.hardware.dumpstate@1.0 \
+ libbase \
+ libcutils \
+ libdumpstateutil \
+ libhidlbase \
+ libhidltransport \
+ libhwbinder \
+ liblog \
+ libutils
LOCAL_MODULE_TAGS := optional
+LOCAL_PROPRIETARY_MODULE := true
-include $(BUILD_STATIC_LIBRARY)
+include $(BUILD_EXECUTABLE)
diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp
new file mode 100644
index 0000000..62e14be
--- /dev/null
+++ b/dumpstate/DumpstateDevice.cpp
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 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.
+ */
+
+#define LOG_TAG "dumpstate"
+
+#include "DumpstateDevice.h"
+
+#include <log/log.h>
+
+#include "DumpstateUtil.h"
+
+using android::os::dumpstate::CommandOptions;
+using android::os::dumpstate::DumpFileToFd;
+using android::os::dumpstate::RunCommandToFd;
+
+namespace android {
+namespace hardware {
+namespace dumpstate {
+namespace V1_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.
+Return<void> DumpstateDevice::dumpstateBoard(const hidl_handle& handle) {
+ if (handle->numFds < 1) {
+ ALOGE("no FDs\n");
+ return Void();
+ }
+
+ int fd = handle->data[0];
+ if (fd < 0) {
+ ALOGE("invalid FD: %d\n", handle->data[0]);
+ return Void();
+ }
+
+ DumpFileToFd(fd, "INTERRUPTS", "/proc/interrupts");
+ DumpFileToFd(fd, "RPM Stats", "/d/rpm_stats");
+ DumpFileToFd(fd, "Power Management Stats", "/d/rpm_master_stats");
+ RunCommandToFd(fd, "SUBSYSTEM TOMBSTONES", {"ls", "-l", "/data/tombstones/ramdump"}, CommandOptions::AS_ROOT);
+ DumpFileToFd(fd, "BAM DMUX Log", "/d/ipc_logging/bam_dmux/log");
+ DumpFileToFd(fd, "SMD Log", "/d/ipc_logging/smd/log");
+ DumpFileToFd(fd, "SMD PKT Log", "/d/ipc_logging/smd_pkt/log");
+ DumpFileToFd(fd, "IPC Router Log", "/d/ipc_logging/ipc_router/log");
+ DumpFileToFd(fd, "Enabled Clocks", "/d/clk/enabled_clocks");
+ DumpFileToFd(fd, "wlan", "/sys/module/bcmdhd/parameters/info_string");
+ RunCommandToFd(fd, "ION HEAPS", {"/system/bin/sh", "-c", "for d in $(ls -d /d/ion/*); do for f in $(ls $d); do echo --- $d/$f; cat $d/$f; done; done"}, CommandOptions::AS_ROOT);
+ RunCommandToFd(fd, "Temperatures", {"/system/bin/sh", "-c", "for f in die_temp emmc_therm msm_therm pa_therm1 quiet_therm ; do echo -n \"$f : \" ; cat /sys/class/hwmon/hwmon1/device/$f ; done ; for f in `ls /sys/class/thermal` ; do type=`cat /sys/class/thermal/$f/type` ; temp=`cat /sys/class/thermal/$f/temp` ; echo \"$type: $temp\" ; done"}, CommandOptions::AS_ROOT);
+ DumpFileToFd(fd, "dmesg-ramoops-0", "/sys/fs/pstore/dmesg-ramoops-0");
+ DumpFileToFd(fd, "dmesg-ramoops-1", "/sys/fs/pstore/dmesg-ramoops-1");
+ DumpFileToFd(fd, "LITTLE cluster time-in-state", "/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state");
+ RunCommandToFd(fd, "LITTLE cluster cpuidle", {"/system/bin/sh", "-c", "for d in $(ls -d /sys/devices/system/cpu/cpu0/cpuidle/state*); do echo \"$d: `cat $d/name` `cat $d/desc` `cat $d/time` `cat $d/usage`\"; done"}, CommandOptions::AS_ROOT);
+ DumpFileToFd(fd, "big cluster time-in-state", "/sys/devices/system/cpu/cpu4/cpufreq/stats/time_in_state");
+ RunCommandToFd(fd,"big cluster cpuidle", {"/system/bin/sh", "-c", "for d in $(ls -d /sys/devices/system/cpu/cpu4/cpuidle/state*); do echo \"$d: `cat $d/name` `cat $d/desc` `cat $d/time` `cat $d/usage`\"; done"}, CommandOptions::AS_ROOT);
+ DumpFileToFd(fd, "Battery:", "/sys/class/power_supply/bms/uevent");
+ RunCommandToFd(fd, "Battery:", {"/system/bin/sh", "-c", "for f in 1 2 3 4 5 6 7 8; do echo $f > /sys/class/power_supply/bms/cycle_count_id; echo \"$f: `cat /sys/class/power_supply/bms/cycle_count`\"; done"}, CommandOptions::AS_ROOT);
+
+ return Void();
+}
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace dumpstate
+} // namespace hardware
+} // namespace android
diff --git a/dumpstate/DumpstateDevice.h b/dumpstate/DumpstateDevice.h
new file mode 100644
index 0000000..f8585f5
--- /dev/null
+++ b/dumpstate/DumpstateDevice.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 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.
+ */
+#ifndef ANDROID_HARDWARE_DUMPSTATE_V1_0_DUMPSTATEDEVICE_H
+#define ANDROID_HARDWARE_DUMPSTATE_V1_0_DUMPSTATEDEVICE_H
+
+#include <android/hardware/dumpstate/1.0/IDumpstateDevice.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace dumpstate {
+namespace V1_0 {
+namespace implementation {
+
+using ::android::hardware::dumpstate::V1_0::IDumpstateDevice;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_handle;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::sp;
+
+struct DumpstateDevice : public IDumpstateDevice {
+ // Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.
+ Return<void> dumpstateBoard(const hidl_handle& h) override;
+
+};
+
+} // namespace implementation
+} // namespace V1_0
+} // namespace dumpstate
+} // namespace hardware
+} // namespace android
+
+#endif // ANDROID_HARDWARE_DUMPSTATE_V1_0_DUMPSTATEDEVICE_H
diff --git a/dumpstate/NOTICE b/dumpstate/NOTICE
index 1a5b8e4..e48dd6b 100644
--- a/dumpstate/NOTICE
+++ b/dumpstate/NOTICE
@@ -1,5 +1,5 @@
- Copyright (C) 2015 The Android Open Source Project
+ Copyright (C) 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.
diff --git a/dumpstate/android.hardware.dumpstate@1.0-service.angler.rc b/dumpstate/android.hardware.dumpstate@1.0-service.angler.rc
new file mode 100644
index 0000000..8fd84b2
--- /dev/null
+++ b/dumpstate/android.hardware.dumpstate@1.0-service.angler.rc
@@ -0,0 +1,4 @@
+service dumpstate-1-0 /vendor/bin/hw/android.hardware.dumpstate@1.0-service.angler
+ class hal
+ user system
+ group system
diff --git a/dumpstate/dumpstate.cpp b/dumpstate/dumpstate.cpp
deleted file mode 100644
index afc5bda..0000000
--- a/dumpstate/dumpstate.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2015 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.
- */
-
-#include <dumpstate.h>
-
-void dumpstate_board()
-{
- Dumpstate& ds = Dumpstate::GetInstance();
-
- ds.DumpFile("INTERRUPTS", "/proc/interrupts");
- ds.DumpFile("RPM Stats", "/d/rpm_stats");
- ds.DumpFile("Power Management Stats", "/d/rpm_master_stats");
- ds.RunCommand("SUBSYSTEM TOMBSTONES", {"ls", "-l", "/data/tombstones/ramdump"}, CommandOptions::AS_ROOT_5);
- ds.DumpFile("BAM DMUX Log", "/d/ipc_logging/bam_dmux/log");
- ds.DumpFile("SMD Log", "/d/ipc_logging/smd/log");
- ds.DumpFile("SMD PKT Log", "/d/ipc_logging/smd_pkt/log");
- ds.DumpFile("IPC Router Log", "/d/ipc_logging/ipc_router/log");
- ds.DumpFile("Enabled Clocks", "/d/clk/enabled_clocks");
- ds.DumpFile("wlan", "/sys/module/bcmdhd/parameters/info_string");
- ds.RunCommand("ION HEAPS", {"/system/bin/sh", "-c", "for d in $(ls -d /d/ion/*); do for f in $(ls $d); do echo --- $d/$f; cat $d/$f; done; done"}, CommandOptions::AS_ROOT_5);
- ds.RunCommand("Temperatures", {"/system/bin/sh", "-c", "for f in die_temp emmc_therm msm_therm pa_therm1 quiet_therm ; do echo -n \"$f : \" ; cat /sys/class/hwmon/hwmon1/device/$f ; done ; for f in `ls /sys/class/thermal` ; do type=`cat /sys/class/thermal/$f/type` ; temp=`cat /sys/class/thermal/$f/temp` ; echo \"$type: $temp\" ; done"}, CommandOptions::AS_ROOT_5);
- ds.DumpFile("dmesg-ramoops-0", "/sys/fs/pstore/dmesg-ramoops-0");
- ds.DumpFile("dmesg-ramoops-1", "/sys/fs/pstore/dmesg-ramoops-1");
- ds.DumpFile("LITTLE cluster time-in-state", "/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state");
- ds.RunCommand("LITTLE cluster cpuidle", {"/system/bin/sh", "-c", "for d in $(ls -d /sys/devices/system/cpu/cpu0/cpuidle/state*); do echo \"$d: `cat $d/name` `cat $d/desc` `cat $d/time` `cat $d/usage`\"; done"}, CommandOptions::AS_ROOT_5);
- ds.DumpFile("big cluster time-in-state", "/sys/devices/system/cpu/cpu4/cpufreq/stats/time_in_state");
- ds.RunCommand("big cluster cpuidle", {"/system/bin/sh", "-c", "for d in $(ls -d /sys/devices/system/cpu/cpu4/cpuidle/state*); do echo \"$d: `cat $d/name` `cat $d/desc` `cat $d/time` `cat $d/usage`\"; done"}, CommandOptions::AS_ROOT_5);
- ds.DumpFile("Battery:", "/sys/class/power_supply/bms/uevent");
- ds.RunCommand("Battery:", {"/system/bin/sh", "-c", "for f in 1 2 3 4 5 6 7 8; do echo $f > /sys/class/power_supply/bms/cycle_count_id; echo \"$f: `cat /sys/class/power_supply/bms/cycle_count`\"; done"}, CommandOptions::AS_ROOT_5);
-};
diff --git a/dumpstate/service.cpp b/dumpstate/service.cpp
new file mode 100644
index 0000000..b897aed
--- /dev/null
+++ b/dumpstate/service.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 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.
+ */
+#define LOG_TAG "android.hardware.dumpstate@1.0-service.angler"
+
+#include <hidl/HidlSupport.h>
+#include <hidl/HidlTransportSupport.h>
+
+#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::joinRpcThreadpool;
+using ::android::sp;
+
+
+int main(int /* argc */, char* /* argv */ []) {
+ sp<IDumpstateDevice> dumpstate = new DumpstateDevice;
+ configureRpcThreadpool(1, true);
+ dumpstate->registerAsService("dumpstate");
+ joinRpcThreadpool();
+}
diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts
index ad4c871..2edc942 100644
--- a/sepolicy/file_contexts
+++ b/sepolicy/file_contexts
@@ -121,6 +121,7 @@
# System files
/vendor/bin/ATFWD-daemon u:object_r:atfwd_exec:s0
/vendor/bin/cnd u:object_r:cnd_exec:s0
+/vendor/bin/hw/android\.hardware\.dumpstate@1\.0-service.angler u:object_r:hal_dumpstate_default_exec:s0
/vendor/bin/imscmservice u:object_r:ims_exec:s0
/vendor/bin/imsdatadaemon u:object_r:ims_exec:s0
/vendor/bin/imsqmidaemon u:object_r:ims_exec:s0
diff --git a/sepolicy/hal_dumpstate_impl.te b/sepolicy/hal_dumpstate_impl.te
new file mode 100644
index 0000000..e8e098d
--- /dev/null
+++ b/sepolicy/hal_dumpstate_impl.te
@@ -0,0 +1,9 @@
+type hal_dumpstate_impl, domain, hal_dumpstate;
+type hal_dumpstate_impl_exec, exec_type, file_type;
+
+init_daemon_domain(hal_dumpstate_impl)
+
+# Access to files for dumping
+allow hal_dumpstate_impl proc_interrupts:file { open read };
+allow hal_dumpstate_impl pstorefs:dir search;
+allow hal_dumpstate_impl sysfs:file { open read };