VR hal to choose thermal config

Test: thermal config changed enter/exit VR mode in muskie
Bug: 36514493
Change-Id: I3711f94e667684710afcf812dcb316a9a2ba86ef
This commit is contained in:
Wei Wang
2017-04-21 11:04:15 -07:00
parent 1cedb2bc80
commit 6fc920280b
5 changed files with 23 additions and 3 deletions

View File

@@ -394,7 +394,7 @@ service perfd /vendor/bin/perfd
group root readproc
socket perfd seqpacket 0666 root system
service thermal-engine /vendor/bin/thermal-engine -c /vendor/etc/thermal-engine.conf
service thermal-engine /vendor/bin/thermal-engine -c ${sys.qcom.thermalcfg:-/vendor/etc/thermal-engine.conf}
class main
user root
group root system

2
sepolicy/hal_vr.te Normal file
View File

@@ -0,0 +1,2 @@
# interact with thermal_config
set_prop(hal_vr, thermal_prop)

View File

@@ -8,3 +8,4 @@ type ssr_prop, property_type;
type cnss_diag_prop, property_type;
type tee_listener_prop, property_type;
type wc_prop, property_type;
type thermal_prop, property_type;

View File

@@ -11,3 +11,5 @@ debug.ssrdump u:object_r:ssr_prop:s0
persist.sys.cnss. u:object_r:cnss_diag_prop:s0
sys.listeners.registered u:object_r:tee_listener_prop:s0
wc_transport. u:object_r:wc_prop:s0
sys.qcom.thermalcfg u:object_r:thermal_prop:s0
ctl.thermal-engine u:object_r:thermal_prop:s0

View File

@@ -16,6 +16,8 @@
#define LOG_TAG "VrDevice"
#include <android-base/logging.h>
#include <android-base/properties.h>
#include "VrDevice.h"
namespace android {
@@ -31,8 +33,21 @@ Return<void> VrDevice::init() {
return Void();
}
Return<void> VrDevice::setVrMode(bool /* enabled */) {
// TODO(b/36514493): start or stop using thermal engine VR profile.
Return<void> VrDevice::setVrMode(bool enabled) {
if (enabled) {
if (!android::base::SetProperty("sys.qcom.thermalcfg", "/vendor/etc/thermal-engine-vr.conf")) {
LOG(ERROR) << "Couldn't set thermal_engine enable property";
return Void();
}
} else {
if (!android::base::SetProperty("sys.qcom.thermalcfg", "/vendor/etc/thermal-engine.conf")) {
LOG(ERROR) << "Couldn't set thermal_engine disable property";
return Void();
}
}
if (!android::base::SetProperty("ctl.restart", "thermal-engine")) {
LOG(ERROR) << "Couldn't set thermal_engine restart property";
}
return Void();
}