[APP][SVC][Mar 8, 2010] BattLineSvc V2.1 / Battery Indicator Line in Title Bar

Search This thread

mike2nl

Senior Member
Jul 24, 2009
3,965
670
64
Near Utrecht
On saturday, I installed 2 new apps on my device:
1: Co0kieMonster's HomeTab
2: BattLine Service.

Since then - the power consumption increased dramatically.
Before that - my device's battery dropped about 13-15 percent on an average day.

So made a little test to see which of the Apps is responsible -
(All tests were done with the device "suspended")
the results are not too encouraging:

See that with the BattLine uninstalled - the device used about 1% an hour,
and with the BattLine installed, the device used at least 2% each hour.

Sadly I didnt have the time to perform the full comprehensive test -
with none of the apps installed, and with BattLine only.
(Hopefuly I would be able to do that during the next few days)


(The device used is HTC HD2, ROM 1.48.405.2(71294) Manila 2.5.19211619.0)

Hi pupakota and Som30ne,

i have installed the same as Som30ne and i have no battery drain at all.

Question: which other software is installed? There can be a problem with other dependencies. No? Why you know that?

What is known: cookies mod needs more cpu power because the functions (tested now on 15 different phones with all my friends). But the app from cookie is one of the best peace of soft i have seen for that issue.

How to solve: switch off animation and swipe the app buttons under the bottom bar.

More to solve: Active sync is more active if cookies mod is active. But there is a solution for that (read this) That was the solution for my friends and me. We all have also running iPT and now our CPU's needs not so much performance then before and the battery drain is AWAY. When you will have more standby time: Don't install ANY software.

Why all this: with which operating system you are working, windows? You have more questions like this?

Answer: problems with MS and Active Sync are known from every developer and everyone has different problems with that. So please ask Microsoft for a solution, i think :D or use an iiiiiPhone :D.

I am not rude, i will only be clear. I think everyone has forgotten what we all here are using MS trouble bubble shi..y things.
 
Last edited:

thx1200

Inactive Recognized Developer
I highly doubt it's BLS. All BLS does is sit around waiting for battery events. It does not actively poll the system anymore. Even when it did, it only did so when the device was NOT suspended. BLS does request unattended mode so it can retrieve all power notifications reliably, but that only lasts 15 seconds after suspend and BLS does not reset the idle counter.

Others have already discussed the problem with your test and percentages, so I won't bother. :) Good luck finding your power drain.

On saturday, I installed 2 new apps on my device:
1: Co0kieMonster's HomeTab
2: BattLine Service.

Since then - the power consumption increased dramatically.
Before that - my device's battery dropped about 13-15 percent on an average day.

So made a little test to see which of the Apps is responsible -
(All tests were done with the device "suspended")
the results are not too encouraging:
Code:
Date Time	Batt Level	BattLine	Co0kie HT
2010/03/28 19:00	94%	-		+
2010/03/28 20:00	93%	-		+
2010/03/28 21:00	92%	-		+
2010/03/28 22:00	91% 	-		+
2010/03/28 23:00	88%	+		+
2010/03/29 00:00	86%	+		+
2010/03/29 01:00	84%	+		+
See that with the BattLine uninstalled - the device used about 1% an hour,
and with the BattLine installed, the device used at least 2% each hour.

Sadly I didnt have the time to perform the full comprehensive test -
with none of the apps installed, and with BattLine only.
(Hopefuly I would be able to do that during the next few days)


(The device used is HTC HD2, ROM 1.48.405.2(71294) Manila 2.5.19211619.0)
 

thx1200

Inactive Recognized Developer
I can't install the 2.1 cab on HTC Panda WM5.0 :(

The message about unsuccesful instalation apears. I am installing it into device.

is there any problem with Panda or am I doing something wrong

It may not support WM5.0. I compiled it for 6.0+. :-(

I may be able to compile it for 5.0. I'm not sure if I'm doing anything 5.0 can't support in the service. I need to research.
 

thx1200

Inactive Recognized Developer
Answer: problems with MS and Active Sync are known from every developer and everyone has different problems with that. So please ask Microsoft for a solution, i think :D or use an iiiiiPhone :D.

I disagree with there being a problem with AS. I think a lot of the problem stem from constantly trying to prevent AS from doing its thing. lol. I sync to exchange, so I have an active push email AS session running all day. Still, after an entire day, my TP2 will only be down to about 75% at the end of the day. Seriously!

A lot of these problems are ROM related with so-called performance and battery life enhancements that have the opposite effect. Sometimes killing a process to save CPU/battery has the opposite effect.

;-)
 

