diff options
author | Roger Liao <rogerliao@google.com> | 2019-07-22 18:20:48 +0800 |
---|---|---|
committer | Roger Liao <rogerliao@google.com> | 2019-07-26 20:43:32 +0800 |
commit | 5bcecdaa3e4a7abf12bd2bbacbfddc5e19af3031 (patch) | |
tree | f5a2b8b1b19e88b55764c9a111aec4f4d6786615 /pixelstats | |
parent | f65dfc2df46010a7b3ba21e13b594cda9cb123a6 (diff) | |
download | bramble-5bcecdaa3e4a7abf12bd2bbacbfddc5e19af3031.tar.gz |
Create aosp_bramble target
Bug: 138083938
Bug: 137166127
Change-Id: I9c4c318e5c7942fed113131a90ad7a94fd3a8fa6
Diffstat (limited to 'pixelstats')
-rw-r--r-- | pixelstats/Android.bp | 36 | ||||
-rw-r--r-- | pixelstats/pixelstats-vendor.bramble.rc | 4 | ||||
-rw-r--r-- | pixelstats/service.cpp | 62 |
3 files changed, 102 insertions, 0 deletions
diff --git a/pixelstats/Android.bp b/pixelstats/Android.bp new file mode 100644 index 0000000..d6c8e01 --- /dev/null +++ b/pixelstats/Android.bp @@ -0,0 +1,36 @@ +// +// Copyright (C) 2017 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.bramble.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.bramble.rc b/pixelstats/pixelstats-vendor.bramble.rc new file mode 100644 index 0000000..9410090 --- /dev/null +++ b/pixelstats/pixelstats-vendor.bramble.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 0000000..5e8abc5 --- /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; +} |