FORUMS
Remove All Ads from XDA

[20.Jul.12][DEV] Lights Library v2 w/ correct LED color & notification while charging

435 posts
Thanks Meter: 2,363
 
By marc1706, Retired Recognized Developer on 19th June 2012, 04:31 PM
Post Reply Email Thread
If you don't know what a lights library is or what it does, then please move on. This topic is not for you.


Lights library with correct LED color & dual LED support

This lights library is based on the Pyramid lights library (HTC Sensation) by the CyanogenMod Project.

Differences to the normal lights lib we are currently using:
  • Based on HTC Pyramid lights lib from CyanogenMod Project
  • Show correct battery state
  • Add support for alternating LEDs (dual LED support)

Show correct battery state:
By default AOSP-based ROMs already report the devices as fully charged (green LED) even though the device is only at 90% of its battery capacity. This lights library will still show the amber LED until the kernel reports the battery as full.

Add support for flashing LED while charging:
Version 2 contains a changed behavior in comparison to the older version. The description of the older verison can be found below.
In the new version the LED will flash in the same color of your current charge state if you get a notification while charging, i.e.:
  • Charging & you get a notification --> Amber LED flashing
  • Fully charged & you get a notification --> Green LED flashing
The old behavior has a main disadvantage that the dual LEDs might not work correctly if the device goes into deep sleep. This is hardware related. The newer version doesn't have such a limitation as it uses the hardware supported modes.

Old behavior:
Quote:
Originally Posted by marc1706

Add support for alternating LEDs:
It is something that has been bugging me for a while now.The scenario is simple:
Your phone is lying on the table and you are getting a short message, mail or maybe miss a call. Once you get back it will normally blink the notification led and you'll know that you missed something. What if you are charging your phone though? The phone will just show the charging LED and there is no way to tell you missed something unless you unlock your phone.

I've been missing a feature that'll show the charging LED while shortly flashing with a different LED color in order to notify you of a missed short message, mail, etc.

While the Leo has support for something similar it is actually somewhat weird:
First the amber LED shortly turns on and then after a small pause the green LED turns on for an instant. Afterwards there is a rather long pause and then it starts over. This is actually more or less an amber colored notification followed by a green colored notification. As the purpose of dual LED support is to show that we have a notification while charging this is not properly met by the native support the Leo has.
Thus I decided to add my own implementation that'll show one LED first (color depends on the charge level) and switch to the other LED color and then after one second back to the original color. This way the LEDs will always be on and thus correctly represent the fact that the device is charging while it's also able to show that there is a notification.


Works with:

Source:
https://github.com/marc1706/android_device_htc_leo


Download:
lights.htcleo_v2.zip


Old version:
lights.htcleo.zip


Notes:
If you don't know how you can use the attached file then this topic is probably not for you.
The Following 62 Users Say Thank You to marc1706 For This Useful Post: [ View ] Gift marc1706 Ad-Free
 
 
19th June 2012, 04:31 PM |#2  
OP Retired Recognized Developer
Flag Clausthal-Zellerfeld / Munich
Thanks Meter: 2,363
 
Donate to Me
More
Confirmed to be working on the following ROMs:
  • NexusHD2-ICS-4.0.4-CM9-HWA V2.3
  • IceCreamTosti v1.1 [AOKP B36 ]
  • Dorimanx-ROM-HIGH-END 3.1.9

Confirmed to not work on the following ROMs:
  • Any Gingerbread Sense ROMs
The Following 12 Users Say Thank You to marc1706 For This Useful Post: [ View ] Gift marc1706 Ad-Free
19th June 2012, 05:08 PM |#3  
Kameirus's Avatar
Senior Member
Flag Red Bluff, California
Thanks Meter: 2,359
 
Donate to Me
More
awesome thanks Marc
works perfectly
The Following User Says Thank You to Kameirus For This Useful Post: [ View ] Gift Kameirus Ad-Free
19th June 2012, 05:26 PM |#4  
kinghunki's Avatar
Senior Member
Flag LanZhou
Thanks Meter: 737
 
Donate to Me
More
thanks Marc !

My test result:
after the power over 90% LED lamps do not appear(sense3.5)
19th June 2012, 05:43 PM |#5  
OP Retired Recognized Developer
Flag Clausthal-Zellerfeld / Munich
Thanks Meter: 2,363
 
Donate to Me
More
Sorry, forgot to add that I only tested it on a ICS Rom. As far as I know it should also work on AOSP-based Gingerbread ROMs without issues.

I haven't had any time to play around on Sense ROMs but it'll probably won't work correctly on Sense ROMs.
The Following User Says Thank You to marc1706 For This Useful Post: [ View ] Gift marc1706 Ad-Free
19th June 2012, 05:51 PM |#6  
mainweb's Avatar
Senior Member
Flag Frankfurt/Main
Thanks Meter: 74
 
More
What a pity!!!
it doesn't work on GB.
I'm on MIUI. will try on ICS then

Thank you
19th June 2012, 06:16 PM |#7  
Member
Thanks Meter: 16
 
More
Try on Tytung's ICS 2.3 rom and it works! Thanks.
19th June 2012, 07:14 PM |#8  
ayyu3m's Avatar
Senior Member
Flag System Error
Thanks Meter: 265
 
More
Exactly what i felt about missed notifications while on charge. Will test it out tonight and let you know.

Edit: Tried this on the rom I m using now (GB2.3.3 + Sense2.1). All my lights stopped working including display (toggle got disabled also. so couldn't adjust level) which remained full bright and hardware button lights didn't light up at all. So this isn't compatible with my ROM atleast.

Thankx though man. If you have time please consider making this compatible for GB sense. Would be great to see notification light blink while on charge too.
19th June 2012, 09:15 PM |#9  
Senior Member
Thanks Meter: 1,021
 
Donate to Me
More
Thank you Marc!!!

Question: is this lib supporting the "auto-brightness custom levels" functions of CM7 and CM9?


Cheers!
19th June 2012, 10:22 PM |#10  
Senior Member
Thanks Meter: 83
 
More
Do I have to do something special? I copied it to \system\lib\hw set permissions, cleared Dalvik cache and rebooted. Charging light comes on fine. Called the phone to do a miss call. No blinking?

Using AOKP rom like in sig.
19th June 2012, 10:34 PM |#11  
OP Retired Recognized Developer
Flag Clausthal-Zellerfeld / Munich
Thanks Meter: 2,363
 
Donate to Me
More
Installation should be as easy as copy/paste and setting the correct permissions (644).

Custom auto-brightness levels work with CM9.

@bipinsen: Did you touch the phone before it went back to sleep after you called?
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes