Reputation: 621
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.
Upvotes: 1
Views: 2966
Reputation: 21
For those who stumble upon this question and are looking for a solution that does not require changes in the source code:
You can change the default value of the "Keep Screen On" setting in the "Developer options" using an overlay. Simply add the following line to <...>/overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml:
<bool name="def_stay_on_while_plugged_in">true</bool>
Upvotes: 2
Reputation: 621
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();
break;
case MSG_SANDMAN:
handleSandman();
Upvotes: 1
Reputation: 14520
Create a launcher application and from that call the code to keep screen on as below :
How do I keep the screen on in my App?
Upvotes: 0