Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
marc1706
Old
(Last edited by marc1706; 20th July 2012 at 10:54 PM.)
#1  
Recognized Developer - OP
Thanks Meter 2145
Posts: 407
Join Date: Dec 2009
Location: Clausthal-Zellerfeld / Munich

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

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.
My 2.6.35.14 kernel for the HTC HD2 repo: https://github.com/marc1706/desire_kernel_35
Devices: HTC HD2 (#2), Google Nexus 4


phpBB.com MOD-Team Member

Follow me on twitter.
The Following 59 Users Say Thank You to marc1706 For This Useful Post: [ Click to Expand ]
 
marc1706
Old
(Last edited by marc1706; 20th June 2012 at 10:00 AM.)
#2  
Recognized Developer - OP
Thanks Meter 2145
Posts: 407
Join Date: Dec 2009
Location: Clausthal-Zellerfeld / Munich

 
DONATE TO ME
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
My 2.6.35.14 kernel for the HTC HD2 repo: https://github.com/marc1706/desire_kernel_35
Devices: HTC HD2 (#2), Google Nexus 4


phpBB.com MOD-Team Member

Follow me on twitter.
The Following 10 Users Say Thank You to marc1706 For This Useful Post: [ Click to Expand ]
 
Kameirus
Old
#3  
Kameirus's Avatar
Senior Member
Thanks Meter 1932
Posts: 5,502
Join Date: Feb 2010
Location: Gloucester,Ma

 
DONATE TO ME
awesome thanks Marc
works perfectly
If You Cant Be Bothered To Read..We cant Be Bothered To Answer Your Questions
if you find it necassary to add click the thanks button to your sig your doing it wrong

[Q&T for [Pixeldroid JB 4.2.2] [AOKP] [720p/Cam/Camcorder/Sound/NOS]]

Q&T for [Pixeldroid Jelly Bean 4.2.2][XYECMAO][Monster Sound][NOS Injected] Rom


Rom...[21/04/2013][Pixeldroid JB 4.2.2 V3.0] [AOKP] [720p/Cam/Camcorder/Sound/NOS][cLK][DOE]
Kokotas black lk 1.5.1.9
CWM
HSPL 3.03
sys part 425
The Following User Says Thank You to Kameirus For This Useful Post: [ Click to Expand ]
 
kinghunki
Old
(Last edited by kinghunki; 19th June 2012 at 05:33 PM.)
#4  
kinghunki's Avatar
Senior Member
Thanks Meter 246
Posts: 390
Join Date: Dec 2009
Location: LanZhou

 
DONATE TO ME
thanks Marc !

My test result:
after the power over 90% LED lamps do not appear(sense3.5)

————————————————————
Device: HTC Sensation
Rom: DarkSense | Android 4.0.4 | sense 4.1
Radio: 11.76A.3504.00P_11.24A.3504.31_M
HBOOT: 1.27.1100
SD Card: SanDisk 16GB C4

————————————————————
I'm sorry, my English is not good enough!
If you do not know what I mean, please tell me!!


If my advice is helpful to you, click the THANKS button....
 
marc1706
Old
#5  
Recognized Developer - OP
Thanks Meter 2145
Posts: 407
Join Date: Dec 2009
Location: Clausthal-Zellerfeld / Munich

 
DONATE TO ME
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.
My 2.6.35.14 kernel for the HTC HD2 repo: https://github.com/marc1706/desire_kernel_35
Devices: HTC HD2 (#2), Google Nexus 4


phpBB.com MOD-Team Member

Follow me on twitter.
The Following User Says Thank You to marc1706 For This Useful Post: [ Click to Expand ]
 
mainweb
Old
#6  
mainweb's Avatar
Senior Member
Thanks Meter 60
Posts: 362
Join Date: Dec 2010
Location: Frankfurt/Main
What a pity!!!
it doesn't work on GB.
I'm on MIUI. will try on ICS then

Thank you
Device: HTC HD2
HSPL: 2.08.HSPL
Radio: Leo RADIO 2.15.50.14
Bootloader: MAGLDR 1.13 or CLK 1.4.0.1/CLK 1.5
Recovery: ClockworkMod Recovery 5.0.2.7
 
tangbohu
Old
#7  
Member
Thanks Meter 15
Posts: 30
Join Date: Feb 2009
Try on Tytung's ICS 2.3 rom and it works! Thanks.
 
ayyu3m
Old
(Last edited by ayyu3m; 19th June 2012 at 07:59 PM.)
#8  
ayyu3m's Avatar
Senior Member
Thanks Meter 201
Posts: 1,614
Join Date: Oct 2007
Location: System Error
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.

One S (VilleC2) Android 4.1.1 Sense 4+
Desire X (ProtoU) Android 4.0.4 Sense 4.1a
Wildfire S (Marvel) Android 2.3.5 Sense 2.1
HD2 (T-Mobile Leo) Android 2.3.3 Sense 2.1

Additional HTC Widgets - Desire X (by ckpv5)
Index - Everything Desire X (by nlooooo)
 
Looki75
Old
#9  
Senior Member
Thanks Meter 267
Posts: 694
Join Date: Apr 2010
Thank you Marc!!!

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


Cheers!
Samsung Galaxy S3 International LTE - i9305
Stock ROM I9305XXBMB5 (Jelly Bean 4.1.2) rooted

My tips to improve by 3 times your battery life are here:
http://forum.xda-developers.com/show...php?p=15229416
 
bipinsen
Old
#10  
Senior Member
Thanks Meter 82
Posts: 871
Join Date: Sep 2007
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.

Phone: T-Mobile US HD2
Bootloader: MAGLDR 1.13
CWM: CWM Recovery Touch
ROM: PACman HD2 v1.2a [PA/AOKP/CM10]
Radio: 2.15.50.14

 
Post Reply+
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Go to top of page...