mike2nl

Senior Member
Jul 24, 2009
3,965
670
64
Near Utrecht
I disagree with there being a problem with AS. I think a lot of the problem stem from constantly trying to prevent AS from doing its thing. lol. I sync to exchange, so I have an active push email AS session running all day. Still, after an entire day, my TP2 will only be down to about 75% at the end of the day. Seriously!

Hi thx1200,

you are also right. But when i delete the start process for autosettime and active sync in the registry (my own tests) the battery drain is over. Also Active Sync has one job :D:

10 poke "i have to sync"
20 goto 10

This results in a drain. I think this is logical and legal ;).

A lot of these problems are ROM related with so-called performance and battery life enhancements that have the opposite effect. Sometimes killing a process to save CPU/battery has the opposite effect.

Right, and that is what i have tested. Now around for 4 weeks after i have found and read so many things. And at the end i have one phone (glass broken phone from a friend, housing lost and open :D) to test all the apps togehter, until i find a problem. And i find enough problems. After i have found a solution or the code is changed, i install it on my 1st phone.


Still, after an entire day, my TP2 will only be down to about 75% at the end of the day. Seriously!

You are right, and what's the problem? Charge it and that's it. When we will have an eye on all things here on earth so as on our phones, it will be 100 times better. So start with something different to save power and not with our phone's. Please don't touch my phone it is my soul :p.

[JOKE]Everyone buys new toilett paper when it is out. If someone laments... haaa the paper is empty, how can i spare it in the future?[/JOKE]
 
Last edited:

Som30ne

Senior Member
Nov 22, 2009
244
8
Hi pupakota and Som30ne,

i have installed the same as Som30ne and i have no battery drain at all.

Question: which other software is installed? There can be a problem with other dependencies. No? Why you know that?

What is known: cookies mod needs more cpu power because the functions (tested now on 15 different phones with all my friends). But the app from cookie is one of the best peace of soft i have seen for that issue.

How to solve: switch off animation and swipe the app buttons under the bottom bar.

More to solve: Active sync is more active if cookies mod is active. But there is a solution for that (read this) That was the solution for my friends and me. We all have also running iPT and now our CPU's needs not so much performance then before and the battery drain is AWAY. When you will have more standby time: Don't install ANY software.

Why all this: with which operating system you are working, windows? You have more questions like this?

Answer: problems with MS and Active Sync are known from every developer and everyone has different problems with that. So please ask Microsoft for a solution, i think :D or use an iiiiiPhone :D.

I am not rude, i will only be clear. I think everyone has forgotten what we all here are using MS trouble bubble shi..y things.

Well,
I have removed Co0kie's HT and the Battline -
abd the drain was at about 1 percent per hour.
I have re-installed just the BattLineSVC,
and the drain jumped to 2-3 percent per hour.

I will post the Full report when I install Co0kie's HT, and measure the Batt drain (probably tomorrow).
 

thx1200

Inactive Recognized Developer
Well,
I have removed Co0kie's HT and the Battline -
abd the drain was at about 1 percent per hour.
I have re-installed just the BattLineSVC,
and the drain jumped to 2-3 percent per hour.

I will post the Full report when I install Co0kie's HT, and measure the Batt drain (probably tomorrow).

I have CHT and BLS (of course) and do not experience power drain. Maybe it's the 1% battery increments causing the issue? That's not stock ROM behavior. Otherwise, i would lean toward your ROM. What ROM are you using? Neither BLS nor CHT should cause this.
 

thx1200

Inactive Recognized Developer
Hi thx1200,

you are also right. But when i delete the start process for autosettime and active sync in the registry (my own tests) the battery drain is over. Also Active Sync has one job :D:

10 poke "i have to sync"
20 goto 10

This results in a drain. I think this is logical and legal ;).

