T-Mobile HTC One M8 Gets Selfie-Friendly Android 4.4.4 OTA

The T-Mobie variant of HTC One (M8) just now received an over-the-air update … more

Android L is for Lockdown

Root is, without a doubt, the (un)holy grail of the Android world. Those wonderful permissions that allow you as … more

XDA Xposed Tuesday: XHangouts Will Improve Your Hangouts

Ever since Google started supporting text messaging in Hangouts many people have … more

Shattered Screen? Turn Your Broken Device into a Complete Media Center!

A cracked screen usually means you’ll have to spend a hefty … more
Post Reply

[MOD] Use the backlight botton for NOTIFICATIONS...

OP socket84

17th July 2010, 06:06 PM   |  #111  
Senior Member
Thanks Meter: 3
 
175 posts
Join Date:Joined: Nov 2005
More
Wink
hope this works out
17th July 2010, 06:19 PM   |  #112  
madmack's Avatar
Senior Member
Flag Boston, MA
Thanks Meter: 4,431
 
3,538 posts
Join Date:Joined: Dec 2008
Donate to Me
More
Ok, I've tampered with different files to try to activate the backlights of our capacitive buttons.. I had two previous android phones, I was able to do that task in both phones by modifying a file called "brightness" to include numbers (0 for off, 1 or 255 for on) to get the backlights of these LEDs to turn on and off.

The naming scheme and "brightness" file is usually easy to find by browsing through /sys/class and figuring out what folder corresponds to which device. I think the biggest candidate we have here is melfas-touchkey. Even though someone else tried to cat that file to see what it contained with no luck (Samsung might've protected them with some other method that am not familiar with, given that I couldn't cat it even with root), I actually was able to overwrite values to these files by simply echoing 0 or 1 to the file. We probably cannot read the file, but perhaps we can write to it? That however, didn't get the lights on but I think we're close.

I also ran a search in all subdirectories under /sys/class for "brightness" files and catted them all to see their values and effects. I was able to get the screen turn on and off by changing the values in "brightness" under the lcd directory.

I will keep playing around with these folders and post any findings here.

What we could also do is run a program that monitors file access on these directories/subdirectories and see what files get modified when the LEDs get turned on.

I also want to warn you guys that I had a friend who used his capacitive button's backlight as notifications and his lights went off after about a month of use. I think we should be cautious to the time values we set these LEDs to turn on/off to, they are simply not made to flash or blink continuously for prolonged periods.


Lets get this going !
18th July 2010, 01:43 AM   |  #113  
madmack's Avatar
Senior Member
Flag Boston, MA
Thanks Meter: 4,431
 
3,538 posts
Join Date:Joined: Dec 2008
Donate to Me
More
Found a bug in the drivers that might be useful.


if you cat /sys/devices/virtual/misc/melfas_touchkey/touch_version while the phone's screen is off and then go ahead and touch one of the capacitive buttons, they'll light up and stay that way until you wake the screen up. dmesg is flooded with "touchkey is not enabled.W" which I only found to exist in cypress-touchkey.c

I tried echoing numbers to enable_disable and brightness after that step to no avail. Although it might be worth mentioning that dmesg prints the numbers I echo to brightness. For example, "echo 255 > brightness" will give a dmesg "touch_led_control: 255"


I'm done for the day, will appreciate if anybody has any input on this.
18th July 2010, 02:47 AM   |  #114  
Member
Thanks Meter: 0
 
32 posts
Join Date:Joined: Jul 2009
Quote:
Originally Posted by madmack

I also want to warn you guys that I had a friend who used his capacitive button's backlight as notifications and his lights went off after about a month of use. I think we should be cautious to the time values we set these LEDs to turn on/off to, they are simply not made to flash or blink continuously for prolonged periods.

This point should not be overlooked. I noticed on my vibrant that the capacitive light buttons are somewhat bright and I wouldn't be surprised if they get burnt out from overuse.

With that being said, I think once the button light issue has been figured out, the buttons should not light up all at once with the regular on and off pattern. A successive pattern from left to right for example would use less battery and hopefully avoid burning them out the lights compared to lighting them up all at one time in intervals. The successive pattern would also look much cooler in my opinion.

Thanks for the helpful info madmack and for keeping us updated.
18th July 2010, 09:15 PM   |  #115  
Senior Member
Thanks Meter: 39
 
1,203 posts
Join Date:Joined: Feb 2008
There is also another alternative possibility for notifications:

http://forum.xda-developers.com/showthread.php?t=727057
18th July 2010, 10:28 PM   |  #116  
Member
Flag London
Thanks Meter: 4
 
33 posts
Join Date:Joined: Sep 2007
More
Quote:
Originally Posted by gTen

There is also another alternative possibility for notifications:

http://forum.xda-developers.com/showthread.php?t=727057

Great idea!!!
18th July 2010, 10:49 PM   |  #117  
madmack's Avatar
Senior Member
Flag Boston, MA
Thanks Meter: 4,431
 
