Harsh Shah Harsh Shah - 1 year ago 78
Android Question

Disable screen timeout functionality in Android 4.4.2 AOSP

I am in process of porting Android Kitkat 4.4.2 on Freescale iMX6 based custom board. Android is working properly now but it have a requirement to keep the screen ON permanently regardless of whatever application is running.

I am browsing the AOSP code to find out which function to comment out to disable the screen timeout functionality but no success so far. Can you guys point out to the right file/function ?

So far I have tried to comment out the code inside goToSleepInternal() function in frameworks/base/services/java/com/android/server/power/PowerManagerService.java but it is not disabling the screen timeout.

Answer Source

I finally solved the issue myself.

I commented the function call to handleUserActivityTimeout() in file frameworks/base/services/java/com/android/server/power/PowerManagerService.java :

@@ -2511,7 +2511,7 @@ public final class PowerManagerService extends IPowerManager.Stub
         public void handleMessage(Message msg) {
             switch (msg.what) {
                 case MSG_USER_ACTIVITY_TIMEOUT:
-                    handleUserActivityTimeout();
+                    //handleUserActivityTimeout();
                 case MSG_SANDMAN: