yashsingh1/xdaforums huggingface dataset:
[Captivate Android Development] Cezar`:
[MOD]Port of Captivate "buttons backlights ON on screen touch" to i9000 ROMs

EDIT: The app is here. It will be available on the market as well soon!

Thank you Guardian_Bob!!

Hi dev community.

I would like to ask you if there is any way to port the capability of turning ON the button back-lights on screen touch from Captivate or Vibrant ROMs to i9000 ones.

At first I thought it was connected to the kernel but was not. I loaded a Captivate ROM with i9000 kernel and the function was still there. However when I loaded a i9000 ROM with a Captivate kernel, the function did not make it's presence => is ROM related.

This would make the i9000 ROM user's live bit easier.

I am open for a bounty so users which are interested, please post your offers.

Thanks a lot!

Bounty list:

-icezar1: 10$

-boomerod: 10$
[Captivate Android Development] Haloruler64:
Note: Also present in JL3, which is a Telus Fascinate (Vibrant T959). So not only i9000 :)
[Captivate Android Development] Cezar`:
Not only i9000.. what? I said that i9000 ROM doesn't have it but Captivate and Vibrant do :)
[Captivate Android Development] Haloruler64:
My bad, I was unclear. JL3 (T959) has the ISSUE, not the feature. A tap of the screen won't turn on the backlights.
[Captivate Android Development] Cezar`:
Aha.. hm, so maybe a port of the function would be welcome

EDIT: I think DG could do this in a moment :p
[Captivate Android Development] Cezar`:
Or if someone can give me an idea how to do it, I could try to do it myself
[Captivate Android Development] zas0006:
This would earn major donations me thinks. I know it drives me NUTS when I hit the wrong button cause the damn things are off all the time. Has anyone looked into the possibility of this being related to BLN being available. I know I have this issue with it on or off but I haven't tried removing the bln stuff altogether. Just a thought.
[Captivate Android Development] Cezar`:
Please guys, give us, i9000 users, some help
[Captivate Android Development] Cezar`:
Created a bounty. Who's interested?
[Captivate Android Development] x986123:
There was a hack back in the Nexus one thread (I miss those simple times), used for the old Sense ports, it was a script that kept the lights on after first boot, only when screen turned on. Sound interesting?
[Captivate Android Development] boomerod:
I've narrowed the issue (I think) down to framework. The version of the Ultimate ROM (posted in the I9000 Dev forum) had working touch-anywhere turn on capacitive buttons backligting and Haptic on Home. Then I tried another theme on it and lost both. After reverting the theme I got both functions back.

What I would really like is for GPS to work for Captivate on the Nero v1 build from the Vibrant forum. That is the best ROM I've used to-date (especially theming) and everything works but the GPS. The GPS stopped working as soon as I flashed an re-oriented I9000 kernel - I tried both sentiroN's and xcaliburinhand's.

***Edit***

I suspect that this functionality has been a oversight to devs and is probably an easy fix.

***Edit***

Oh, the other thing I noticed was that when the Haptic Home and Touch anywhere to activate backlighting on the capacitive buttons works, the screen Unlock sounds does not; conversely, I've found the Unlock sounds works when the other 2 features do not.
[Captivate Android Development] boomerod:
That would be even better. I personally would like them to stay on until I turn off the screen (or it turns off according to the timeout I set).
[Captivate Android Development] pkley:
Personally I can't believe that everybody else doesn't care about this. If the capacitive area wasn't so small I wouldn't mind either but I routinely JUST miss the button when it's dark and have to try several times.
[Captivate Android Development] x986123:
It is somewhere in this ROM: http://xdaforums.com/showthread.php?t=730290
[Captivate Android Development] Cezar`:
Still, no one takes the burden ... :(
[Captivate Android Development] boomerod:
I know...it sucks cause it's a persistent problem through most of the ROM's available right now. Axura got it fixed; Nero (in the Vibrant forums) got it fixed; the Ultimate ROM (in the I9000 forums, but the one I'm referring to was taken down due to Master's issues). So, there is definitely a way to fix this if any devs want to PAY ATTENTION!
[Captivate Android Development] Pirateghost:
AXURA was NOT an i9000 rom...it was a vibrant rom
[Captivate Android Development] Cezar`:
Im pretty sure they do, is just that no one really complained about it till now. It must be something in tge framework. Probably android.policy.jar. I will get a bit deeper in this in a while.
[Captivate Android Development] aleadam:
This seems to be the script that does it:

