bm: Support battery mitigation aidl
- move cc_binary to vendor/google/interfaces/ battery_mitigation - fix sepolicy to support aidl Bug: 299700579 Change-Id: I7345ffc1e2ddb46d9979a1fadef39dd0c2c281d6 Signed-off-by: samou <samou@google.com>
This commit is contained in:
parent
27017fb06a
commit
e6dce88732
9 changed files with 25 additions and 387 deletions
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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",
|
||||
],
|
||||
}
|
||||
|
||||
package {
|
||||
default_applicable_licenses: ["Android-Apache-2.0"],
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
vendor: true,
|
||||
name: "battery_mitigation",
|
||||
relative_install_path: "hw",
|
||||
proprietary: true,
|
||||
init_rc: ["battery_mitigation.rc"],
|
||||
shared_libs: [
|
||||
"libpixelmitigation",
|
||||
"libbase",
|
||||
"libbinder_ndk",
|
||||
"libcutils",
|
||||
"libhardware",
|
||||
"liblog",
|
||||
"libutils",
|
||||
"android.hardware.thermal@2.0",
|
||||
"android.hardware.thermal-V1-ndk"
|
||||
],
|
||||
srcs: [
|
||||
"battery_mitigation.cpp",
|
||||
],
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
],
|
||||
}
|
|
@ -1,221 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2022 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 "battery-mitigation"
|
||||
|
||||
#include <android/binder_process.h>
|
||||
#include <battery_mitigation/BatteryMitigation.h>
|
||||
#include <battery_mitigation/BatteryMitigationService.h>
|
||||
#include <sys/resource.h>
|
||||
#include <system/thread_defs.h>
|
||||
|
||||
#define COUNT_LIMIT 10
|
||||
|
||||
using android::hardware::google::pixel::BatteryMitigation;
|
||||
using android::hardware::google::pixel::BatteryMitigationService;
|
||||
using android::hardware::google::pixel::MitigationConfig;
|
||||
|
||||
android::sp<BatteryMitigation> bmSp;
|
||||
android::sp<BatteryMitigationService> batteryMitigationService;
|
||||
|
||||
const struct MitigationConfig::Config cfg = {
|
||||
.SystemPath = {
|
||||
"/dev/thermal/tz-by-name/batoilo/temp",
|
||||
"/dev/thermal/tz-by-name/smpl_gm/temp",
|
||||
"/dev/thermal/tz-by-name/soc/temp",
|
||||
"/dev/thermal/tz-by-name/vdroop1/temp",
|
||||
"/dev/thermal/tz-by-name/vdroop2/temp",
|
||||
"/dev/thermal/tz-by-name/ocp_gpu/temp",
|
||||
"/dev/thermal/tz-by-name/ocp_tpu/temp",
|
||||
"/dev/thermal/tz-by-name/soft_ocp_cpu2/temp",
|
||||
"/dev/thermal/tz-by-name/soft_ocp_cpu1/temp",
|
||||
"/dev/thermal/tz-by-name/battery/temp",
|
||||
"/dev/thermal/tz-by-name/battery_cycle/temp",
|
||||
"/sys/bus/iio/devices/iio:device0/lpf_power",
|
||||
"/sys/bus/iio/devices/iio:device1/lpf_power",
|
||||
"/dev/thermal/cdev-by-name/thermal-cpufreq-2/cur_state",
|
||||
"/dev/thermal/cdev-by-name/thermal-cpufreq-1/cur_state",
|
||||
"/dev/thermal/cdev-by-name/thermal-gpufreq-0/cur_state",
|
||||
"/dev/thermal/cdev-by-name/tpu_cooling/cur_state",
|
||||
"/dev/thermal/cdev-by-name/CAM/cur_state",
|
||||
"/dev/thermal/cdev-by-name/DISP/cur_state",
|
||||
"/dev/thermal/cdev-by-name/gxp-cooling/cur_state",
|
||||
"/sys/class/power_supply/battery/voltage_now",
|
||||
"/sys/class/power_supply/battery/current_now",
|
||||
},
|
||||
.FilteredZones = {
|
||||
"batoilo",
|
||||
"vdroop1",
|
||||
"vdroop2",
|
||||
"smpl_gm",
|
||||
},
|
||||
.SystemName = {
|
||||
"batoilo", "smpl_gm", "soc", "vdroop1", "vdroop2", "ocp_gpu",
|
||||
"ocp_tpu", "soft_ocp_cpu2", "soft_ocp_cpu1", "battery", "battery_cycle",
|
||||
"main", "sub", "CPU2", "CPU1", "GPU", "TPU", "CAM", "DISP", "NPU",
|
||||
"voltage_now", "current_now",
|
||||
},
|
||||
.LogFilePath = "/data/vendor/mitigation/thismeal.txt",
|
||||
.TimestampFormat = "%Y-%m-%d %H:%M:%S",
|
||||
};
|
||||
|
||||
const struct MitigationConfig::EventThreadConfig eventThreadCfg = {
|
||||
.BrownoutStatsEnablePath = "/sys/devices/virtual/pmic/mitigation/br_stats/enable_br_stats",
|
||||
.NumericSysfsStatPaths = {
|
||||
{"cpu0_freq", "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"},
|
||||
{"cpu1_freq", "/sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq"},
|
||||
{"cpu2_freq", "/sys/devices/system/cpu/cpu2/cpufreq/scaling_cur_freq"},
|
||||
{"battery_temp", "/dev/thermal/tz-by-name/battery/temp"},
|
||||
{"battery_cycle", "/dev/thermal/tz-by-name/battery_cycle/temp"},
|
||||
{"voltage_now", "/sys/class/power_supply/battery/voltage_now"},
|
||||
{"current_now", "/sys/class/power_supply/battery/current_now"},
|
||||
},
|
||||
.TriggeredIdxPath = "/sys/devices/virtual/pmic/mitigation/br_stats/triggered_idx",
|
||||
.triggeredStatePath[android::hardware::google::pixel::UVLO1] =
|
||||
"/sys/devices/virtual/pmic/mitigation/triggered_state/uvlo1_triggered",
|
||||
.triggeredStatePath[android::hardware::google::pixel::UVLO2] =
|
||||
"/sys/devices/virtual/pmic/mitigation/triggered_state/uvlo2_triggered",
|
||||
.triggeredStatePath[android::hardware::google::pixel::OILO1] =
|
||||
"/sys/devices/virtual/pmic/mitigation/triggered_state/oilo1_triggered",
|
||||
.triggeredStatePath[android::hardware::google::pixel::OILO2] =
|
||||
"/sys/devices/virtual/pmic/mitigation/triggered_state/oilo2_triggered",
|
||||
.triggeredStatePath[android::hardware::google::pixel::SMPL] =
|
||||
"/sys/devices/virtual/pmic/mitigation/triggered_state/smpl_triggered",
|
||||
.BrownoutStatsPath = "/sys/devices/virtual/pmic/mitigation/br_stats/stats",
|
||||
.StoringPath = "/data/vendor/mitigation/thismeal.bin",
|
||||
.ParsedThismealPath = "/data/vendor/mitigation/thismeal.txt",
|
||||
.ParsedLastmealPath = "/data/vendor/mitigation/lastmeal.txt",
|
||||
.ParsedLastmealCSVPath = "/data/vendor/mitigation/lastmeal.csv",
|
||||
.FvpStatsPath = "/sys/devices/platform/acpm_stats/fvp_stats",
|
||||
.PmicCommon = {
|
||||
/* Main Pmic */
|
||||
{
|
||||
.OdpmDir = "/sys/bus/iio/devices/iio:device0",
|
||||
.OdpmEnabledRailsPath = "/sys/bus/iio/devices/iio:device0/enabled_rails",
|
||||
.PmicNamePath = "/sys/bus/iio/devices/iio:device0/name",
|
||||
},
|
||||
/* Sub Pmic */
|
||||
{
|
||||
.OdpmDir = "/sys/bus/iio/devices/iio:device1",
|
||||
.OdpmEnabledRailsPath = "/sys/bus/iio/devices/iio:device1/enabled_rails",
|
||||
.PmicNamePath = "/sys/bus/iio/devices/iio:device1/name",
|
||||
},
|
||||
},
|
||||
.PlatformSpecific = {
|
||||
.NumericSysfsStatPaths = {
|
||||
{
|
||||
.name = "battery_soc",
|
||||
.paths = {
|
||||
"/sys/class/power_supply/max77759fg/capacity",
|
||||
"/sys/class/power_supply/max77779fg/capacity",
|
||||
},
|
||||
},
|
||||
{
|
||||
.name = "gpu_freq",
|
||||
.paths = {
|
||||
"/sys/devices/platform/1c500000.mali/cur_freq",
|
||||
"/sys/devices/platform/28000000.mali/cur_freq",
|
||||
"/sys/devices/platform/1f000000.mali/cur_freq",
|
||||
},
|
||||
},
|
||||
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const char kReadyFilePath[] = "/sys/devices/virtual/pmic/mitigation/instruction/ready";
|
||||
const char kReadyProperty[] = "vendor.brownout.mitigation.ready";
|
||||
const char kLastMealPath[] = "/data/vendor/mitigation/lastmeal.txt";
|
||||
const char kBRRequestedProperty[] = "vendor.brownout_reason";
|
||||
const char kLastMealProperty[] = "vendor.brownout.br.feasible";
|
||||
const std::regex kTimestampRegex("^\\S+\\s[0-9]+:[0-9]+:[0-9]+\\S+$");
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
batteryMitigationService = new BatteryMitigationService(eventThreadCfg);
|
||||
if (!batteryMitigationService) {
|
||||
return 0;
|
||||
}
|
||||
bool brownoutStatsBinarySupported = batteryMitigationService->isBrownoutStatsBinarySupported();
|
||||
if (argc == 2) {
|
||||
if(strcmp(argv[1], "-d") == 0 &&
|
||||
brownoutStatsBinarySupported) {
|
||||
/* Create thismeal.txt from thismeal.bin */
|
||||
batteryMitigationService->genParsedMeal(eventThreadCfg.ParsedThismealPath);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_AUDIO);
|
||||
auto batteryMitigationStartTime = std::chrono::system_clock::now();
|
||||
ABinderProcess_setThreadPoolMaxThreadCount(1);
|
||||
ABinderProcess_startThreadPool();
|
||||
|
||||
bool mitigationLogTimeValid;
|
||||
std::string reason = android::base::GetProperty(kBRRequestedProperty, "");
|
||||
if (brownoutStatsBinarySupported) {
|
||||
/* Create lastmeal.txt if the dump time in thismeal.bin are valid */
|
||||
mitigationLogTimeValid = batteryMitigationService->isTimeValid(eventThreadCfg.StoringPath,
|
||||
batteryMitigationStartTime);
|
||||
if (!reason.empty() && mitigationLogTimeValid &&
|
||||
batteryMitigationService->genParsedMeal(eventThreadCfg.ParsedLastmealPath) &&
|
||||
batteryMitigationService->genLastmealCSV(eventThreadCfg.ParsedLastmealCSVPath)) {
|
||||
android::base::SetProperty(kLastMealProperty, "1");
|
||||
}
|
||||
} else{
|
||||
bmSp = new BatteryMitigation(cfg);
|
||||
if (!bmSp) {
|
||||
return 0;
|
||||
}
|
||||
mitigationLogTimeValid = bmSp->isMitigationLogTimeValid(batteryMitigationStartTime,
|
||||
cfg.LogFilePath,
|
||||
cfg.TimestampFormat,
|
||||
kTimestampRegex);
|
||||
if (!reason.empty() && mitigationLogTimeValid) {
|
||||
std::ifstream src(cfg.LogFilePath, std::ios::in);
|
||||
std::ofstream dst(kLastMealPath, std::ios::out);
|
||||
dst << src.rdbuf();
|
||||
android::base::SetProperty(kLastMealProperty, "1");
|
||||
}
|
||||
}
|
||||
|
||||
bool isBatteryMitigationReady = false;
|
||||
std::string ready_str;
|
||||
int val = 0;
|
||||
for (int i = 0; i < COUNT_LIMIT; i++) {
|
||||
if (!android::base::ReadFileToString(kReadyFilePath, &ready_str)) {
|
||||
continue;
|
||||
}
|
||||
ready_str = android::base::Trim(ready_str);
|
||||
if (!android::base::ParseInt(ready_str, &val)) {
|
||||
continue;
|
||||
}
|
||||
if (val == 1) {
|
||||
isBatteryMitigationReady = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (isBatteryMitigationReady) {
|
||||
android::base::SetProperty(kReadyProperty, "1");
|
||||
}
|
||||
if (isBatteryMitigationReady && brownoutStatsBinarySupported) {
|
||||
/* Start BrownoutEventThread to poll brownout event from kernel */
|
||||
batteryMitigationService->startBrownoutEventThread();
|
||||
}
|
||||
while (true) {
|
||||
pause();
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
on property:vendor.all.modules.ready=1
|
||||
mkdir /data/vendor/mitigation 0755 system system
|
||||
chown system system /data/vendor/mitigation
|
||||
chown system system /sys/devices/virtual/pmic/mitigation/br_stats/enable_br_stats
|
||||
start vendor.battery_mitigation
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,uvlo,pmic,if && property:sys.boot.reason=reboot,uvlo,pmic,if
|
||||
setprop vendor.brownout_reason "uvlo,pmic,if"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,pmic,if && property:sys.boot.reason=reboot,ocp,pmic,if
|
||||
setprop vendor.brownout_reason "ocp,pmic,if"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,uvlo,pmic,main && property:sys.boot.reason=reboot,uvlo,pmic,main
|
||||
setprop vendor.brownout_reason "uvlo,pmic,main"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,uvlo,pmic,sub && property:sys.boot.reason=reboot,uvlo,pmic,sub
|
||||
setprop vendor.brownout_reason "uvlo,pmic,sub"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK1M && property:sys.boot.reason=reboot,ocp,buck1m
|
||||
setprop vendor.brownout_reason "ocp,buck1m"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK2M && property:sys.boot.reason=reboot,ocp,buck2m
|
||||
setprop vendor.brownout_reason "ocp,buck2m"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK3M && property:sys.boot.reason=reboot,ocp,buck3m
|
||||
setprop vendor.brownout_reason "ocp,buck3m"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK4M && property:sys.boot.reason=reboot,ocp,buck4m
|
||||
setprop vendor.brownout_reason "ocp,buck4m"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK5M && property:sys.boot.reason=reboot,ocp,buck5m
|
||||
setprop vendor.brownout_reason "ocp,buck5m"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK6M && property:sys.boot.reason=reboot,ocp,buck6m
|
||||
setprop vendor.brownout_reason "ocp,buck6m"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK7M && property:sys.boot.reason=reboot,ocp,buck7m
|
||||
setprop vendor.brownout_reason "ocp,buck7m"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK8M && property:sys.boot.reason=reboot,ocp,buck8m
|
||||
setprop vendor.brownout_reason "ocp,buck8m"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK9M && property:sys.boot.reason=reboot,ocp,buck9m
|
||||
setprop vendor.brownout_reason "ocp,buck9m"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK10M && property:sys.boot.reason=reboot,ocp,buck10m
|
||||
setprop vendor.brownout_reason "ocp,buck10m"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK1S && property:sys.boot.reason=reboot,ocp,buck1s
|
||||
setprop vendor.brownout_reason "ocp,buck1s"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK2S && property:sys.boot.reason=reboot,ocp,buck2s
|
||||
setprop vendor.brownout_reason "ocp,buck2s"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK3S && property:sys.boot.reason=reboot,ocp,buck3s
|
||||
setprop vendor.brownout_reason "ocp,buck3s"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK4S && property:sys.boot.reason=reboot,ocp,buck4s
|
||||
setprop vendor.brownout_reason "ocp,buck4s"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK5S && property:sys.boot.reason=reboot,ocp,buck5s
|
||||
setprop vendor.brownout_reason "ocp,buck5s"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK6S && property:sys.boot.reason=reboot,ocp,buck6s
|
||||
setprop vendor.brownout_reason "ocp,buck6s"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK7S && property:sys.boot.reason=reboot,ocp,buck7s
|
||||
setprop vendor.brownout_reason "ocp,buck7s"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK8S && property:sys.boot.reason=reboot,ocp,buck8s
|
||||
setprop vendor.brownout_reason "ocp,buck8s"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK9S && property:sys.boot.reason=reboot,ocp,buck9s
|
||||
setprop vendor.brownout_reason "ocp,buck9s"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCK10S && property:sys.boot.reason=reboot,ocp,buck10s
|
||||
setprop vendor.brownout_reason "ocp,buck10s"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCKDS && property:sys.boot.reason=reboot,ocp,buckds
|
||||
setprop vendor.brownout_reason "ocp,buckds"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCKAS && property:sys.boot.reason=reboot,ocp,buckas
|
||||
setprop vendor.brownout_reason "ocp,buckas"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCKCS && property:sys.boot.reason=reboot,ocp,buckcs
|
||||
setprop vendor.brownout_reason "ocp,buckcs"
|
||||
|
||||
on property:vendor.all.modules.ready=1 && property:ro.boot.bootreason=reboot,ocp,BUCKBS && property:sys.boot.reason=reboot,ocp,buckbs
|
||||
setprop vendor.brownout_reason "ocp,buckbs"
|
||||
|
||||
on property:vendor.brownout.br.feasible=1
|
||||
chown system system data/vendor/mitigation/lastmeal.txt
|
||||
|
||||
service vendor.battery_mitigation /vendor/bin/hw/battery_mitigation
|
||||
user system
|
||||
group system
|
||||
capabilities WAKE_ALARM BLOCK_SUSPEND
|
|
@ -1,17 +0,0 @@
|
|||
ifeq ($(RELEASE_PIXEL_AIDL_BATTERY_MITIGATION_HAL), true)
|
||||
|
||||
ifeq (,$(filter factory_%,$(TARGET_PRODUCT)))
|
||||
PRODUCT_PACKAGES += battery_mitigation
|
||||
endif
|
||||
ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
|
||||
ifeq (,$(filter factory_%,$(TARGET_PRODUCT)))
|
||||
PRODUCT_PACKAGES += BrownoutDetection
|
||||
endif
|
||||
endif
|
||||
|
||||
PRODUCT_SOONG_NAMESPACES += device/google/gs-common/battery_mitigation
|
||||
endif
|
||||
|
||||
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/battery_mitigation/sepolicy/vendor
|
||||
SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS += device/google/gs-common/battery_mitigation/sepolicy/system_ext/private
|
||||
SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS += device/google/gs-common/battery_mitigation/sepolicy/system_ext/public
|
|
@ -7,7 +7,17 @@ PRODUCT_PACKAGES += BrownoutDetection
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(RELEASE_PIXEL_AIDL_BATTERY_MITIGATION_HAL), true)
|
||||
PRODUCT_PROPERTY_OVERRIDES += \
|
||||
vendor.battery_mitigation.aidl.enable=true
|
||||
endif
|
||||
|
||||
PRODUCT_SOONG_NAMESPACES += device/google/gs-common/battery_mitigation \
|
||||
vendor/google/battery_mitigation
|
||||
PRODUCT_PACKAGES += vendor.google.battery_mitigation-default
|
||||
PRODUCT_PACKAGES += vendor.google.battery_mitigation.service_static
|
||||
DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE += device/google/gs-common/battery_mitigation/compatibility_matrix.xml
|
||||
|
||||
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/battery_mitigation/sepolicy/vendor
|
||||
SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS += device/google/gs-common/battery_mitigation/sepolicy/system_ext/private
|
||||
SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS += device/google/gs-common/battery_mitigation/sepolicy/system_ext/public
|
||||
PRODUCT_SOONG_NAMESPACES += device/google/gs-common/battery_mitigation
|
||||
|
|
10
battery_mitigation/compatibility_matrix.xml
Normal file
10
battery_mitigation/compatibility_matrix.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<compatibility-matrix version="1.0" type="framework">
|
||||
<hal format="aidl" optional="true">
|
||||
<name>vendor.google.battery_mitigation</name>
|
||||
<version>1</version>
|
||||
<interface>
|
||||
<name>IBatteryMitigation</name>
|
||||
<instance>default</instance>
|
||||
</interface>
|
||||
</hal>
|
||||
</compatibility-matrix>
|
|
@ -29,3 +29,5 @@ allow battery_mitigation mitigation_vendor_data_file:file create_file_perms;
|
|||
binder_use(battery_mitigation)
|
||||
# Allow battery_mitigation to listen brownout event by epoll_wait
|
||||
wakelock_use(battery_mitigation)
|
||||
# Allow battery_mitigation to run aidl service
|
||||
add_service(battery_mitigation, hal_battery_mitigation_service)
|
||||
|
|
1
battery_mitigation/sepolicy/vendor/service.te
vendored
Normal file
1
battery_mitigation/sepolicy/vendor/service.te
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
type hal_battery_mitigation_service, protected_service, hal_service_type, service_manager_type;
|
1
battery_mitigation/sepolicy/vendor/service_contexts
vendored
Normal file
1
battery_mitigation/sepolicy/vendor/service_contexts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
vendor.google.battery_mitigation.IBatteryMitigation/default u:object_r:hal_battery_mitigation_service:s0
|
Loading…
Add table
Add a link
Reference in a new issue