power-libperfmgr: Rename all powerhal props to avoid sepolicy conflicts
MTK labels the vendor.powerhal prop as with their own context, but
using the same contexts leads to more error. Instead switch to a
different prop naming which will not conflict with MTK context.

Signed-off-by: Vaisakh Murali <mvaisakh@statixos.com>
Change-Id: I1af896827197bda95d0a0772490daf14493b1d93
diff --git a/aidl/power-libperfmgr/InteractionHandler.cpp b/aidl/power-libperfmgr/InteractionHandler.cpp
index dd135b0..4950c8e 100644
--- a/aidl/power-libperfmgr/InteractionHandler.cpp
+++ b/aidl/power-libperfmgr/InteractionHandler.cpp
@@ -47,17 +47,17 @@
 namespace {
 
 static const bool kDisplayIdleSupport =
-        ::android::base::GetBoolProperty("vendor.powerhal.disp.idle_support", true);
+        ::android::base::GetBoolProperty("vendor.mediatek.powerhal.disp.idle_support", true);
 static const std::array<const char *, 2> kDispIdlePath = {"/sys/class/drm/card0/device/idle_state",
                                                           "/sys/class/graphics/fb0/idle_state"};
 static const uint32_t kWaitMs =
-        ::android::base::GetUintProperty("vendor.powerhal.disp.idle_wait", /*default*/ 100U);
+        ::android::base::GetUintProperty("vendor.mediatek.powerhal.disp.idle_wait", /*default*/ 100U);
 static const uint32_t kMinDurationMs =
-        ::android::base::GetUintProperty("vendor.powerhal.interaction.min", /*default*/ 1400U);
+        ::android::base::GetUintProperty("vendor.mediatek.powerhal.interaction.min", /*default*/ 1400U);
 static const uint32_t kMaxDurationMs =
-        ::android::base::GetUintProperty("vendor.powerhal.interaction.max", /*default*/ 5650U);
+        ::android::base::GetUintProperty("vendor.mediatek.powerhal.interaction.max", /*default*/ 5650U);
 static const uint32_t kDurationOffsetMs =
-        ::android::base::GetUintProperty("vendor.powerhal.interaction.offset", /*default*/ 650U);
+        ::android::base::GetUintProperty("vendor.mediatek.powerhal.interaction.offset", /*default*/ 650U);
 
 static size_t CalcTimespecDiffMs(struct timespec start, struct timespec end) {
     size_t diff_in_ms = 0;
diff --git a/aidl/power-libperfmgr/Power.cpp b/aidl/power-libperfmgr/Power.cpp
index d07f201..d30645e 100644
--- a/aidl/power-libperfmgr/Power.cpp
+++ b/aidl/power-libperfmgr/Power.cpp
@@ -48,10 +48,10 @@
 extern bool setDeviceSpecificMode(Mode type, bool enabled);
 #endif
 
-constexpr char kPowerHalStateProp[] = "vendor.powerhal.state";
-constexpr char kPowerHalAudioProp[] = "vendor.powerhal.audio";
-constexpr char kPowerHalRenderingProp[] = "vendor.powerhal.rendering";
-constexpr char kPowerHalAdpfRateProp[] = "vendor.powerhal.adpf.rate";
+constexpr char kPowerHalStateProp[] = "vendor.mediatek.powerhal.state";
+constexpr char kPowerHalAudioProp[] = "vendor.mediatek.powerhal.audio";
+constexpr char kPowerHalRenderingProp[] = "vendor.mediatek.powerhal.rendering";
+constexpr char kPowerHalAdpfRateProp[] = "vendor.mediatek.powerhal.adpf.rate";
 constexpr int64_t kPowerHalAdpfRateDefault = -1;
 
 Power::Power(std::shared_ptr<HintManager> hm)
diff --git a/aidl/power-libperfmgr/PowerHintSession.cpp b/aidl/power-libperfmgr/PowerHintSession.cpp
index 7a39dab..1386042 100644
--- a/aidl/power-libperfmgr/PowerHintSession.cpp
+++ b/aidl/power-libperfmgr/PowerHintSession.cpp
@@ -41,22 +41,22 @@
 using std::chrono::nanoseconds;
 using std::literals::chrono_literals::operator""s;
 
-constexpr char kPowerHalAdpfPidPOver[] = "vendor.powerhal.adpf.pid_p.over";
-constexpr char kPowerHalAdpfPidPUnder[] = "vendor.powerhal.adpf.pid_p.under";
-constexpr char kPowerHalAdpfPidI[] = "vendor.powerhal.adpf.pid_i";
-constexpr char kPowerHalAdpfPidDOver[] = "vendor.powerhal.adpf.pid_d.over";
-constexpr char kPowerHalAdpfPidDUnder[] = "vendor.powerhal.adpf.pid_d.under";
-constexpr char kPowerHalAdpfPidIInit[] = "vendor.powerhal.adpf.pid_i.init";
-constexpr char kPowerHalAdpfPidIHighLimit[] = "vendor.powerhal.adpf.pid_i.high_limit";
-constexpr char kPowerHalAdpfPidILowLimit[] = "vendor.powerhal.adpf.pid_i.low_limit";
-constexpr char kPowerHalAdpfUclampEnable[] = "vendor.powerhal.adpf.uclamp";
-constexpr char kPowerHalAdpfUclampMinGranularity[] = "vendor.powerhal.adpf.uclamp_min.granularity";
-constexpr char kPowerHalAdpfUclampMinHighLimit[] = "vendor.powerhal.adpf.uclamp_min.high_limit";
-constexpr char kPowerHalAdpfUclampMinLowLimit[] = "vendor.powerhal.adpf.uclamp_min.low_limit";
-constexpr char kPowerHalAdpfStaleTimeFactor[] = "vendor.powerhal.adpf.stale_timeout_factor";
-constexpr char kPowerHalAdpfPSamplingWindow[] = "vendor.powerhal.adpf.p.window";
-constexpr char kPowerHalAdpfISamplingWindow[] = "vendor.powerhal.adpf.i.window";
-constexpr char kPowerHalAdpfDSamplingWindow[] = "vendor.powerhal.adpf.d.window";
+constexpr char kPowerHalAdpfPidPOver[] = "vendor.mediatek.powerhal.adpf.pid_p.over";
+constexpr char kPowerHalAdpfPidPUnder[] = "vendor.mediatek.powerhal.adpf.pid_p.under";
+constexpr char kPowerHalAdpfPidI[] = "vendor.mediatek.powerhal.adpf.pid_i";
+constexpr char kPowerHalAdpfPidDOver[] = "vendor.mediatek.powerhal.adpf.pid_d.over";
+constexpr char kPowerHalAdpfPidDUnder[] = "vendor.mediatek.powerhal.adpf.pid_d.under";
+constexpr char kPowerHalAdpfPidIInit[] = "vendor.mediatek.powerhal.adpf.pid_i.init";
+constexpr char kPowerHalAdpfPidIHighLimit[] = "vendor.mediatek.powerhal.adpf.pid_i.high_limit";
+constexpr char kPowerHalAdpfPidILowLimit[] = "vendor.mediatek.powerhal.adpf.pid_i.low_limit";
+constexpr char kPowerHalAdpfUclampEnable[] = "vendor.mediatek.powerhal.adpf.uclamp";
+constexpr char kPowerHalAdpfUclampMinGranularity[] = "vendor.mediatek.powerhal.adpf.uclamp_min.granularity";
+constexpr char kPowerHalAdpfUclampMinHighLimit[] = "vendor.mediatek.powerhal.adpf.uclamp_min.high_limit";
+constexpr char kPowerHalAdpfUclampMinLowLimit[] = "vendor.mediatek.powerhal.adpf.uclamp_min.low_limit";
+constexpr char kPowerHalAdpfStaleTimeFactor[] = "vendor.mediatek.powerhal.adpf.stale_timeout_factor";
+constexpr char kPowerHalAdpfPSamplingWindow[] = "vendor.mediatek.powerhal.adpf.p.window";
+constexpr char kPowerHalAdpfISamplingWindow[] = "vendor.mediatek.powerhal.adpf.i.window";
+constexpr char kPowerHalAdpfDSamplingWindow[] = "vendor.mediatek.powerhal.adpf.d.window";
 
 namespace {
 /* there is no glibc or bionic wrapper */
diff --git a/aidl/power-libperfmgr/PowerSessionManager.h b/aidl/power-libperfmgr/PowerSessionManager.h
index 4b7c36d..0d9de32 100644
--- a/aidl/power-libperfmgr/PowerSessionManager.h
+++ b/aidl/power-libperfmgr/PowerSessionManager.h
@@ -39,7 +39,7 @@
 using ::android::Thread;
 using ::android::perfmgr::HintManager;
 
-constexpr char kPowerHalAdpfDisableTopAppBoost[] = "vendor.powerhal.adpf.disable.hint";
+constexpr char kPowerHalAdpfDisableTopAppBoost[] = "vendor.mediatek.powerhal.adpf.disable.hint";
 
 class PowerSessionManager : public MessageHandler {
   public:
diff --git a/aidl/power-libperfmgr/android.hardware.power-service.mediatek-libperfmgr.rc b/aidl/power-libperfmgr/android.hardware.power-service.mediatek-libperfmgr.rc
index dd12317..a0766e2 100644
--- a/aidl/power-libperfmgr/android.hardware.power-service.mediatek-libperfmgr.rc
+++ b/aidl/power-libperfmgr/android.hardware.power-service.mediatek-libperfmgr.rc
@@ -8,22 +8,22 @@
     start vendor.power-hal-aidl
 
 # restart powerHAL when framework died
-on property:init.svc.zygote=restarting && property:vendor.powerhal.state=*
-    setprop vendor.powerhal.state ""
-    setprop vendor.powerhal.audio ""
-    setprop vendor.powerhal.rendering ""
+on property:init.svc.zygote=restarting && property:vendor.mediatek.powerhal.state=*
+    setprop vendor.mediatek.powerhal.state ""
+    setprop vendor.mediatek.powerhal.audio ""
+    setprop vendor.mediatek.powerhal.rendering ""
     restart vendor.power-hal-aidl
 
 # restart powerHAL when audioHAL died
-on property:init.svc.vendor.audio-hal-2-0=restarting && property:vendor.powerhal.audio=AUDIO_STREAMING_LOW_LATENCY
-    setprop vendor.powerhal.audio ""
+on property:init.svc.vendor.audio-hal-2-0=restarting && property:vendor.mediatek.powerhal.audio=AUDIO_STREAMING_LOW_LATENCY
+    setprop vendor.mediatek.powerhal.audio ""
     restart vendor.power-hal-aidl
 
 # Clean up after b/163539793 resolved
-on property:vendor.powerhal.dalvik.vm.dex2oat-threads=*
-    setprop dalvik.vm.dex2oat-threads ${vendor.powerhal.dalvik.vm.dex2oat-threads}
-    setprop dalvik.vm.restore-dex2oat-threads ${vendor.powerhal.dalvik.vm.dex2oat-threads}
+on property:vendor.mediatek.powerhal.dalvik.vm.dex2oat-threads=*
+    setprop dalvik.vm.dex2oat-threads ${vendor.mediatek.powerhal.dalvik.vm.dex2oat-threads}
+    setprop dalvik.vm.restore-dex2oat-threads ${vendor.mediatek.powerhal.dalvik.vm.dex2oat-threads}
 
-on property:vendor.powerhal.dalvik.vm.dex2oat-cpu-set=*
-    setprop dalvik.vm.dex2oat-cpu-set ${vendor.powerhal.dalvik.vm.dex2oat-cpu-set}
-    setprop dalvik.vm.restore-dex2oat-cpu-set ${vendor.powerhal.dalvik.vm.dex2oat-cpu-set}
+on property:vendor.mediatek.powerhal.dalvik.vm.dex2oat-cpu-set=*
+    setprop dalvik.vm.dex2oat-cpu-set ${vendor.mediatek.powerhal.dalvik.vm.dex2oat-cpu-set}
+    setprop dalvik.vm.restore-dex2oat-cpu-set ${vendor.mediatek.powerhal.dalvik.vm.dex2oat-cpu-set}
diff --git a/aidl/power-libperfmgr/service.cpp b/aidl/power-libperfmgr/service.cpp
index bc10e0e..871ceac 100644
--- a/aidl/power-libperfmgr/service.cpp
+++ b/aidl/power-libperfmgr/service.cpp
@@ -33,8 +33,8 @@
 using aidl::google::hardware::power::impl::pixel::PowerSessionManager;
 using ::android::perfmgr::HintManager;
 
-constexpr std::string_view kPowerHalInitProp("vendor.powerhal.init");
-constexpr std::string_view kConfigProperty("vendor.powerhal.config");
+constexpr std::string_view kPowerHalInitProp("vendor.mediatek.powerhal.init");
+constexpr std::string_view kConfigProperty("vendor.mediatek.powerhal.config");
 constexpr std::string_view kConfigDefaultFileName("powerhint.json");
 
 int main() {
@@ -68,7 +68,7 @@
     CHECK(status == STATUS_OK);
     LOG(INFO) << "Xiaomi Power HAL AIDL Service with Extension is started.";
 
-    if (::android::base::GetIntProperty("vendor.powerhal.adpf.rate", -1) != -1) {
+    if (::android::base::GetIntProperty("vendor.mediatek.powerhal.adpf.rate", -1) != -1) {
         PowerHintMonitor::getInstance()->start();
         PowerSessionManager::getInstance()->setHintManager(hm);
     }