From 2ec6373901aa4c09926ddcdfa07594f07ee3d119 Mon Sep 17 00:00:00 2001 From: Cyan_Hsieh Date: Mon, 5 Aug 2019 21:10:32 +0800 Subject: 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 --- pixelstats/Android.bp | 36 +++++++++++++++++++ pixelstats/pixelstats-vendor.sunfish.rc | 4 +++ pixelstats/service.cpp | 62 +++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+) create mode 100644 pixelstats/Android.bp create mode 100644 pixelstats/pixelstats-vendor.sunfish.rc create mode 100644 pixelstats/service.cpp (limited to 'pixelstats') 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 +#include + +#include +#include +#include + +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 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; +} -- cgit v1.2.3