LOL. I think we may have different definitions of power drain. surely, with ActiveSync deleted, you will gain battery life because you lose a lot of the timer events involved with syncing and scheduling. If you are okay with that or don't use all the sync/organize features, then that's a great solution!

I consider power drain as a rather aggressive battery life drain. I don't think 25 to 50% for a day's worth of use bad and I think the synching and so on is worth a little more battery drain than without. :) Basically, the overheard of establishing a push email, I don't consider 'drain' but just the cost of doing business. lol.

Also, ActiveSync is actually quite a bit smarter than you tease. ;-) When in push-email mode, it leaves a TCP connection open with Exchange, but then goes to sleep. After the so-called 'heartbeat' (which I think is 20-30 minutes) it wakes up and sets up a new TCP connection. When updates are available, Exchange pushes data down the pipe to the open connection, which wakes the device and it will then act on it. Pretty clever.

If you have push disabled, though, it is what you wrote above, but with one extra line...

10 poke "i have to sync"
20 Wait some amount of minutes
30 goto 10


;-) ;-)
 

pyth27

Senior Member
Jan 15, 2009
57
0
I've been using BattLineSvc for one or two weeks now and I experienced heavy battery drain during this time. I did a lot of testing but i never supected BattLineSvc because it's described as very battery friendly.

So I was very surprised when I read that someone complained about battery drain in this thread. I uninstalled BattLineSvc and reinstalled the tool I was using before (WMMiniBattery). Here is what I observed:
When using BattLineSvc my battery would have lasted from morning to late evening, so I would have to charge it every night.
After uninstalling BattLineSvc the battery drain has decreased and it is still at 89% after 12 hours since the last full charge.
When using BattLineSvc I noticed that my phone was losing quite much power when it was in sleep mode, especially over night. One time my phone went from 50% to 0% while I was sleeping so I had to charge it after waking up. Now it loses only 5-10% over night.


This is only what I experienced, it is not a proof that BattLineSvc increased the battery drain. Maybe BattLineSvc activates something else that leads to a higher battery drain, I don't know. I like BattLineSvc very much because of obvious reasons (runs as a service, highly customizable) and I hope this problem can be solved. :)
 
Last edited:

Som30ne

Senior Member
Nov 22, 2009
244
8
I have CHT and BLS (of course) and do not experience power drain. Maybe it's the 1% battery increments causing the issue? That's not stock ROM behavior. Otherwise, i would lean toward your ROM. What ROM are you using? Neither BLS nor CHT should cause this.

Well, I have performed the comprehensive test,
and the conclusion is conclusive -
BattLine is surely draining power (at least on my device).

See for yourselves.
(as specified on the original message, I use a NON custom ROM:
1.48.405.2(71294) Manila 2.5.19211619.0 on an european HD2)
Code:
Date Time		│Batt Level 	│BattLine	│Co0kie HT
2010/03/29 04:00	│100%		│--		│ --
2010/03/29 05:00	│??		│--		│ --
2010/03/29 06:00	│??		│--		│ --
2010/03/29 07:00	│??		│--		│ --
2010/03/29 08:00	│98%		│--		│ --
2010/03/29 09:00	│98%		│--		│ --
2010/03/29 10:00	│97%		│--		│ --
2010/03/29 11:00	│96%		│--		│ --
2010/03/29 12:00	│95%		│--		│ --
2010/03/29 13:00	│93%		│++		│ --
2010/03/29 14:00	│90%		│++		│ --
2010/03/29 15:00	│87%		│++		│ --
2010/03/29 16:00	│86%		│++		│ --
2010/03/29 17:00	│83%		│++		│ --
2010/03/29 18:00	│80%		│++		│ --
2010/03/29 19:00	│77%		│++		│ --
2010/03/29 20:00	│75%		│++		│ --
2010/03/29 21:00	│???		│++		│ --
2010/03/29 22:00	│71%		│++		│ --
2010/03/29 23:00	│???		│++		│ --
2010/03/30 00:30	│66%		│++		│ --
2010/03/30 07:00	│100%		│++		│ --
2010/03/30 08:00	│???		│++		│ --
2010/03/30 09:00	│???		│++		│ --
2010/03/30 10:00	│94%		│++		│ --
2010/03/30 11:00	│92%		│++		│ --
2010/03/30 12:00	│100%		│---		│ ++
2010/03/30 13:00	│100%		│---		│ ++
2010/03/30 14:00	│99%		│---		│ ++
2010/03/30 15:00	│98%		│---		│ ++
2010/03/30 16:00	│98%		│---		│ ++
2010/03/30 17:00	│97%		│---		│ ++
2010/03/30 18:00	│96%		│---		│ ++
2010/03/30 19:00	│95%		│---		│ ++
2010/03/30 20:00	│95%		│---		│ ++
2010/03/30 21:00	│94%		│---		│ ++
2010/03/30 22:00	│93%		│---		│ ++
 