#!/system/bin/sh
while [ true ]; do
if [ `cat /sys/devices/i2c-0/0-0066/leds/button-backlight/subsystem/lcd-backlight/brightness` -ne 0 ]; then
echo 255 > /sys/devices/i2c-0/0-0066/leds/button-backlight/brightness;
fi;
sleep 2;
done
&

What are the devices controlling it in our phones?
[Captivate Android Development] ThisWasATriumph:
just flashed an i9000 rom and this is really bugging me. Not sure why that feature isn't enabled considering how insensitive the buttons are.
[Captivate Android Development] Cezar`:
Very good question. But this script lights up the buttons when the screen is off if Im not mistaken... we don't need that.
[Captivate Android Development] aleadam:
I'm no bash expert here... -ne 0 doesn't mean not equal to 0?

Anyways I posted here as a start. A service that reacts to the power button and/or screen changes may be a better solution
[Captivate Android Development] di11igaf:
This is where the issue lies. 100% sure home button haptic lies here cause I fixed that. Its one of the phonewindow.smali files and im pretty sure but not positive this is where the screen light problem lies too but im not positive
[Captivate Android Development] smokestack76:
Mind sharing your fix?
[Captivate Android Development] Cezar`:
Im no bash expert either but you might be right :)
[Captivate Android Development] ndoss:
Assonance is an i9000 based and the buttons worked for me when I was using that rom.
[Captivate Android Development] boomerod:
I'll donate...

$10...10char

---EDIT---

Looks like we're making some progress on this. I know for a fact that at least 1 I9000 ROM worked...webstar1's JP7/8 ROM (taken down now and replaced with a JPY ROM). It stopped working on this ROM when I flashed one of the early Gingerbread theme packs.