3,538 posts
Join Date:Joined: Dec 2008
Donate to Me
More
Ok guys, I'm done playing around with the softkeys' backlight. I truly believe that the source code for the melfas-touchkey that samsung released to us is not identical to the one installed on our device (I know that because I'm running some commands as root that are supposed to give kernel output with dmesg but aren't), so I took a slightly different approach.

I saw the idea posted somewhere previously that instead of getting the capacitive lights on, we really should be putting the screen's AMOLED screen to work ! specially that it doesn't consume any backlight energy when displaying a black screen. So I developed an app that does just that, upon receiving an audio notification, it will display a black screen with a red dot somewhere in the left top corner. Ok, i really should put these in bullet points..

the application does the following:

1. When your phone sounds a notification, it switches the screen on and displays a red dot somewhere in the top left corner. The location of this dot is random every time you receive a new notification. This will guarantee using different LEDs so that the same ones won't be burned out ! The reason why I chose red is because it uses the least amount of energy to display.

2. The app runs as a service, after installing, you'll need to lock the screen once and unlock it for it to activate. After this, the application should run automatically after a reboot.

3. To get rid of the red dot, the only key you can use is the home key. Using the capacitive touch buttons will do nothing, and so as clicking anywhere on the screen. Once your screen turns on, the notifications disappear and will not come up until a new notification sound is received.

I have also logged the touch drivers and saw that although I'm displaying a black screen and setting flags to not respond to touch messages, android is still receiving touch messages when you touch any spot on the screen. This, I imagine, consumes resources! So I disabled the touch drivers when the black screen is active. Pressing on the Home button should reactivate it. If your screen is unresponsive to touch even after the notification screen is dismissed, a simple restart should take care of it. Once you've restarted, you can uninstall the app.

Now the touchscreen drivers were a lot easier to mess around with. The sourcecode given by samsung helped me achieve the activation/deactivation of the screen. Things are not the same with the capacitive buttons. You'll notice that when the black screen is on, if you touch any of the soft buttons, they'll light up (although am suppressing them programatically). Am still analyzing the drivers to see if there is an easy way to disable these drivers too when the notification is on.

One more note, make sure the notification sounds that you choose for your different apps (Calendar, Gmail, Gtalk.. etc) are the default samsung notifications or the ones you placed in /sdcard/sd/media/audio/notifications
Any other sound notifications will simply not trigger the program to display the notification screen.



I just want to let you guys know that this is a beta, better yet, an alpha release. Install it at your own risk.

Enjoy ! Comments and feedback will be appreciated
Attached Files
File Type: apk FoldMod.apk - [Click for QR Code] (11.1 KB, 336 views)
Last edited by madmack; 19th July 2010 at 01:43 AM.
18th July 2010, 11:00 PM   |  #118  
Senior Member
Thanks Meter: 39
 
1,203 posts
Join Date:Joined: Feb 2008
NICE! Thanks a lot! I was playing around with it on the Android emulator but don't have a device to test on so it makes it harder

As for suggestions, we made a few more in that thread about using the proximity sensor and light sensor to conserve energy when possible...also about letting the cpu idle..

But either way great job!

You should probably make a separate thread for it so more can see it and maybe get a sticky..
18th July 2010, 11:12 PM   |  #119  
Unimaginative's Avatar
Senior Member
Flag Sydney
Thanks Meter: 2
 
131 posts
Join Date:Joined: Jul 2008
More
A huge thanks to you madmack. This works a treat.
19th July 2010, 01:13 AM   |  #120  
Member
Thanks Meter: 0
 
32 posts
Join Date:Joined: Jul 2009
Awesome job madmack. I never thought we would get an app like this so soon. It hasn't even been a week yet!

I think we need to do some extensive testing to see how much or little battery the black screen and 1 red dot uses. If it is very very minimal then maybe we can work with a few ideas to improve things in terms of presentation.

As far as testing goes, I think a good way to test it out would be to record the battery percentage before getting a msg, then have the black screen and red dot come up, and leave it there for an hour(or more, maybe even over night) and see how it affects the battery life.

Current bugs
- Does not work in vibrate mode


Suggestions
1. 1 dot for each missed message, they can be grouped together in a box like sequence so it is easy to count while the dots move to random positions on the screen.

2. Different color dots for different kinds of notifications i.e. calls. So for example, after the color red we would use the next color that drains the battery the least like blue for a missed call.

3. Keeping the random positions of the dots possibly within the first top 10 horizontal and vertical pixels , so as to give it a look of a real LED notification near the top of the phone. Hah, i just realize the super amoled screen is so black, from far away the red dot actually looks like a LED (awesome)

4. If battery life isn't too much of an issue, we can introduce periodic animations to get the user's attention better than a static dot.

5. Ensure compatibility with popular sms apps like Handcent and the No Lock app which allows people to bypass the lock screen after pressing the unlock button. (right now it seems to work with hand-cent okay)

what does everyone else think?

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Top Threads in Galaxy S I9000 Android Development by ThreadRank