Last edited:

Som30ne

Senior Member
Nov 22, 2009
244
8
I wonder if BattLineSvc is forcing showing REAL battloss..

Well,
Since on my typical use I get about 4-5 days of use from the device WITHOUT any charging, and with BattLine I seem to lose about 40 percent of the battery, I would guess that even without the BattLineSvc I see the REAL loss of battery charge.

To be honest - I havent tried letting the device die off with the BattLineSVC installed, so maybe the BattLineSVC messe up the battery loss display, and the device would have been able to live for 4-5 days without a charge, although I highly doubt it.
 

thx1200

Inactive Recognized Developer
Well, I have performed the comprehensive test,
and the conclusion is conclusive -
BattLine is surely draining power (at least on my device).

See for yourselves.
(as specified on the original message, I use a NON custom ROM:
1.48.405.2(71294) Manila 2.5.19211619.0 on an european HD2)

I don't understand your chart. Can you elaborate?
 

thx1200

Inactive Recognized Developer
So I was very surprised when I read that someone complained about battery drain in this thread.

Well, honestly, you will see at least one post on EVERY application of somebody who claims battery loss. lol.

That said, I do take these reports seriously, but I just don't see any way BLS is causing this.

Can all of you with battery issues confirm that the Forced Update Interval is set to 0?
 

thx1200

Inactive Recognized Developer
Well,
Since on my typical use I get about 4-5 days of use from the device WITHOUT any charging, and with BattLine I seem to lose about 40 percent of the battery, I would guess that even without the BattLineSvc I see the REAL loss of battery charge.

To be honest - I havent tried letting the device die off with the BattLineSVC installed, so maybe the BattLineSVC messe up the battery loss display, and the device would have been able to live for 4-5 days without a charge, although I highly doubt it.

4-5 days of life??? What device are you using? i haven't seen that kind of battery life from any smart phone before.
 

pupakota

Senior Member
Sep 29, 2009
854
102
i haven't seen that kind of battery life from any smart phone before.
lol. how's that? wizard with good rom was able to work up to 7 days. asus(with 4y.o. battery) - 5-6 days.
nothing uncommon for good rom(less bs soft=better), and normal usage(and good device, i assume).
 
Last edited:

thx1200

Inactive Recognized Developer
Code Audit Time!

Here's the guts of BLS...

Code:
 g_mq = CreateMsgQueue(L"AvianWavesBattLineSvcPwrNotifQueue", &mqopt);
  if (g_mq)
  {
    g_pn = RequestPowerNotifications(g_mq, PBT_TRANSITION | PBT_POWERSTATUSCHANGE | PBT_POWERINFOCHANGE);
    if (g_pn)
    {
      while (WaitForSingleObject(g_mq, INFINITE) == WAIT_OBJECT_0) 
      {
        // Eat the power notification
        ReadMsgQueue(g_mq, &buf, sizeof(DWORD) * 16, &numberRead, -1, &flags);

        // Refresh the battery on any power change (we repeat several times since sometimes the battery level does not refresh in sync with the status change
        RefreshBatteryStatus();
        g_nowRepeat = 1;
        if (g_battTimerNowProc == 0)
        {
          g_battTimerNowProc = SetTimer(0, 0, 2000, battTimerNowProc);
        }
      }
    }
    g_pn = NULL;
  }

Code:
g_mq = CreateMsgQueue(L"AvianWavesBattLineSvcPwrNotifQueue", &mqopt);
This creates a message queue on which BLS can listen for system events.

