Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)anddev.org • View topic - changing screen brightness

so i set it to a certain level, then read it and it corresponds to what i set. so it's doing something, but it's not changing any brightness levels. the problem might have something to do with the "ContentResolver". i don't really know what a ContentResolver is or if i'm using the correct one. any ideas?

Actually it "does" work...just very slowly. Much too slowly to be useful in the way I wanted to use it (for a flashlight/morse code signaling program--for which I can set the background color to black, but that isn't as dark and actually increases battery consumption).
So I looked into the source code for the built-in settings application (git://git.source.android.com/platform/p ... ttings.git).
It doesn't use Settings.System until "OK" is pressed. It does the real-time brightness setting with non-public IHardwareService and ServiceManager.

So, if a program is to set the brightness "some time in the future", system-wide, it can go ahead and use Settings.System. If it is to set the brightness "right now", locally, it can't (as far as I can tell). It has to wait until Android gets a public hardware service or similar API.

I would have expected backlight value of 0 to mean off and 1 to mean the dimmest setting while on.
PowerManager has wake locks, some of which allow the screen to dim or turn off, but none which actually turn off the backlight or screen if it's currently on. Besides that it only has functions to force the device fully awake and fully asleep.

kinscore wrote:Actually it "does" work...just very slowly. Much too slowly to be useful in the way I wanted to use it (for a flashlight/morse code signaling program--for which I can set the background color to black, but that isn't as dark and actually increases battery consumption).So I looked into the source code for the built-in settings application (git://git.source.android.com/platform/p ... ttings.git).It doesn't use Settings.System until "OK" is pressed. It does the real-time brightness setting with non-public IHardwareService and ServiceManager.

So, if a program is to set the brightness "some time in the future", system-wide, it can go ahead and use Settings.System. If it is to set the brightness "right now", locally, it can't (as far as I can tell). It has to wait until Android gets a public hardware service or similar API.

so, what is this "OK" you're talking about? if i set the Settings.System, can i force the press of this "OK"?

Interesting idea but actually it's a bit more complicated than that and the behavior is basically opposite what you suggest. The "OK" button is in the system settings user interface on the phone (and unavailable on the emulator). When "OK" is pressed it applies the action available in the public APIs. What's different is that when you're moving the slider in the built-in system settings brightness program, it uses IHardwareService, which isn't publicly available, to immediately change the brightness. I don't think the brightness setting interface is available to other programs, either.

So immediate changes to brightness are unavailable publicly.

Delayed changes in brightness are available with the code in the first post.

I don't know whether it can be seen in the emulator at all. With hardware running Android natively (like the T-Mobile G1), you might be able to see the change by locking the screen and then unlocking it again or you might have to wait a few minutes...

This explanation gives me an idea that might be a workaround in some cases but is kind of tricky and probably too slow for some applications. After Settings.System.putInt(), use PowerManager.goToSleep() followed by PowerManager.userActivity(). userActivity() might have to be set in a timer or some such before goToSleep() in order to avoid being canceled by the phone going to sleep...I really don't recommend this and won't be using it myself--but if you absolutely must have brightness settings applied now, give it a try...at your own risk.

spirolateral wrote:i'll might try that out. i downloaded a "flashlight" app the other day and it increased my brightness. there is a way to do this.

Ah, yes, increasing brightness is easy. Just use a wakelock with the screen bright flag. Dimming or turning off the backlight, on the other hand, is either delayed, impossible or requiring weird tricks as I've said.

spirolateral wrote:i'll might try that out. i downloaded a "flashlight" app the other day and it increased my brightness. there is a way to do this.

Ah, yes, increasing brightness is easy. Just use a wakelock with the screen bright flag. Dimming or turning off the backlight, on the other hand, is either delayed, impossible or requiring weird tricks as I've said.

when i tried with that screen bright flag it just keeps it at the system set brightness level until the wake lock is released. it didn't increase the brightness.