summaryrefslogtreecommitdiff
path: root/pixelstats
diff options
context:
space:
mode:
authorCyan_Hsieh <cyanhsieh@google.com>2019-08-05 21:10:32 +0800
committerCyan_Hsieh <cyanhsieh@google.com>2019-08-21 16:59:10 +0800
commit2ec6373901aa4c09926ddcdfa07594f07ee3d119 (patch)
tree3dfc3d5ceed2e6042814f55d6615be18255ea659 /pixelstats
parent9a27c2db876f87b6230bbc87d35c7b978fbe4899 (diff)
downloadsunfish-2ec6373901aa4c09926ddcdfa07594f07ee3d119.tar.gz
Initial S5 device folder
Reference 67d47b661b457286b602df626c3aa8ba0bc721fe aa6f4ddc29c893aacb41e3ae06ae031b605bbde4 device/qcom/common and device/qcom/sm6150 of LA.UM.8.9.R1.09.00.00.558.029 Bug: 139269901 Change-Id: I663fd9ae5d0ecb92c579200cef9eae6f6c0e3ccd
Diffstat (limited to 'pixelstats')
-rw-r--r--pixelstats/Android.bp36
-rw-r--r--pixelstats/pixelstats-vendor.sunfish.rc4
-rw-r--r--pixelstats/service.cpp62
3 files changed, 102 insertions, 0 deletions
diff --git a/pixelstats/Android.bp b/pixelstats/Android.bp
new file mode 100644
index 00000000..d096d40e
--- /dev/null
+++ b/pixelstats/Android.bp
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2019 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.
+
+cc_binary {
+ name: "pixelstats-vendor",
+ init_rc: ["pixelstats-vendor.sunfish.rc"],
+ srcs: [
+ "service.cpp",
+ ],
+ shared_libs: [
+ "libbase",
+ "libbinder",
+ "libcutils",
+ "libhidlbase",
+ "libhidltransport",
+ "liblog",
+ "libutils",
+ "libpixelstats",
+ ],
+ proprietary: true,
+ static_libs: ["chre_client"],
+ header_libs: ["chre_api"],
+}
+
diff --git a/pixelstats/pixelstats-vendor.sunfish.rc b/pixelstats/pixelstats-vendor.sunfish.rc
new file mode 100644
index 00000000..9410090c
--- /dev/null
+++ b/pixelstats/pixelstats-vendor.sunfish.rc
@@ -0,0 +1,4 @@
+service vendor.pixelstats_vendor /vendor/bin/pixelstats-vendor
+ class hal
+ user system
+ group system
diff --git a/pixelstats/service.cpp b/pixelstats/service.cpp
new file mode 100644
index 00000000..5e8abc55
--- /dev/null
+++ b/pixelstats/service.cpp
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2018 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 "pixelstats"
+
+#include <android-base/logging.h>
+#include <utils/StrongPointer.h>
+
+#include <pixelstats/DropDetect.h>
+#include <pixelstats/SysfsCollector.h>
+#include <pixelstats/UeventListener.h>
+
+using android::sp;
+using android::hardware::google::pixel::DropDetect;
+using android::hardware::google::pixel::SysfsCollector;
+using android::hardware::google::pixel::UeventListener;
+
+#define UFSHC_PATH(filename) "/sys/devices/platform/soc/1d84000.ufshc/" #filename
+const struct SysfsCollector::SysfsPaths sysfs_paths = {
+ .SlowioReadCntPath = UFSHC_PATH(slowio_read_cnt),
+ .SlowioWriteCntPath = UFSHC_PATH(slowio_write_cnt),
+ .SlowioUnmapCntPath = UFSHC_PATH(slowio_unmap_cnt),
+ .SlowioSyncCntPath = UFSHC_PATH(slowio_sync_cnt),
+ .CycleCountBinsPath = "/sys/class/power_supply/maxfg/cycle_counts_bins",
+ .ImpedancePath = "/sys/class/misc/msm_cirrus_playback/resistance_left_right",
+ .CodecPath = "", // b/117976641
+};
+
+const char *const kAudioUevent = "/kernel/q6audio/q6voice_uevent";
+
+int main() {
+ LOG(INFO) << "starting PixelStats";
+
+ // b/118713028 Expect failure until drop detect nanoapp is enabled
+ sp<DropDetect> dropDetector = DropDetect::start();
+ if (!dropDetector) {
+ LOG(ERROR) << "Unable to launch drop detection";
+ return 1;
+ }
+
+ UeventListener ueventListener(kAudioUevent);
+ std::thread listenThread(&UeventListener::ListenForever, &ueventListener);
+ listenThread.detach();
+
+ SysfsCollector collector(sysfs_paths);
+ collector.collect(); // This blocks forever.
+
+ return 0;
+}