Get current screen brightness

I am currently using the code below to get the current screen brightness

... // for HTC Nexus One and HTC Desire String cmd = "cat /sys/class/leds/lcd-backlight/brightness"; java.lang.Process p = Runtime.getRuntime().exec(cmd); BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()),cmd.length()); ... 

This is normal when I use to get brightness in HTC devices (Nexus One, Desire). But when running this code on Samsung Galaxy S, this code is invalid because the path in "cmd" is incorrect on this device. The problem is that I do not have a Samsung Galaxy S to find out the correct brightness path. Could you tell me the correct path on your Samsung Galaxy S device or other ways to complete this task! Thanks,

+4
source share
3 answers

I know that people have given you the best ways to make your device brighter. Without denying this, but just out of curiosity, if you want to find the corresponding files where the brightness is stored, here they are:

  • Nexus S: /sys/devices/platform/s3cfb/spi_gpio.3/spi3.0/backlight/s5p_bl/brightness
  • Galaxy Y: /sys/devices/platform/aat1401-backlight.0/backlight/aat1401-backlight/brightness
  • Galaxy S: /sys/devices/platform/omap2_mcspi.1/spi1.0/backlight/omap_bl/actual_brightness

Galaxy S also has a file called brightness , but actual_brightness seems more accurate. It captures the screen of the device, which becomes half-light after a certain idle time.

In a nutshell, there are no standard paths / files on Samsung devices. Of course, this is not the best way to get brightness, but if you're interested, these are some of the files.

The best way to find out from your desktop is to run

 adb shell ls -R /sys/devices >files.txt 

and then

 grep -i bright files.txt 

:-)

+9
source

The simplest one I could find to get the brightness of the screen using adb:

 adb shell settings get system screen_brightness 
+5
source

Is there a specific reason why you are not using the System.Settings class?

How in:

Unable to apply system screen brightness in Android

Adding screen brightness controls to an Android app

+4
source

All Articles