Add thermal service into system_server
This system service will listen to ThermalHAL for throttling events and
take actions accordingly, e.g. shutdown device and/or sending
notification to registered listeners to IThermalSerivce.
Bug: 79443945
Bug: 118510237
Bug: 111086696
Bug: 116541003
Test: Boot and test callback on ThermalHAL 1.1
Test: Boot and test callback on ThermalHAL 2.0
Test: Kill ThermalHAL process
Test: Change device threshold to trigger shutdown
Change-Id: I1f4066c9f1cf9ab46c1738a0a4435802512e4339
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 54a140d..43190ac4 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -115,6 +115,7 @@
import com.android.server.policy.PhoneWindowManager;
import com.android.server.power.PowerManagerService;
import com.android.server.power.ShutdownThread;
+import com.android.server.power.ThermalManagerService;
import com.android.server.restrictions.RestrictionsManagerService;
import com.android.server.security.KeyAttestationApplicationIdProviderService;
import com.android.server.security.KeyChainSystemService;
@@ -607,6 +608,10 @@
mPowerManagerService = mSystemServiceManager.startService(PowerManagerService.class);
traceEnd();
+ traceBeginAndSlog("StartThermalManager");
+ mSystemServiceManager.startService(ThermalManagerService.class);
+ traceEnd();
+
// Now that the power manager has been started, let the activity manager
// initialize power management features.
traceBeginAndSlog("InitPowerManagement");