Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,781,370 Members 37,321 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
xfox
Old
#111  
Senior Member
Thanks Meter 3
Posts: 172
Join Date: Nov 2005
hope this works out
Who Dares WINS!


 
madmack
Old
#112  
madmack's Avatar
Senior Member
Thanks Meter 4,397
Posts: 3,527
Join Date: Dec 2008
Location: Boston, MA

 
DONATE TO ME
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 !
 
madmack
Old
#113  
madmack's Avatar
Senior Member
Thanks Meter 4,397
Posts: 3,527
Join Date: Dec 2008
Location: Boston, MA

 
DONATE TO ME
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.
 
teknx
Old
#114  
Member
Thanks Meter 0
Posts: 32
Join Date: Jul 2009
Quote:
Originally Posted by madmack View Post
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.
 
gTen
Old
#115  
Senior Member
Thanks Meter 39
Posts: 1,203
Join Date: Feb 2008
There is also another alternative possibility for notifications:

http://forum.xda-developers.com/showthread.php?t=727057
 
fabis_htc
Old
#116  
Member
Thanks Meter 4
Posts: 33
Join Date: Sep 2007
Location: London
Quote:
Originally Posted by gTen View Post
There is also another alternative possibility for notifications:

http://forum.xda-developers.com/showthread.php?t=727057
Great idea!!!
 
madmack
Old
(Last edited by madmack; 19th July 2010 at 01:43 AM.)
#117  
madmack's Avatar
Senior Member
Thanks Meter 4,397
Posts: 3,527
Join Date: Dec 2008
Location: Boston, MA

 
DONATE TO ME
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, 335 views)
 
gTen
Old
#118  
Senior Member
Thanks Meter 39
Posts: 1,203
Join Date: 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..
 
Unimaginative
Old
#119  
Unimaginative's Avatar
Senior Member
Thanks Meter 2
Posts: 131
Join Date: Jul 2008
Location: Sydney
A huge thanks to you madmack. This works a treat.
hardware HTC One software Android Revolution HD
hardware Nexus 7 software CM11
previous HTC Touch Diamond + HTC Magic + Motorola Milestone + Sharp 007SH + Samsung i9000 + Samsung Galaxy Tab (P1000) + Samsung Galaxy Tab 10.1 (P7500) + Samsung Galaxy S3
 
teknx
Old
#120  
Member
Thanks Meter 0
Posts: 32
Join Date: 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?

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Give Your Android Wear Device a Lock Screen with Lockable

Without a doubt,Android Wear is one of the most frequently talked abouttopics of … more

Forums Added for the LG G Watch R and Samsung Gear S

A little over a week ago, LG “inadvertently” let the world know about the … more

Secrecy App Goes Open Source, New LG Android Wear Device! – XDA Developer TV

Secrecy encryption app goes open source! That and much … more

Pushbullet Updated with SMS Send Ability

Pushbullet is one of thoseapplications that every Android lover should have installed on his or … more