Code:
g_pn = RequestPowerNotifications(g_mq, PBT_TRANSITION | PBT_POWERSTATUSCHANGE | PBT_POWERINFOCHANGE);
This asks the OS for notification when a power transition (wake to sleep, sleep to wake), status change (on AC / on batt), or power info (charge level) changes.

Code:
while (WaitForSingleObject(g_mq, INFINITE) == WAIT_OBJECT_0)
Sleep indefinitely until the OS gives us a message on the message queue.

Code:
ReadMsgQueue(g_mq, &buf, sizeof(DWORD) * 16, &numberRead, -1, &flags);
We don't care what the message is because we perform the same action on any message, so we just do a ReadMsgQueue to eat the message, but don't use the data in the buffer.

Code:
RefreshBatteryStatus();
Perform the battery check logic -- fetch the battery level and the AC line status.

Code:
g_nowRepeat = 1;
if (g_battTimerNowProc == 0)
{
   g_battTimerNowProc = SetTimer(0, 0, 2000, battTimerNowProc);
}
Some devices do not synchronously give us accurate battery data, even when we ask for synchronous updates, so set a timer to execute twice at an interval of two seconds apart to recheck the battery.

Anybody see anything I'm doing wrong with the API? Or any assumptions I am making that are incorrect?

I still wonder about that 1% battery level mod... What if it's jittering (100 to 99 to 100 to 99 to 100 to 99 etc) and it's just sending a gazillion battery notifications...?
 

thx1200

Inactive Recognized Developer
lol. how's that? wizard with good rom was able to work up to 7 days. asus(with 4y.o. battery) - 5-6 days.
nothing uncommon for good rom(less bs soft=better), and normal usage(and good device, i assume).

Jeez you guys must have no internet services enabled and not use the device much. My wizard gave me about two days if I used it lightly! But I have always had push email, rss updates, podcast downloads, and more, so... :)

EDIT: I'm CDMA and I've heard GSM is better on battery, so I'm sure that's part of it too. :)
 
Last edited:

thx1200

Inactive Recognized Developer
Well,
To be honest - I havent tried letting the device die off with the BattLineSVC installed, so maybe the BattLineSVC messe up the battery loss display, and the device would have been able to live for 4-5 days without a charge, although I highly doubt it.

You should try. Battery level is almost never linear. It's incredibly hard to measure battery level voltage accurately. You will notice that you battery level will change (go up!) if you turn off your device (cold off, not sleep), let it sit for a few minutes, then turn it back on. BLS being a very long line, may just be making the non-linear drain more apparent.
 

pupakota