Every recent ROM I've tried that is Vibrant-based these features work.
[Captivate Android Development] Guardian_Bob:
I prototyped keeping the lights on till the screen goes off. There's a small bug that the process sometimes segfaults, needs root rights, and it clears the dmesg log. In addition the process will run fairly frequently as there's no push notification for the lights being turned off. Is that still acceptable for the bounty?
[Captivate Android Development] Cezar`:
Sounds more or less good. Any way to give it full root rights and remove the segmentation bug? Or, how often does the bug happen?
[Captivate Android Development] Guardian_Bob:
The segfault has the unfortunate side effect of vibrating like a force close, that said I think I can reduce it to 1 out of a 1000 or less.
[Captivate Android Development] Guardian_Bob:
So I'll have a working version of this today. I would like a beta tester before publishing. If someone would PM me that'd be great.
[Captivate Android Development] Guardian_Bob:
So first public version, it's been tested on a few phones already, seems to work for all of them.

Requires root access to prevent the Samsung software from turning the lights off.

Install and run the app or reboot and the lights will stay on while the screen is on. To get your standard behavior back, uninstall and reboot.

I'm considering a second version that looks for touches, but this version will use the least amount of resources and power.
[Captivate Android Development] Haloruler64:
Does it have a noticeable impact on battery? I mean this + Blinky (which I love BTW :) ) should add quite a bit of battery drain right?
[Captivate Android Development] Guardian_Bob:
Well let me put it this way, this would use about 1% battery in an hour of use. If your screen is on for an hour, it will use 10% - 30% of your battery. The use is insignificant, especially since this isn't using a timer.

If this was constantly turning the lights on and off due to touches and a timer it would drain more battery as it would use the CPU a whole lot more.
[Captivate Android Development] Haloruler64:
That isn't too insignificant, but I REALLY appreciate the effort! I will DEFINITELY be using it, downloaded and will install as soon as I flash P10. Can you add a toggle into the app instead of the need to uninstall it? That would be perfect.
[Captivate Android Development] firehazard:
Seems to be working perfectly so far. Thank you!
[Captivate Android Development] double RL:
This was needed. Thanks man!
[Captivate Android Development] boomerod:
GB, well done. I like it. I would say this qualifies for my stated donation.

---EDIT---

John, your donation is now completePayment by PayPal

Confirmation number: 57682797R24467154
[Captivate Android Development] erikbacon:
This is AWESOME, I can't believe this isn't a hotter topic. What a difference:D:D:D
[Captivate Android Development] opcow:
This is the greatest thing ever in the history of the universe and I have sent you a small donation to say thanks.
[Captivate Android Development] jhnstn00:
Nice. Didnt know what I was missing bit this is it. :-)

Someone talented help this fellow get an icon image for this app. ;-)

Sent from my GT-I9000

Edit: if he needs any help of course... :)
[Captivate Android Development] Guardian_Bob:
Okay, first let me say how appreciative I am for the donations. I'm going to use the $25 dollars in donations to finally sign up for the market and to put this up there along with such apps as Blinky (in some form) and Bluetooth Launch.

Second, I will update this with a toggle button. In addition I'll add some documentation to the app and run a couple of tests to see what kind of battery life it has. Based on my rough guesstimate calculation of approximately 200 minutes with the LCD on (3 hours 20 minutes) to drain the battery completely this changes the total time to 193 minutes (3 hours 23 minutes). This is why I say the drain is insignificant.

Math as follows:

200 minutes means 0.5% per minute (Normal drain from LCD)

1% per hour means 0.0167% per minute (LED drain)

Summing the two numbers leads to 0.5167% per minute drain total (there is some overlap but it is neglected here).

100% / 0.5167% per minute = 193.54 minutes or 3 hours 23 minutes 32 seconds.

If anyone can show me a stock battery which exceeds 200 minutes with the LCD on under normal usage that hasn't drained the battery, I'll redo these calculations for the absolute best case.

These numbers scale linearly with the battery used.

Finally, this should work for just about any Galaxy S phone. I'm going to put up a tracking thread for this soon, as well as an icon.
[Captivate Android Development] Yuna:
Thanks for util - working, testing out now :))) maybe need a thing - to check if light is lower than something - only then to light up the buttons...
[Captivate Android Development] Guardian_Bob:
If you could would you explain the use case? I'm afraid I don't understand where it would be useful to keep the lights off. I mean if it is dark, it is very hard to see the buttons; however, if this is to save battery when there's a strong light in the room, all the savings are negated due to the use of CPU to constantly monitor the ambient light sensor for changes.
[Captivate Android Development] Yuna:
You don't need light on WHEN you are at a bright light:

1. You won't see lights

2. you can see clearly the buttons

to determine you must use light sensor we already have...
[Captivate Android Development] Guardian_Bob:
I'm sorry, I must not have been clear, why do you want the lights off? Is it to save battery or some other reason?
[Captivate Android Development] boomerod:
That could be useful. You can definitely see the buttons in a bright environment so there really is no need to have the lights on. Considering the constant battle to balance battery and features, this could be a good feature (provided the mechanism to run this feature would not use more battery than having the lights on for a brief period of time).

In any case, I am very pleased GB has taken up this project and feel confident he will work to improve the app where he can.

FOLKS, it's time to send this guy some donations to fund his work some. Even a buck or 2 would help.
[Captivate Android Development] boomerod:
GB, that's good news! I'm happy to have been able to send you a little something; I do appreciate that you took up this project. Thanks!
[Captivate Android Development] Cezar`:
Mate, to use the light sensor, you need to monitor the light intensity with the light sensor (eats energy) and then process it with the CPU (eats energy).

I know you will say that the light sensor already eats energy, not when you have brightness set on manual, and some people have it like that.

I am happy with what it is right now and I am pretty sure that GB will improve this app till the sky. However, I think is easier and more energy efficient just to reduce the light intensity of the leds than to put a toggle to enable intensity based on ambient light. These lights are needed in the night so even if they have minimum intensity, you will still see them.
[Captivate Android Development] Darryl Henley:
noob question. could u just check the light sensor once when the display is turned on to decide to turn on the leds?

edit: nice app.
[Captivate Android Development] Guardian_Bob:
Again to what end?

Let me try and give you some scale here, based on typical surface mount LEDs. Assuming 5 mA and a forward voltage of 3.3 (again I said typical) using all 4 LEDs consumes 0.066 watts. The CPU on the other hand, uses 3.3 Volts and somewhere in the range of 100-1000 mA. That means loaded the CPU would use between 0.33 and 3.3 watts. That's 20-200 times the consumption of power. Loading the program into memory to even do the check uses more power than leaving those LEDs on.
[Captivate Android Development] ThisWasATriumph:
Thanks so much for this. I thinks its even better this way than having a timer because they'll always be lit up even when reading something for a while. Just wish the buttons were not brighter than the screen with screen filter enabled but cant have everything :rolleyes:
[Captivate Android Development] Guardian_Bob:
I know people would like dimmer LEDs, and I'd like to do that but the problem lies in the interface.

