Backlight and LCD control in framework

478 views
Skip to first unread message

Akash

unread,
Sep 24, 2011, 12:34:13 PM9/24/11
to android-porting
Hi,

I wanted to know as to whether there is a control in the Android
framework which notifies the backlight and LCD drivers to switch them
on or off?

I have seen some code in PowerManagerService.java which uses
LightService class to change the backlight brightness. But is there
any part of code in Framework which also control the process of
switching the LCD display on or off.

Regards,
Akash

Liu Xin

unread,
Sep 25, 2011, 2:18:33 AM9/25/11
to mail...@gmail.com, android-porting
PowerManagerService does it. you may refer to WakeLock in android documents.

--lx



Akash

unread,
Sep 25, 2011, 10:04:31 AM9/25/11
to android-porting
Thank you for the response. I have used wake locks in applications to
keep the screen on. But the issue which I have is to find is that
whether there is any control in framework or PowerManagerService which
can turn the LCD/TouchScreen/Display switch on or off.

Pratik Prajapati

unread,
Sep 25, 2011, 3:55:02 AM9/25/11
to android-porting
There is no such thing in PowerManagerService to turn on/off backlight. PowerManagerService does dimming only. You need to implement the turn off/on stuff by your own. U can use Timer/TimerTask once the screen goes dim. There is no wakelock for that.


-- 
Regards,
Pratik Prajapati

zhuyang220

unread,
Sep 25, 2011, 10:33:50 PM9/25/11
to android-porting
Android framework does not control display neither touch panel.

Andoird can only control back lights.

Andoird only change /sys/power/state to request the sys power state
change.
It's linux kernel's responsibility to turn on/off display and touch
panel.

Akash

unread,
Sep 26, 2011, 2:38:09 AM9/26/11
to android-porting
From PowerManagerService a trace has displayed the following code
flow:

PowerManagerService.java ==>
Power.setScreenState(boolean) (Native) ==>
setScreenState(JNIEnv *env, jobject clazz, jboolean on)
(android_os_Power.cpp) ==>
set_screen_state(int) (power.c)

I guess as it is going to JNI and writing the value inside /sys/power/
state it is no longer controlled by Android Framework. Thank you for
the clarification.

One more query related to this question; when it goes to kernel, it
must be handled by kernel PowerManager. Now does kernel PM call the
suspend callback or early_suspend callback of the display or
touchscreen driver?
Reply all
Reply to author
Forward
0 new messages