diff --git a/Android.bp b/Android.bp new file mode 100644 index 00000000..61f4f2f2 --- /dev/null +++ b/Android.bp @@ -0,0 +1,17 @@ +// +// 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. +soong_namespace { + imports: ["hardware/google/pixel"], +} diff --git a/device.mk b/device.mk index 7d785b7e..053b3bc3 100755 --- a/device.mk +++ b/device.mk @@ -14,6 +14,10 @@ # limitations under the License. # +PRODUCT_SOONG_NAMESPACES += \ + device/google/wahoo \ + hardware/google/pixel + ifneq (,$(filter 27, $(PRODUCT_EXTRA_VNDK_VERSIONS))) _vndk_test := true endif diff --git a/power-libperfmgr/Android.bp b/power-libperfmgr/Android.bp index 8deca675..c76ff9bc 100644 --- a/power-libperfmgr/Android.bp +++ b/power-libperfmgr/Android.bp @@ -21,6 +21,9 @@ cc_binary { "-Wall", "-Werror", ], + static_libs: [ + "libpixelpowerstats", + ], shared_libs: [ "libbase", "libhidlbase", diff --git a/power-libperfmgr/Power.cpp b/power-libperfmgr/Power.cpp index 0b36c9e9..90381faf 100644 --- a/power-libperfmgr/Power.cpp +++ b/power-libperfmgr/Power.cpp @@ -23,6 +23,8 @@ #include #include +#include + #include #include @@ -50,6 +52,8 @@ using ::android::hardware::power::V1_1::PowerStateSubsystemSleepState; using ::android::hardware::hidl_vec; using ::android::hardware::Return; using ::android::hardware::Void; +using ::hardware::google::pixel::powerstats::DumpPowerHal1_0PlatStatsToFd; +using ::hardware::google::pixel::powerstats::DumpPowerHal1_1SubsysStatsToFd; Power::Power() : mHintManager(nullptr), @@ -545,6 +549,21 @@ Return Power::debug(const hidl_handle& handle, const hidl_vec if (!android::base::WriteStringToFd(buf, fd)) { PLOG(ERROR) << "Failed to dump state to fd"; } + + // Dump platform low power stats + getPlatformLowPowerStats([fd](const auto& platStats, const auto result) { + if (!DumpPowerHal1_0PlatStatsToFd(result, platStats, fd)) { + PLOG(ERROR) << "Failed to dump platform low power stats to fd"; + } + }); + + // Dump subsystem low power stats + getSubsystemLowPowerStats([fd](const auto& subsysStats, const auto result) { + if (!DumpPowerHal1_1SubsysStatsToFd(result, subsysStats, fd)) { + PLOG(ERROR) << "Failed to dump subsystem low power stats to fd"; + } + }); + fsync(fd); } return Void();