So I need to back up and explain how dimming LEDs is achieved. An LED only has one brightness level at a given voltage. In order to dim a LED normally one would use a hardware Pulse Width Modulator (or PWM) to blink the LED very very fast. So fast you can't tell that the LED is blinking.

That said, it takes a noticeable amount of time to turn the LEDs on and off, via the phone interface. Add in software delays, process priority and such, there's no way to reliably dim the LEDs at this time.

I said something similar about individual lights and then proved myself wrong, so I won't quit trying. There may be something I've missed.
[Captivate Android Development] ThisWasATriumph:
Oh I know all about that, Im also a member of CandlePowerForums :D

Leds can be dimmed via PWM or a variable current. The voltage should remain relatively constant at all levels actually. But I doubt the hardware is there to allow current change so basically, yeah, can't be done.
[Captivate Android Development] joeshmoe08:
Wow! thanks for that. In the second release you should try to have an option in the app to choose how long the light should stay on after touch because the 3 seconds default isn't nearly as long enough. (for me)
[Captivate Android Development] rassler:
Thank you, Guardian_Bob! Really appreciate this. Very useful.
[Captivate Android Development] Haloruler64:
Thanks for all the explanations man, really appreciate it and learned a lot :) can't wait for the version with a toggle! Also loving Blinky
[Captivate Android Development] RockRatt:
GB I did miss these lights and noticed that the touch lit them back up on Gingerbread ( and possibly P99 but don't quote me on that one). I will try them out now as I am downloading it now. One question, will it effect your Blinky App at all? Once you have it available for P10 that is. Thanks for your hard work.

Sent from MY Perception 9.5 on XDA App
[Captivate Android Development] boomerod:
Thanks for the explanations GB. I think from the suggestions, the only one that makes sense is a toggle.
[Captivate Android Development] chutes:
thank you soooo much! This was easily the biggest gripe I had with the design of this phone. Sending you a few bucks now
[Captivate Android Development] Guardian_Bob:
This does not affect Blinky at all.
[Captivate Android Development] Guardian_Bob:
So I haven't let go completely of this issue and the original request. If you can point me a ROM that does the right thing I may be able to do exactly what you want.
[Captivate Android Development] lrs421:
This is sooo cool. Good luck on the market. Can't wait to give it 5 stars!
[Captivate Android Development] reinbeau:
Interesting - my phone would not download it, said it wasn't supported on my phone - it's a rooted Captivate running Assonance 5.2 :confused: I've been able to download anything else I tried....
[Captivate Android Development] Haloruler64:
try enabling browser downloads in Astro settings
[Captivate Android Development] boomerod:
GB, Nero v3 has both capacitive bl on screen touch and haptic on home. Also, Phoenix 1.0 has both.
[Captivate Android Development] Pirateghost:
those are both VIBRANT based roms

not i9000

i think anything actual captivate, or vibrant are working properly
[Captivate Android Development] Haloruler64:
Anything but an i9000 will have haptic on home, because they all have 4 soft keys. But someone fixed the haptic big in some i9000 ROM, I forget who it was.
[Captivate Android Development] Pirateghost:
yeah, i wasnt actually referring to the haptic....i was referring to the lights
[Captivate Android Development] RashaMatt:
AWESOME - you are my savior!! :-)

Donation made :)
[Captivate Android Development] reinbeau:
Thank you - but could you explain how to do that? I do have Astro File Manager, if that's what you mean by Astro. I've been downloading several apps via the browser, this is the first one that failed.
[Captivate Android Development] MikeyMike01:
It's in the settings for Astro.

Sent from my Captivate.
[Captivate Android Development] reinbeau:
Awesome, learn something new every day! :)
[Captivate Android Development] Guardian_Bob:
So if you go to the market and search for "Keep The Lights On" with quotes... it be there.

Added a toggle widget, you must enable once as it starts disabled.

Oh I should note, this took approximately 8 hours and 4 bottles of beer to complete. Widgets are a pain in the rear.
[Captivate Android Development] reinbeau:
If you've already installed it the other way, should you bother to get this toggle? Will the new toggle widget overwrite it?
[Captivate Android Development] Guardian_Bob:
You know, I haven't tried. I uninstalled since I had the latest version as part of my testing.