Senior Member
Sep 29, 2009
854
102
g_nowRepeat = 1;
if (g_battTimerNowProc == 0)
{
g_battTimerNowProc = SetTimer(0, 0, 2000, battTimerNowProc);
}
damn, 2000 only? set it for minimum 30000(upd: 10k..)...almost realtime is not good idea for such long line...2k is not especially needed, imo.
(just observation, nothing more).
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    Overview
    You've seen these before -- the little green line at the top of the screen that indicates the current battery level. This app is really nothing new or revolutionary. The main difference of BattLineSvc is that it's a true Windows Mobile service, so it does NOT use one of the precious few 32 slots available for processes. You can find more information about services here. This app has been tested on Windows Mobile 5, 6, 6.1, 6.5, and 6.5.3.

    CodePlex
    BattLineSvc development is hosted at Microsoft CodePlex! http://www.codeplex.com/BattLineSvc

    License
    Ms-RL

    Tip Jar
    Like this app? Want more like it or quicker updates? Tip a buck (or Euro or Pound or whatever) or two to help the author out! Click here to make a safe donation via PayPal.

    Current features
    - Shows a nice bar along the top of your screen to indicate battery status.
    - Color changes based on 'warning' and 'critical' battery levels, as well as when the device is on AC power (configurable).
    - Immediately correctly resizes when the screen orientiation changes.
    - The battery level is updated immediately when the device notifies listeners that battery status has changed (or you can specify an interval if your device isn't sending notifications.
    - Can show a bar at the bottom, left, and right sides of the battery bar (if you want it).
    - Can be offset from the left and right, if you need it.
    - Height of the bar can be changed.
    - VERY low resources used -- runs as a TRUE service and uses as close as 0% CPU as is possible by an app like this. So it's good for even older snail devices. :-D
    - Has a configuration app (requires .Net CF 3.5)
    - AppToDate support!

    Recent Changes (See CodePlex or changelog.txt for longer changelog)
    - (2.1) Fixed a bug where on system start-up, it would pop up a notification box to let you know the service started. Annoying! And fixed!
    - (2.1) Fixed the styles in the notification boxes for start/stop service.
    - Fixed bug where sometimes the line would not show up, even with the 90 second boot-up delay. This was due to the window being created too early (not actually delayed, even though the subclassing was properly delayed. Oops!
    - Boot delay was reduced to 30 seconds from system start-up; so far no issues with it starting too early!
    - Added a "right side offset" which works as the left side offset, but for the right side.
    - Added a "right line" which works the same as the left line.
    - Added a new color setting for when the battery is charging. (Default is a light gray-blue.)
    - Battery status, by default, no longer refreshes on an interval, but instead by waiting for battery notification events. This makes BattLineSvc even more efficient! The interval timer is still there in case your device does not work with events only.
    - Reduced the number of subsequent refreshes by requesting a synchronous status refresh; previously it would wait asynchronously which was less efficient since the update could take anywhere from a few milliseconds to several seconds.
    - Removed a redundant battery status checking method which monitored the registry (no longer needed because the new power event-based system works better and is more efficient).
    - Removed a few other old segments of code that were inefficient.
    - Added user notification for starting/stopping the service with the start/stop apps.
    - Added a configuration program (yay). Requires .Net CF 3.5. You can still edit the registry manually.

    Registry
    Look in HKCU\Software\Avian Waves\BattLineSvc
    Colors are best edited as hex, using the following pattern: BBGGRR (seems backwards, but it's due to the endedness of DWORDS in CE). Your registry editor may not show leading zeros either, keep that in mind.
    - TaskbarClass = (string) Don't change this unless you are 100% positive the taskbar is not named standard.
    - Height = (int) Number of pixels tall for the battery line.
    - LeftOffset = (int) Number of pixels from the left edge that the battery line starts.
    - LowPercent = (int 0-100) What percentage of battery charged is considered low (yellow).
    - CriticalPercent = (int 0-100) What percentage of battery charged is considered critical (red).
    - ShowLeftLine = (bool) Show the vertical line on the left side of the title bar where the BattLine starts.
    - ShowRightLine = (bool) Show the vertical line on the left side of the title bar where the BattLine starts.
    - ShowBottomLine = (bool) Show a line on the bottom of the battery bar
    - ColorForegroundSolidNormal = (color) For 'normal' (not low) battery charge, this is the foreground color, default is bright green.
    - ColorBackgroundSolidNormal = (color) For 'normal' (not low) battery charge, this is the background color, default is dark green.
    - ColorForegroundSolidLow = (color) For low battery charge, this is the foreground color, default is bright yellow.
    - ColorBackgroundSolidLow = (color) For low battery charge, this is the background color, default is dark yellow / brown.
    - ColorForegroundSolidCritical = (color) For critical battery charge, this is the foreground color, default is red.
    - ColorBackgroundSolidCritical = (color) For critical battery charge, this is the background color, default is dark red.
    - ColorForegroundSolidCharging = (color) For when the device is charging (on AC), this is the foreground color, default is light gray-blue.
    - ColorBackgroundSolidCharing = (color) For when the device is charging (on AC), this is the background color, default is dark gray-blue.
    - ColorLeftLine = (color) Color of the left line.
    - ColorRightLine = (color) Color of the right line.
    - ColorBottomLine = (color) Color of the bottom line.
    - TimerIntervalSeconds = (int) How often do we look to see if the battery level has changed (in seconds)? NOTE: As of V2, set this value to 0 unless BattLineSvc is not updating on your device. Zero means disabled. This settings is no longer necessary as BattLineSvc now waits for battery notification events, instead of updating on a timer.

    Download
    CAB Installer: http://battlinesvc.codeplex.com/releases
    Source Code: http://battlinesvc.codeplex.com/SourceControl/list/changesets