Move power stats service to device specific folders

Bug: 183052760
Test: dumpsys android.hardware.power.stats.IPowerStats/default
Change-Id: I4d4881e227982aa17b88af8844c82dc448ef5b6f
Merged-In: I4d4881e227982aa17b88af8844c82dc448ef5b6f
This commit is contained in:
Benjamin Schwartz 2021-03-18 17:57:13 -07:00 committed by TreeHugger Robot
parent 1a1a12cd55
commit 3c712491cf
5 changed files with 33 additions and 49 deletions

View file

@ -22,30 +22,17 @@ package {
],
}
cc_binary {
name: "android.hardware.power.stats-service.pixel",
init_rc: ["android.hardware.power.stats-service.pixel.rc"],
vintf_fragments: ["android.hardware.power.stats-service.pixel.xml"],
cc_library {
name: "android.hardware.power.stats-impl.gs101",
vendor_available: true,
export_include_dirs: ["include"],
defaults: ["powerstats_pixel_defaults"],
srcs: [
"*.cpp",
],
cflags: [
"-Wall",
"-Werror",
],
static_libs: [
shared_libs: [
"android.hardware.power.stats-impl.pixel",
],
shared_libs: [
"libbase",
"libcutils",
"liblog",
"libutils",
"libbinder_ndk",
"pixel_stateresidency_provider_aidl_interface-ndk_platform",
"android.hardware.power.stats-V1-ndk_platform",
],
relative_install_path: "hw",
vendor: true,
proprietary: true,
}

View file

@ -14,9 +14,8 @@
* limitations under the License.
*/
#define LOG_TAG "android.hardware.power.stats-service.pixel"
#include <PowerStatsAidl.h>
#include <Gs101CommonDataProviders.h>
#include "AocStateResidencyDataProvider.h"
#include "DvfsStateResidencyDataProvider.h"
#include "UfsStateResidencyDataProvider.h"
@ -41,7 +40,6 @@ using aidl::android::hardware::power::stats::EnergyConsumerType;
using aidl::android::hardware::power::stats::GenericStateResidencyDataProvider;
using aidl::android::hardware::power::stats::IioEnergyMeterDataProvider;
using aidl::android::hardware::power::stats::PixelStateResidencyDataProvider;
using aidl::android::hardware::power::stats::PowerStats;
using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer;
constexpr char kBootHwSoCRev[] = "ro.boot.hw.soc.rev";
@ -575,14 +573,7 @@ void addPixelStateResidencyDataProvider(std::shared_ptr<PowerStats> p) {
p->addStateResidencyDataProvider(std::move(pixelSdp));
}
int main() {
LOG(INFO) << "Pixel PowerStats HAL AIDL Service is starting.";
// single thread
ABinderProcess_setThreadPoolMaxThreadCount(0);
std::shared_ptr<PowerStats> p = ndk::SharedRefBase::make<PowerStats>();
void addGs101CommonDataProviders(std::shared_ptr<PowerStats> p) {
setEnergyMeter(p);
addPixelStateResidencyDataProvider(p);
@ -602,11 +593,4 @@ int main() {
// TODO (b/181070764) (b/182941084):
// Remove this when Wifi/BT energy consumption models are available or revert before ship
addPlaceholderEnergyConsumers(p);
const std::string instance = std::string() + PowerStats::descriptor + "/default";
binder_status_t status = AServiceManager_addService(p->asBinder().get(), instance.c_str());
LOG_ALWAYS_FATAL_IF(status != STATUS_OK);
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // should not reach
}

View file

@ -1,4 +0,0 @@
service vendor.power.stats.pixel /vendor/bin/hw/android.hardware.power.stats-service.pixel
class hal
user system
group system

View file

@ -1,6 +0,0 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.power.stats</name>
<fqname>IPowerStats/default</fqname>
</hal>
</manifest>

View file

@ -0,0 +1,23 @@
/*
* Copyright (C) 2021 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.
*/
#pragma once
#include <PowerStatsAidl.h>
using aidl::android::hardware::power::stats::PowerStats;
void addGs101CommonDataProviders(std::shared_ptr<PowerStats> p);