I would assume it could upgrade if the market link was there. That said, if the old version is working for you, there's no compelling reason to upgrade.
[Captivate Android Development] Guardian_Bob:
Thank you, I do appreciate how hard it is to earn a buck nowadays, which make donations like this even more extraordinary.

I've been working at this for about 3 months (general Android development, not this app) and it is nice to know that effort is not only helpful to others but greatly appreciated by people.

Cheers,

Guardian_Bob
[Captivate Android Development] Guardian_Bob:
I'm having to decompile the input processing code so it shouldn't matter as long as the ROM is for the Galaxy S. The more examples, the better as this will be non-trivial to change.
[Captivate Android Development] Pirateghost:
Then i would have a look at cognition
[Captivate Android Development] Guardian_Bob:
Thanks, I thought cognition did this but I wasn't sure.

I wanted confirmation from someone who was running it, as this is a framework thing.
[Captivate Android Development] boomerod:
webstar1 fixed it in his now gone from the scene JP7/8 ROM - haptic and backlighting worked.
[Captivate Android Development] Ironjoey:
GB-

You are now officially my absolute favorite developer! I have been wanting a fix for those dang buttons since I first got the captivate. Works perfectly. You rule!

Just posted about this on the samsung captivate forum to spread the word. Looks like I was even the first one to leave feedback on the market too!
[Captivate Android Development] Guardian_Bob:
Thanks for buying the pro version, I'm looking to add a few features, that are configurable.
[Captivate Android Development] Haloruler64:
What features? I am considering buying the pro version possibly for said features :)
[Captivate Android Development] Guardian_Bob:
So I can't promise anything, I haven't seen the effort required yet but what I'm considering is:

Tasker Support

Adding a light sensor check when waking up the screen to change the behavior

Better way of changing the lights to get rid of the annoying superuser request message every so often

A way to theme the widget.
[Captivate Android Development] Pirateghost:
i will purchase pro just for the tasker support if you go that route....tasker is my lifesaver
[Captivate Android Development] Haloruler64:
The superuser request can be disabled in the superuser app, just by disabling the (always annoying) notifications. That's what I do, helps with drocap too. But the light sensor check and theme support would be great :) not sure what Tasker is though
[Captivate Android Development] Pirateghost:
GASP!

lol

its pure awesome is what it is

http://tasker.dinglisch.net/
[Captivate Android Development] Haloruler64:
...want. bad
[Captivate Android Development] seeker9:
tried the free one, love it! Getting the donate version now. Much gratitude.
[Captivate Android Development] connexion2005:
Awesome MOD. Made a video for it here http://www.youtube.com/watch?v=IKovqRZUlUc

OP add it to the original page if you want to help folks see this awesomeness.
[Captivate Android Development] blackwolf13:
Is there any feed back on how much this will shorten the battery life?
[Captivate Android Development] MikeyMike01:
It's negligible.

Because it only runs when the screen is on, and if the screen is on the screen is sucking battery.
[Captivate Android Development] blackwolf13:
Thanks Mikey.

posted before i noticed the this was not the only page in the thread.

After reading the thread was coming back to this page to edit my post, but you beat me to it.
[Captivate Android Development] iiBenxD:
Bought the donation version, and it works great! Thanks a ton GB (:
[Vibrant Q&A, Help & Troubleshooting] ferhanmm:
Sometimes when I try to download a file from the browser it downloads a .htm file instead. This happens on various sites and only sometimes. Wondering if anyone else is experiencing this.
[Gen8, Gen9, Gen10 Q&A, Help & Troubleshooting] Kashban:
Hey!

I had some apps moved to the internal storage using the stock app2sd feature of Froyo... only to discover that some of them got lost after one or more reboots.

Data is still there but the apps are not installed anymore. Only way to recover them is to reinstall them from the market.

Anybody else facing this issue?

Cheers,

Kashban
[Gen8, Gen9, Gen10 Q&A, Help & Troubleshooting] cajl:
for move the apk on internal memory

see applications

not all applications will be moved
[Gen8, Gen9, Gen10 Q&A, Help & Troubleshooting] fly_us:
got the same problem, app keep disappear here and there. Now i decided to use the system memory only coz sooner or later the app will gone if i move it to SD or internal memory.

Not sure it is the firmware problem or froyo problem.