Feature that would save battery life by a lot - Android Q&A, Help & Troubleshooting

No idea if this is the right place to post a feature request -- I've done a lot of searching and this seems closest.
I've been doing some testing here in an area with little-to-know cellular coverage. A substantial part of the world is in this situation. What I've found -- and this can be no surprise -- is that battery charge life is abysmal as the device seeks in vain for a good signal. What did surprise me is that this search and the resultant battery drain continues even when the device has a strong connection to a WiFi network. By going into airplane mode with WiFi enabled in an area of little cellular signal, I've found an enormous saving in battery life, with no loss of functionality -- still have WiFi calling and everything else.
With WiFi and cellular turned on, I'm burning 4 to 5 percent of the battery per hour (Pixel 6a, current GrapheneOS, normal use). With airplane/WiFi only, no searching for a cell signal, same device and same amount of use, I'm using well under 1 percent per hour. Battery life that was measured in hours is now measured in days.
What's necessary is for me to turn on airplane mode with WiFi enabled when I'm on WiFi, and turn airplane mode off when I leave WiFi. Of course, the issue is to remember to do this.
What I'm seeking, then, is a toggle that automates the process, that invokes WiFi only when logged in to WiFi, but that restores full cellular when one is no longer on WiFi (typically through having moved out of range of the WiFi network).
I do not think that this would require much programming, merely the addition of a switch (probably on the SIM page) that would enable it. But I cannot think of a single feature that would be more useful to users. It would provide battery savings to everyone, though some more than others.
Thanks for reading this and, if there's a place more appropriate to post it, for directing me there.

Greenify is good for improving battery life

the_arxyn said:
Greenify is good for improving battery life
Click to expand...
Click to collapse
Good. So is turning off the phone and putting it in a plastic bag in the fridge. What I'm proposing here is maintaining full functionality of the device while extending the life of a charge by as much as 5 times, without even the slightest performance hit. Actually, that part can already be done; what I'm proposing is a toggle that automates it for those who want it.

For automation macrodroid is best

the_arxyn said:
For automation macrodroid is best
Click to expand...
Click to collapse
I'm very sorry. Apparently my meaning was unclear. This, a switch somewhere in the configuration options, is a feature request that I was making because I think it would benefit AOSP overall, provide economy and convenience, and be something not found elsewhere. I seem to have accidentally asked what program will make a battery last longer while only partially shutting down the device, or what program would be best to kludge together a way of doing this. I apologize for my lack of clarity.

Related

Best Battery ROM?

which ROM has the best battery life,i have a friend and to him features and speed are irrelevant- just wondering which rom on these forums has the best battery life- in my experience its PROven 2.2
I'm just going to jump in here before you get flamed all to hell...
There is no "Best ROM for battery life." It depends on your radio, your location, your usage habits...
Have your friend try various ROMs until he finds one that suits his needs...
Merrell
And I assume an admin will lock this thread soon.
stock rom my friend
Battery Life Reco
I would think that ROMeOS or Elite project, since they are the most actively developed and publicized, and I know they have very recent drivers, might be best for your friend.
Also, they would get a lot of complaints if battery life dropped off. Same goes for a recent stock ROM, so there's that option as well.
A crucial note for battery life:
Use Advanced Config to enable the "3G" on/off switch in Comm Manager. Also, have your connections disconnect after 60 seconds of inactivity.
I get 1 day of battery life with normal usage when I leave HSDPA on, where as if I stick with EDGE, I can get 3-4 days. That's with IMAP e-mail retrieving every 15 minutes! Brilliant, if you ask me.
Note: I used a BlackBerry 7290 that worked on GPRS only this past summer, and its battery would last for 7-10 days! The faster your connection, the more quickly your battery drains. I've only witnessed few exceptions, one being an LG CU515, but I'm convinced it just turned off 3G without notifying the user to save battery.
I would love it if my TP kept to GPRS until I opened a browser or hit send/receive on my e-mail, (ideally using EDGE here, perhaps HSDPA for attachments) but I think that would be fairly hard to configure/no one has done it yet. Also, it would suck to receive an important call (phone interview, for example) and be stuck with non-3G voice and thus degraded quality. However, I hear 3G voice tends to disconnect more often than non-3G (while 3G is turned off) especially when moving from cell to cell, and as I recall basic GSM call quality is usually pretty good.
"Which ROM has the best battery life?" is a question we cannot answer for you. Everybody on here does something different from the next person, so results will ALWAYS vary.
The best way to control battery life is to try different radios until you find one that performs good in your area. A radio that doesn't have to work [very] hard to find a signal will not drain the battery as fast.

[BRAINSTORM] Increasing battery life by deactivating APN when low signal

Apologies if this belongs in Themes & Apps, but I thought it seems more like programming at the OS level than a new app.
I had an idea while driving home after a long day in a location that had low 3G signal, and my phone was dead:
Latedroid's Juicedefender helps save battery by turning off the APN every x minutes, and we know that using 3G/EDGE data eats up a lot of battery, especially when in a low signal area (takes more power to transmit).
How feasible would it be to create an app/build in code in Android for the functionality to turn off/disable the APN when the signal level is below a certain threshold?
Of course, you would need to build in some sort of manual override for times you really want to use data even if you are in low signal area. Perhaps if the device is NOT in sleep, do not disable the APN regardless of signal strength. But if the device is sleeping, disable APN if signal is lower than x dB.
What do you all think? Problems I already foresee is that switching APN on and off would have a delay upon first wakeup, or possibly interrupt data transfers in progress when device goes to sleep.
Thanks,
--Hans
Very interesting
Actually, this sounds like a very good idea. Now, just need to find a dev capable of producing such results. Maybe contact the developer of Juice Defender/Plotter and see if it is feasible. I like where this could go though. Battery is the ONE complaint I have about my otherwise sexy and powerful device!
Great idea.
I have thought about this as well.
this would be too difficult to implement i would think. even in strong signal areas, the reception bounces all over the place sometimes. the phone would constantly be bugging itself out i would think as the signal dips below, then goes right above, the threshold level.
RogerPodacter said:
this would be too difficult to implement i would think. even in strong signal areas, the reception bounces all over the place sometimes. the phone would constantly be bugging itself out i would think as the signal dips below, then goes right above, the threshold level.
Click to expand...
Click to collapse
Nah, I don't think so. With some clever programming and it watching maybe an average signal level over some period of time, I think it could do pretty well. The idea is to avoid HUGE battery drains over a moderate amount of time.
For example, if i'm at work in my office building, i get 0-1 bars of signal strength for 8 hours. It would be great if it detected after, say...10 minutes that my signal strength was in the crapper, and turned off the APN (or at least, account syncing) so I won't leave work 8 hours later with 5% battery life. But, if I wake my phone up, it will automatically turn the APN on so I can use data as I see fit.
But let's say I go out for lunch. The phone would either detect that I'm changing position/location via cell towers, or it would just regularly poll signal level and when it found that my signal level had increased by some delta amount over say...5 minutes, it would turn the APN back on.
I find that most of my frustration with this phone is with battery drain, and most of the drain comes from sitting in low signal areas for extended periods of time. If this could be accomplished (with configurable thresholds and stuff about time to average the signal over, etc) I think it would be an excellent addition to the customization-ability of android!
Good thoughts.
THATTON said:
Actually, this sounds like a very good idea. Now, just need to find a dev capable of producing such results. Maybe contact the developer of Juice Defender/Plotter and see if it is feasible. I like where this could go though. Battery is the ONE complaint I have about my otherwise sexy and powerful device!
Click to expand...
Click to collapse
But yeah, this may requires a good dev.
Thanks for launching the discussion!
dyndragon said:
Nah, I don't think so. With some clever programming and it watching maybe an average signal level over some period of time, I think it could do pretty well. The idea is to avoid HUGE battery drains over a moderate amount of time.
For example, if i'm at work in my office building, i get 0-1 bars of signal strength for 8 hours. It would be great if it detected after, say...10 minutes that my signal strength was in the crapper, and turned off the APN (or at least, account syncing) so I won't leave work 8 hours later with 5% battery life. But, if I wake my phone up, it will automatically turn the APN on so I can use data as I see fit.
But let's say I go out for lunch. The phone would either detect that I'm changing position/location via cell towers, or it would just regularly poll signal level and when it found that my signal level had increased by some delta amount over say...5 minutes, it would turn the APN back on.
I find that most of my frustration with this phone is with battery drain, and most of the drain comes from sitting in low signal areas for extended periods of time. If this could be accomplished (with configurable thresholds and stuff about time to average the signal over, etc) I think it would be an excellent addition to the customization-ability of android!
Click to expand...
Click to collapse
good points. you're probably right. i also sit at work all day at my desk, and i only get 1 bar of 3g signal. stupid building blocks reception.
Posted this in the Google Dev Group from Latedroid... Dont think he will work on it in the near future though, as a new JD version will come to the market very soon
Very nice idea actually. After some beta versions, could be really really useful.
The paid version of Juicedefender has an option that can disable the APN whenever the screen is off. I don't use it because it interferes with Pandora.
It also has a 1x1 widget for manually enabling/disabling the APN.
connery916 said:
The paid version of Juicedefender has an option that can disable the APN whenever the screen is off. I don't use it because it interferes with Pandora.
It also has a 1x1 widget for manually enabling/disabling the APN.
Click to expand...
Click to collapse
That's an entirely different thing, entirely.
I miss those movies.
I did have another idea, and its to remap the brightless on the N1. Most of us probably use 100% brightness, but I have a funny idea that somewhere between 85-90% brightness there is a sweetspot which pretty much looks identical, but uses a reasonable amount less power. Unfortunately without a multimeter, I am unable to test
dogiedogie said:
I did have another idea, and its to remap the brightless on the N1. Most of us probably use 100% brightness, but I have a funny idea that somewhere between 85-90% brightness there is a sweetspot which pretty much looks identical, but uses a reasonable amount less power. Unfortunately without a multimeter, I am unable to test
Click to expand...
Click to collapse
100% brightness? You're crazy. Must of us have it cranked way down.
dogiedogie said:
I did have another idea, and its to remap the brightless on the N1. Most of us probably use 100% brightness, but I have a funny idea that somewhere between 85-90% brightness there is a sweetspot which pretty much looks identical, but uses a reasonable amount less power. Unfortunately without a multimeter, I am unable to test
Click to expand...
Click to collapse
I find that if we can conserve power while in low signal areas, that is a much greater gain than even dimming the display...anyway, totally off topic!
Send some requests to Mark at latedroid if you want them to consider it! I think Juicedefender is closest to this feature set, really.
dyndragon said:
I find that if we can conserve power while in low signal areas, that is a much greater gain than even dimming the display...anyway, totally off topic!
Send some requests to Mark at latedroid if you want them to consider it! I think Juicedefender is closest to this feature set, really.
Click to expand...
Click to collapse
But wouldnt doing that just leave us with NO signal? We all know about the N1's 3g 'problems' to begin with.
Hook PhoneStateIntentReceiver with notifySignalStrength and pull phoneStateReceiver.getSignalStrength();
The development ain't hard to do. The rules are.
Aka on what threshold do you disable, do you enable once every X minutes anyway etc. Do you force keeping one state for X minutes to avoid enable/disable spam.
nurre said:
Hook PhoneStateIntentReceiver with notifySignalStrength and pull phoneStateReceiver.getSignalStrength();
The development ain't hard to do. The rules are.
Aka on what threshold do you disable, do you enable once every X minutes anyway etc. Do you force keeping one state for X minutes to avoid enable/disable spam.
Click to expand...
Click to collapse
Well being a developer on other platforms and having watched a lot of sessions from Google I/O 2010, I have a feeling that calling these APIs too frequent might actually drain more battery than this would conserve, but without a test I might be wrong, just sharing what I feel here, no flames, thank you
tazzix said:
Well being a developer on other platforms and having watched a lot of sessions from Google I/O 2010, I have a feeling that calling these APIs too frequent might actually drain more battery than this would conserve, but without a test I might be wrong, just sharing what I feel here, no flames, thank you
Click to expand...
Click to collapse
Another problem you'll face is even if you balance it perfectly for you, so your saving power, chances are at least half the users will see a DECREASE in battery because of the signal conditions they have in their area.
dyndragon said:
I find that if we can conserve power while in low signal areas, that is a much greater gain than even dimming the display...anyway, totally off topic!
Send some requests to Mark at latedroid if you want them to consider it! I think Juicedefender is closest to this feature set, really.
Click to expand...
Click to collapse
In my battery stats, display is always number one offender.
Automatic brightness is probably the way to go

[TESTING] Battery Drain Optimization on the Optimus V

Part 1
Intro:
I took my Optimus V and spliced in a multimeter between the battery and the phone. All it took was double sided tape and tinfoil. With the battery installed in the phone, the foil directs the positive terminal of the battery out of the phone, through a multimeter, and back into the phone through a second piece of foil that is separated from the first with double sided tape.
This enabled me to monitor the actual battery draw. I installed various roms and monitored the battery usage under certain conditions. I focused on the lower end of battery usage (airplane mode, stand by, under-clocking) because that is the focus of most smartphone users, getting the most battery life. I had a resolution of 1mA. So keep that in mind when looking at the results. A value of 2mA means the actual value might be 50% more or less.
Setup:
Each rom was a fresh flash. The only apps installed were google's. Airplane mode was toggled in order to remove the effects of the 50% Time Without Signal issue. The Rodimus rom had setCPU added to control CPU speeds. Besides changing the relevant settings, nothing in the system was touched. A steady 3G and CDMA signal was available during testing. A Wifi signal with WPA2 protection was used in the Wifi tests. A google account was also added to all the roms and background information was left enabled. Syncing was turned off. All of the values measured fluctuated somewhat during testing. Approximations had to be made as to the average stable values.
Roms Tested:
Stock
Rodimus 20/03/2011
Zefie's CM7 01/03/2011
aospCMod CM7 24/03/2011
Testing Conditions:
Powering on
Airplane Mode - Standby - Underclocked to 122MHz
Airplane Mode - Screen Brightness 0%/100%/50% *
Wifi - Standby - 122MHz
3G - Standby - 122MHz
No Data - Standby - 122MHz
Wifi - Standby - 600MHz
3G - Standby - 600MHz
Airplane Mode - Standby - 600MHz
Wifi - 600MHz**
3G - 600MHz**
Airplane Mode - 600MHz**
*CPU set to 600MHz
**Unless noted otherwise screen brightness was set to 25% and the phone was left on its homescreen.
***Because of a lack of CPU control, the stock rom could only be tested at 600MHz
Results:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
50% Results:
I also tested the 50% Time Without Signal issue using Rodimus. Airplane mode was not toggled after a fresh install. 50% issue was confirmed. Wifi was then setup and then put into standby mode for the measurement. Then Wifi was disabled and 3G automatically connected. The 50% issue was again confirmed to be in effect. The phone was then put in standby mode for the 3G measurement. Data was then disabled and put back into standby for the last measurement.
Wifi: 5mA
3G: 300-2mA****
No Data: 2mA
****When 3G was enabled and the phone put into standby, the current draw would fluctuate from 2mA to 300mA every few seconds. This was not seen in tests where airplane mode was toggled on and off after boot.
Conclusions:
At first glance there does not see to be much difference between the roms. Remember though that all of the 2mA values have an error of 50%. So there could be a 3 fold difference between some of those values. If I had a more sensitive multimeter, we could get better results.
One notable difference is between the roms when using Wifi on standby. The stock rom and Rodimus both draw significantly less power than the CM7 roms. This seems to be an unresolved bug with CM7. Also worth noting is that 3G draws significantly less power than Wifi regardless of Rom. Keep in mind that no data is being transferred while the tests are occurring besides whatever the background data uses.
It looks as though the 50% Time Without Signal issues does effect battery life when on 3G. The phone appears to be doing some activity every few seconds. Take note that I only tested it on Rodimus.
Using a current draw of 3mA, the 1500mAh battery could last as long as 500 hours. Of course, even in standby and underclocking, the current draw will randomly jump to 100mA every now and then on all of the roms. A more practical estimate at the battery life is 100 hours. That gives an overall average power draw of 15mA.
I was hoping underclocking would show a significant decrease in power use, but my resolution was not good enough to pick up a difference. I'm sure an advantage still exists, but I can't prove it with the equipment I have. The effects seem to be limited to less than 1mA. This is worthless when using the phone, but when in standby, the savings could be significant.
Hopefully these values will help you out as well as the developers. Let me know your thoughts. Note that all of these values are current draw directly from the battery. Another user on Howard forums tested the draw from the USB port which occurs at 5V and doesn't account for the loss due to stepping down the voltage.
Winners:
Leaving 3G on during standby - No clear winner among the roms because of testing equipment limitations but by far better than leaving your phone on Wifi
Airplane mode during standby - No clear winner again
Leaving Wifi on during standby - Rodimus
Not in standby but idle - Stock rom
Part 2
Setup:
To summarize my procedure, I splice equipment in between the battery and the phone so that I can monitor how much battery is being used at any given time. I install various roms and test how much the battery is drained using different features. This time around I used more sensitive equipment that gave a resolution of 0.01mA (100 times higher resolution than before!). My approach to the calculations was different this time too. Instead of just considering the current, I also recorded the voltage across the battery. In this way, I can calculate the instantaneous power draw.
Each rom was a fresh install. After the install, a Wifi network was added. Wifi sleep policy was set to never sleep. A google account was added. The rom was then restarted and airplane mode was toggled to remove the 50% TWS bug. No other settings were tampered with, including CPU speeds. Besides the typical tests from last time, I also included:
Downloading - Docs2Go using Wifi and 3G
Checking Email using Wifi and 3G
Calling Voicemail with 3G and Wifi turned off
Where (the app) Running
Where running in the background while on the Homescreen
Where running in the background while on Standby
Using all of the power drainage values, I created a formula for calculating the estimated battery life for the roms if set to 3G, Wifi, or a mix of both. The formula uses best guess values for the number of hours spent talking, surfing, running programs, and left in standby. The breakdown is as follows: 2 hours running programs, 1 hour surfing, 1 hour calling, and 20 hours on standby.
I also did an independent test to see the effects of underclocking. Using SetCPU on Rodimus, I forced different clock speeds and ran the Long Bench Test. I also looked at what happens when you go into Standby underclocked.
The roms I tested:
Aphrodite_1.3*
RodimusROM.v1.2.3
Zefie's CM7 03012011
aospCMod 03252011
aospCMod 04032011
*I forgot to run some of the tests on Aphrodite, but that didn't effect the final calculations.
Results:
(updated 4/6/2011)
This assumes: 2 hours running programs, 1 hour surfing, 1 hour calling, and 20 hours on standby for a given day.
This chart sums up all of the testing. The CM7 roms have a hug problem when it comes to Wifi power use in the idle state. When downloading files, all the roms use approximately the same amount of power. The average 3G power use when downloading is 1600mW which is almost twice as much as Wifi, 850mW. This is in contrast to the power use when in standby with no data transferring where 3G consumes the same amount of power as airplane mode and Wifi consumes at least twice as much with Rodimus and at most 34 times as much with the CM7 roms. Rodimus and Aphrodite have much better battery life on Wifi than the CM7 roms. This all depends on how much Wifi and 3G you actually use. The transfer speeds did not effect the power consumption. Checking email which occurred at 40 kbps consumed the same instantaneous power as downloading Docs2go at full speed. This was true for both Wifi and 3G. The "Mix" results assume you spend half of the 24 hours at home using Wifi (sleeping counts), and the other half using 3G. If you would like to experiment with the constants used to calculate the estimated battery life, download the attached xls file and manipulate only the values highlighted in green. The values highlighted in pink and chart 5 will change as a result.
Update 4/6/2011: The new asop rom seems to have improved the power consumption of the Wifi antenna drastically. There is still room for improvement compared to the stock rom, but I guess that is just a trade-off for the GB features. I have uploaded an updated xls file with the new results included.
The last test involved setting different CPU speeds and seeing how they effected standby power consumption and the power consumption during the Long Bench Test of SetCPU.
As you can see, under and over-clocking has zero effect when the CPU is idle.
This chart shows that the higher the CPU speed, the more power is consumed during the CPU intensive bench test, but this does not show the entire picture. Since the bench test is using a standard set of calculations, we can compare the time it takes to finish the test across the different CPU speeds. This value is conveniently given as the result of the bench test. Multiplying the steady power consumption to the time it took to finish the bench gives us the energy consumed to finish the bench. The clock speed with the least amount of energy use is therefor the most efficient speed (for this particular phone).
When we zoom in on the results at the high end of the CPU clock speeds, we see that the highest stable clock speed for this phone, 825 MHz, is not the most efficient. It is actually 806MHz that consumes the least amount of energy to complete the test. Even though 825 is faster, the increased power consumption counteracts its speed. It is also obvious that the slower clock speeds are way more inefficient for completing a CPU intensive task.
For some reason, 320MHz and 245MHz gave identical results. I think this is a kernel or hardware bug. I tested it repeatedly and got the same results.
Conclusion:
If you want to see what your battery life would be under various conditions, download the xls file and manipulate the values in green. The values in pink will change and will automatically be plotted in chart 5. Depending on your phone habits, you can pick the rom that suits you best. Remember that these are rough estimates. Your actual mileage might vary.
Turning off Wifi when the screen is off can save you battery life IF you have no backgrounds apps that send and receive data. If you do have those types of apps, Wifi is better than 3G to leave on (not including the current CM7 Wifi issue). If you are using 3G, there is no advantage to turning it off when the phone goes into standby unless you again have background apps that consume bandwidth. 3G consumes the same amount of power as airplane mode if there is no data transferring! My suggestion is to eliminate those types of apps if you don't need them and leave 3G on. That will save you the most amount of battery out of all the mods you can do.
If you are going to use SetCPU, overclocking will save you battery life. Underclocking will actually cost you. I would recommend leaving the upper limit one notch lower than what is considered stable for your phone. The lower limit does not matter all that much. I now have my lower limit set at the same value as the upper limit. When idle, both high and low clock speeds consume the same power. When the CPU is needed, the higher clock speed is more efficient (to a point). I would advise against the "conservative" scaling that gradually changes your clock speed to task if you still decide to underclock. This will only slow you down and consume more battery power. You also don't need a separate profile for when your phone is on standby. Lower clock speeds can only worsen your battery life.
Lastly, underclocking is not the same as undervolting. Undervolting would probably decrease battery consumption, but it is not implemented in any rom/kernel for the Optimus V...yet.
Part 3
Fixing power drain with a firewall!
Most of you probably don't believe the conclusion that 3G consumes the same power as airplane mode when idle. You've set Tasker or Juicedefender to turn off your 3G when the screen is off and have seen great battery savings. I know why...
Your installed programs are using your 3G even when the screen is off. It makes sense that you want to turn off your 3G to stop them and get better battery life, but you are punishing the wrong culprit. You may want some of your apps to occasionally update when the screen is off. You may want to use Sipdroid and get incoming calls. You may want your emails to be occasionally updated, but you don't want Google maps to constantly update the CIA to your precise location every minute. If you want to control exactly which programs have access to 3G/Wifi...
...here is what you should do:
You will need root access to do this. This will setup two script files, one to run when the screen turns off and one to run when the screen turns on. These will "enable" and "disable" the firewall. The firewall is never actually disabled. You are merely changing the rules that apply, either to give access to a limited number of apps or to allow all apps through. Because of the requirement that the scripts be executed with root access, there are actually five script files required. Two are created using Droidwall and are unique to your phone. Three scripts are attached in the zip below and are universal.
Install Root Explorer or a similar app. You can also use adb.exe, but it is up to you to figure out the correct commands.
Install Droidwall .
Figure out which apps you want to grant internet access to when your screen is off. If none, then select none.
Set the rules in Droidwall and enable the firewall.
Using Root Explorer to navigate to this folder: /data/data/com.googlecode.droidwall/app_bin/
Copy the file droidwall.sh and place it on your microSD card.
Rename it to droidwall-on.sh
Open Droidwall again, uncheck all the apps you had selected, and instead check the boxes for "(any application)". This will be the profile that is applied when you actually want to use your phone and the screen is on.
You can choose to limit access here as well, but it is safer to choose "(any application)" for now. You can come back later and recreate a more restrictive profile once you have everything working.
Apply the rules and then turn the firewall off and then back on again.
It is important that the firewall is still enabled.
Navigate back to the folder: /data/data/com.googlecode.droidwall/app_bin/
Copy the new droidwall.sh and place it on your microSD card.
Rename it to droidwall-off.sh
These two script files will "enable" and "disable" the firewall.
Use Gscript to test the scripts to make sure they work. Run droidwall-on.sh, and test an app you didn't give 3G or Wifi access to. It should be blocked from accessing the internet. Now run droidwall-off.sh. That same app should now have internet access. If this test does not work, go back and repeat the steps above. This is also the point where you check that all your critical apps function correctly with either script activated. You must make sure the scripts work as intended before proceeding. If you don't know how to add/run scripts using Gscript, learn.
While you can run these scripts as root in Gscript, running them as root when the screen turns off/on is a bit harder. The following steps have to all be done in order for the scripts to be executed correctly.
Install Tasker
Install SL4A. (more info)
Run SL4A once so that it creates the following folders on your microSD card or create them yourself: /sdcard/sl4a/scripts/
Copy droidwall-off.sh and droidwall-on.sh into the "scripts" folder.
Copy screen-off.sh and screen-on.sh from the zip file attached to this post to the "scripts" folder.
Copy "sush" from the attached zip file to the folder "/system/bin/" and set the permissions to "rwxr-xr-x".
Code:
adb remount
adb push sush /system/bin/
adb shell chmod 755 /system/bin/sush
Read here about why we need this file to run the scripts as root.
Open Tasker -> New -> Ok -> Event -> Display -> Display On -> Done -> New Task -> Ok -> + -> Misc -> Run Script
Where it says "Name" select the search button. You should see the four scripts we placed in the "/sdcard/sl4a/scripts/" folder. If not, retrace your steps to see what you did wrong. Select "screen-on.sh". Don't select the Droidwall scripts because they can't run as root as they are written.
Done -> Done
Repeat the steps to add a profile for when the screen turns off and "screen-off.sh". When you have both profiles, select Apply at the bottom.
Now when your screen is off only the programs you selected will be allowed to use your 3G or Wifi.
You no longer need to run Droidwall, but you can use it to update your droidwall-on.sh script. Don't uninstall Droidwall. If anything goes wrong and you lose all of your internet access, try deleting the scripts in the "/sdcard/sl4a/scripts/" folder, and then allowing all apps to have internet access using Droidwall.
You can actually setup any number of profiles to control your firewall using location, time of day, ...etc. To do so, create the correct ".sh" file using Droidwall. Place it inside the "/sdcard/sl4a/scripts/" folder. Then add a secondary script to run your ".sh" as root. Use "screen-on.sh" as a template to create your secondary script. Then create the proper profile inside Tasker to run the secondary script. If what I just said confuses you, don't attempt to do this. You can really mess up your phone if this is done incorrectly!
Warning 1: You are running scripts as root. This can cause all sorts of problems if the scripts are written poorly or if someone/something malicious changes your scripts. Do not try to alter the scripts unless you know what you are doing. I take no responsibility if you ruin your phone. You have been warned.
Warning 2: You can't use a droidwall-on.sh script that has been created on another phone. You must create it yourself because your apps have their own unique app number assigned to them. If you ever update a program that you gave access to, you must recreate your droidwall-on.sh file using the steps mentioned above. If you do not, your app will be blocked.
To have optimal battery life, use Wifi when the screen is on and internet usage is high, and use 3G for when the screen is off and your internet usage is mostly idle. This can be accomplished by setting the Wifi sleep policy to turn Wifi off when the screen turns off. This might be the reason it is the default setting on ALL Android phones. If you want to receive calls using sipdroid or any other voip app, create a Tasker profile that disables Wifi if you are on 3G and have an incoming voip call. And then create a second Tasker profile that re-enables Wifi when your voip call is finished. Otherwise, your incoming voip call that rings over 3G will be disconnected when you answer your phone, the screen turns on, and your phone switches to Wifi. This you can figure out how to do on your own.
I hope this helps some of you. You have a smartphone and a data plan for a reason. Use them.
Optimizing Your Battery Life Part 4
Part 4
You may be familiar with my previous threads testing the battery life of the Optimus V:
http://forum.androidcentral.com/optimus-v/71693-optimizing-battery-drain-optimus-v.html
http://forum.androidcentral.com/opt...attery-drain-optimization-tests-part-2-a.html
http://forum.androidcentral.com/opt...es-block-apps-using-3g-wifi-save-battery.html
I had originally planned to do a 4th round of testing pitting rom vs rom, kernel vs kernel, dev vs dev, in a no holds barred match of DEATH! That wasn't going to be that hard because when I started testing this phone, there were only two custom kernels to pick from and four roms. Then some inconsiderate jerks decided to develop a bunch of kernels and roms for the Optimus V. Now we have our choice of five kernels and 15 Roms! I would have to test over 50 kernel/rom combination to cover all of the possible ones. Combine that with the fact that these kernels and roms are changing on a daily basis, and it makes my previous testing techniques impractical. I even tried to collect user data to aide in my tests, but roms where being produced faster than people were reporting their data.
So for this round of testing, I took a different approach. I decided to test the capabilities of the hardware instead of focusing on any one piece of software. Instead of getting into the details of my tests, I am going to jump to the conclusions.
Kernel Effects on Battery Life
Before I changed my testing technique, I began running tests on the five kernels that were out. I installed a rom, configured it for "optimal" battery life while still running various practical apps like sipdroid and gmail, and then ran tests on how it behaved with different kernels. My results ended up being really boring. Aside from one of the kernels that I will not name, they all performed equally well. Even the "bad" kernel has since been fixed. Then I realized what I had done. By applying my optimizations, I had equalized the playing field.
You see, you can break a kernel down into its various parts, the most important being the hardware drivers. And while you may think those would be crucial for better battery life, they are actually fairly optimized from the factory. Even though all of the kernels were compiled differently and included slightly different drivers, and the devs may add modifications to them to make them more stable or have new features, the truth is that the hardware is going to consume a minimum amount of power no matter what you do. You can probably make the drivers less efficient, but that is probably the only way you'll have the effect the battery life directly. As long as all your hardware sensors and buttons work, the kernel i doing its job.
So now lets focus on the other parts of the kernel. There is the slash screen that can be included. This doesn't really effect anything, and it too can be "optimized" and disabled by the user without changing kernels. Lastly, there are the various startup settings and scripts that are run at every boot. And while this is a necessary evil to ensure stability since the kernel loads before the rom, it is here where kernels can go wrong, wifi scan rate to be too short, setting your CPU clock speed improperly, ...etc. But whatever the kernel sets, can be un-set by the rom or yourself, and this where I nuterlized the effect of having a different kernel.
So how critical is the kernel to battery life? Not very critical at all if you are willing to configure your rom to compensate for your kernel's shortcomings.
Then how critical is the rom to battery life? Again, if you are willing to uninstall battery hungry apps, and configure your phone, the rom because just a skin.
What does effect battery life? You do, you silly goose. Turning on the screen to check for messages, having your phone auto check for emails, auto downloading angry bird updates from the Market, this is what ruins your battery life. Anything the rom and kernel do can be changed. You, on the other hand, are who you are.
Optimus V Maximum Standby Battery Life
How long can the Optimus V be left on standby? I installed a stripped down version of Aphrodite (yeah, it is possible to remove even more things). I ran my optimizations which include increasing the memory read speeds and overclocking the CPU to 806.
Side note: Some may argue that I should have put the phone on airplane mode because even though I'm not making calls, the phone checks-in with nearby phone towers. Well here is a shocker I discovered by looking at the battery draw when in airplane mode, the phone still uses its radio to (I'm guessing) check-in with nearby towers. Airplane mode has the same periodic burst of current as when not in airplane mode. That can only be explained by the phone using its radio. Just a note for all the kidnappers that are reading this, no matter what you do, if your phone is on, it will check-in with nearby towers, and you can be tracked that way. I'm sure this is for 911 purposes, but for my tests, it means that airplane mode doesn't help me.
So with the phone stripped of apps, Wifi and 3G off, and everything else optimized for efficiency, we have a standby battery life of:
110 hrs plus or minus 5 hours
I never actually went the full amount of time because this is my primary phone and my stupid/inconsiderate friends and family would insist on calling me. Get a life, losers!
The closest I got was 80 hours, but using the remaining battery to calculate the total, I averaged 110 hrs. Pretty amazing considering that my first MP3 player was the size of an alarm clock and it would play songs for 2 hours at most.
Practical Standby Time
Same setup as before, except that I left 3G or Wifi on. I also used a firewall to block all internet traffic, and I left the default rom apps installed. In this state, the phone was completely usable as a web browser, GPS device, phone...etc the whole time during the test. All you had to do was lower the firewall and you were good to go.
Standby time on 3G:
95 hours plus or minus 5 hours
Standby time on Wifi:
85 hours plus or minus 5 hours
Again, these are estimated projections, but they were fairly consistent during the testing.
Real World Use
Here I used my phone with the setup I personally use. I left all the apps the way I have them. Everything was stock mmarz. I made no calls. I left Gtalk logged in as well as a popular GV VOIP app and the actual GV app. I also had my firewall setup to block all internet traffic except: VOIP, Gtalk, GV.
I actually managed to get through the entire test and my phone, after being on a mix of 3G and Wifi, shutoff at:
74 hours!
How to Get the Most Out of Your Phone
What does this all mean? Well, for starters, this smartphone has a pretty good battery life. I think these numbers could even be improved upon, not by a new kernel or rom, but by manually configuring the settings differently from what I used. So far, I have not found the magic formula that gives you the best battery life. What I did find is that the solution does not lie with the kernel or the rom. Throughout the testing I switched the rom that I was using. That did not effect the averages one bit!
Go ahead and pick the prettiest rom you want with the features you are looking for. Then pick a compatible bug free kernel. Once you do that, only install apps that you really need. Avoid apps that have location based features as those will wake up your phone and check the GPS location on a regular basis. Also avoid apps that have advertising (just buy the pay version you cheapskate). That is wasted bandwidth and therefore wasted battery life on advertising, and who knows how often the app will update itself in the background. Finally, when you have your phone setup and configured the way you enjoy, forget everything that I wrote here. You bought the darn thing. Use it the way that you want! If you are already getting +2 days of battery life, you probably won't do any better unless you are willing to turn your phone off. If you have less than 1 day of use on a single charge, you are either a heavy user of your phone, or you have something configured incorrectly. Don't blame your rom or kernel though. In the end of day, everything can be fixed by you.
this should be in general forum. All roms are out of date as well. This has nothing to do with android development. Just one users observations.
dburg84 said:
this should be in general forum. All roms are out of date as well. This has nothing to do with android development. Just one users observations.
Click to expand...
Click to collapse
I'm doing these tests for the benefit of the developers as well as the end users. Part 4 is going to cover how to modify each rom to get the most out of them and compare how they perform head to head. I'm also planning on testing the performance of the different kernels I just posted. Only one of the roms is out of date and that is because the update was just released. Rest assured that I plan on testing the updated version. (new results posted in Part 2)
mmarz said:
I'm doing these tests for the benefit of the developers as well as the end users. Part 4 is going to cover how to modify each rom to get the most out of them and compare how they perform head to head. I'm also planning on testing the performance of the different kernels I just posted. Only one of the roms is out of date and that is because the update was just released. Rest assured that I plan on testing the updated version. (new results posted in Part 2)
Click to expand...
Click to collapse
I'm not raggin on ya. I appreciate the efforts. Can tell you really put time into this.
Nice work here. I think all android user should read this. Keep it up man. I too am on the eternal quest to keep our battery draw to a minimum. Quick question, how does your multi-meter tests compare to "Battery Monitor Widget" app's battery draw results? Are they comparable?
I had read your thread last week because I had the Optimus and already lost it over the weekend.
I bought a cheap T-Mobile Comet and spent all of 10 minutes trying such tests at work with the Fluke 87-III. The range was only from .6uA Airplane mode 0% brightness to 2.6uA downloading over 3G.
I wonder if mine are right now. :O
Your thread (maybe it was elsewhere?) did make me realize this "50% Time Without Service" issue that I did not know of before and that airplane mode toggle after boot-up alone made the battery last so much longer on the Optimus without using any JuiceDefenders and such. It actually no longer died before returning home from work.
Thanks very much for the information. If only I still had this phone.
ungaze said:
Nice work here. I think all android user should read this. Keep it up man. I too am on the eternal quest to keep our battery draw to a minimum. Quick question, how does your multi-meter tests compare to "Battery Monitor Widget" app's battery draw results? Are they comparable?
Click to expand...
Click to collapse
I looked into using an app at first, but all of the android apps estimate your battery usage based on the percentage reported by the OS. Even if they show a mA rating, it is estimated from the percentage reported by the OS. This isn't a very accurate way of doing it. With the multimeter, you are measuring the current as directly as possible.
mmarz said:
I looked into using an app at first, but all of the android apps estimate your battery usage based on the percentage reported by the OS. Even if they show a mA rating, it is estimated from the percentage reported by the OS. This isn't a very accurate way of doing it. With the multimeter, you are measuring the current as directly as possible.
Click to expand...
Click to collapse
I totally agree, but for those without a multimeter(including me), using an app is the closest thing we could do to measure current draw form our devices. I was hoping on a comparison maybe on how much discrepancy we get with testing using an app compared to an actual tester.
But I won't argue on your point.
Waiting for your next tip, I'm not using 3g that much so I hope you have more for saving battery on wifi.
Awesome
Great post.
Appreciate the effort and admire the method.
Thanks.
Part 4 finally added! Thanks for all the support! Enjoy!
As usual, nice insights.
with almost same configurations, my phone also can last(approximately) up to 4days in standby. Roughly an hour per hour drain(also checking the status almost every hour).
ungaze said:
As usual, nice insights.
with almost same configurations, my phone also can last(approximately) up to 4days in standby. Roughly an hour per hour drain(also checking the status almost every hour).
Click to expand...
Click to collapse
I was hoping to get 100 hours too since I lose 1% an hour, but it turns out that the battery gauge isn't 100% correct no matter what you do to calibrate it. I'll just have to live with 72 hours.
BTW, if you are looking for an extreme mod, I think this would work on your phone too: http://forum.xda-developers.com/showthread.php?t=1072047
Really informative! Thanks for taking the time to do this.
I am no programmer. BUT, I know a damn good, well thought out, unbiased post when I find one(too far and few between). Great job! Thank you
GPRS test
Could you (re)do the tests on the first page also with 2G?
I use mainly 2G, and when I want more speed I switch to 3G. Almost never WiFi (except for mobile hotspot, but that's a totally different thing). My intuition says the GPRS only uses much less power when idling than 3g (especially in areas where 3g coverage is not so good).
Could be very useful.
wow , nice observations dude
spaic said:
Could you (re)do the tests on the first page also with 2G?
I use mainly 2G, and when I want more speed I switch to 3G. Almost never WiFi (except for mobile hotspot, but that's a totally different thing). My intuition says the GPRS only uses much less power when idling than 3g (especially in areas where 3g coverage is not so good).
Could be very useful.
Click to expand...
Click to collapse
I did a little testing of that on the side when I was running the original tests. There was no difference in power draw between the two, BUT! there could still be a real world difference.
When I tested them, they both had a strong signal available to them, but in reality you are much more likely to get a 2G signal than a 3G if you are not in a major city. In which case, a strong 2G signal will result in less effort on the part of your phone to do its business when compared to a weak (probably distant) 3G signal. When idling, if a 3G signal cannot be had, your phone will constantly look for one, but if your phone has settled to stay on 2G, then it will stay idling most of the time because it will have no problem finding a 2G tower. So while the hardware will use up the same amount of power on 2G and 3G, the availability of 2G COULD result in battery savings.
If you are in a major city with great 3G coverage and download speeds, then you'll waste battery by staying on 2G and taking longer to download the same content than you would on 3G.
As you can see, YMMV, but the tests show them as the same.

[Q] Wifi on 100% of the time or only when unlocked?

Dismissing things like sync and widget updates, etc., which option do you think ultimately saves more battery life? On the one hand you have wifi constantly locked on even if the phone is in deep sleep for hours. On the other hand, if you find that you use the phone quite a bit in spurts, wouldn't it seem that the wifi constantly turning on and connecting, then turning off during sleep, would actually use more power than just being constantly connected?
It might be a bad analogy but I liken it to when you turn a car off and then on as it uses more fuel compared to just letting it idle for a few minutes instead. Would this be the same with power consumption on our phone?
I've seen many articles that indicate Wi-Fi is much better on battery life then using 3g. So I've been running my like that for awhile. Not sure about the results though. Wi-Fi is now my second biggest battery drain, behind Display.
Mine is set to stay ON always. I get better battery life when using wifi.Some say the opposite, try both ways and see which works best for you.
Sent from my SAMSUNG-SGH-I777 using XDA App
I have the policy set to sleep when off. Even when I do use my phone regularly, I find that at times its going to help you save more battery life without having wifi constantly scanning for access points.
Red5 said:
I have the policy set to sleep when off. Even when I do use my phone regularly, I find that at times its going to help you save more battery life without having wifi constantly scanning for access points.
Click to expand...
Click to collapse
Just up the scan interval.
Standby drain of our wifi chip is VERY low, less than 1/10 that of the original GalaxyS series if power_profile.xml is correct - and it's FAR more power efficient to transfer data over wifi than cell radio on our phones for a variety of reasons.

'keep wifi on when screen times out'?

what are others thoughts on some of the pros and cons of this update? i'm thinking it will actually save battery to have wifi 'always on' in standby mode rather than repeatedly switching between a on/off state which uses more energy.
It will definitely eat more battery if it's always on under the lockscreen...
Also there is an option to deactivate notifications when new wifi hotspots are around.. if you are about battery life you should deactivate this..
Ikkari said:
It will definitely eat more battery if it's always on under the lockscreen...
Also there is an option to deactivate notifications when new wifi hotspots are around.. if you are about battery life you should deactivate this..
Click to expand...
Click to collapse
I keep my Wifi always on because it consumes the least battery (vs 3G, LTE, etc).
If I don't play games on my Lumia 920 the battery can last 3 days.
This update is freezing my phone Dunno why but I have tested it. I occasionally get a freeze now and then, but when the keep wifi is on, it is like every couple of hrs... Will test it more though.
Ikkari said:
It will definitely eat more battery if it's always on under the lockscreen...
Also there is an option to deactivate notifications when new wifi hotspots are around.. if you are about battery life you should deactivate this..
Click to expand...
Click to collapse
Wrong unless your phone is using 5-year old wifi chip.
Correct me if I am wrong, but is the wifi on this phone an on demand type system? From what I see on mine, the wifi unless being used for an actual update or downloading other content goes to sleep when the lock screen is on. It then wakes up if there is an update pushed to it or if something else needs it or of course if you unlock the phone. At least that is the way it appears that mine works.
Also your radio service are going to use much more power than the wifi will as they are higher power transmitters and receivers. There is a reason wifi only works within a few hundred feet and radio works for several miles that is due to the power difference. Of course with more power you get more battery consumption.
In the case of conserving the battery you are better off to use wifi when possible, leave it on and let the phone control it.
In my experience keeping Wifi on permanently lead to a remarkable decrease in battery life. That will depend on where you are though. If I have it sitting at home where it has Wifi connectivity it's likely that I would see better battery life because all actual transfers will happen via Wifi. At work though it can't connect to the Wifi network (private phone, work network) and so I have 3G running anyway while the phone keeps looking for Wifi networks to connect to.
The problem boils down to the fact that while you can switch off Wifi completely because everything can still work using 3G you can't switch off the phone part completely because only data is done over Wifi but you still need the mobile connection to receive calls/SMS.
I would suggest to anyone to simply try out what works better for them. For me it worked best to let Wifi deactivate automatically as it had been the default in WP since WP7 came out.
foxbat121 said:
Wrong unless your phone is using 5-year old wifi chip.
Click to expand...
Click to collapse
Maybe Wifi is using less power when you are downloading something and need a lot of data... But when your phone is idle... Constant on Wifi is using far more battery power than 3G that checks for email or weather every 1-2 hours...
Simple enough...if you are consistently in an area with a WiFi signal, leave WiFi "always on"...it will consume less battery. If you're in an area without WiFi signal then turn it off, as searching for a signal will help run your battery down.
Sent from my LG-E970 using Tapatalk 2
Ikkari said:
Maybe Wifi is using less power when you are downloading something and need a lot of data... But when your phone is idle... Constant on Wifi is using far more battery power than 3G that checks for email or weather every 1-2 hours...
Click to expand...
Click to collapse
Again, simply not true unless you are using a 5-year old phone. Even if you are in an area that has no wifi connection, the extra drain caused by searching for Wi-Fi networks is minimum in a modern OS and modern chipset. I have left all my android phones (the ones that offer Wi-Fi always on feature for a few years now) wifi on all the time. Never have felt much difference vs if I turn wifi off. It annoys me that WP didn't offer this capability for so long.
foxbat121 said:
Again, simply not true unless you are using a 5-year old phone. Even if you are in an area that has no wifi connection, the extra drain caused by searching for Wi-Fi networks is minimum in a modern OS and modern chipset. I have left all my android phones (the ones that offer Wi-Fi always on feature for a few years now) wifi on all the time. Never have felt much difference vs if I turn wifi off. It annoys me that WP didn't offer this capability for so long.
Click to expand...
Click to collapse
I tested a lot of phones Android and WP, my experience is that wifi always on is a battery killer... And I'm talking about state of the art hardware... It's just my 2 cent's but i keep it off...
When I don't charge overnight and wifi is always on my battery drops about 40%
with only 3G on about 8-10%
Foxbat: you can leave it any way you want to do it. I'm not saying Microsoft should remove the feature. But in my experience keeping Wifi on kills the battery faster. I tested it for my use case with always on and with Auto and in the end: Auto it was for me.
The best advice you can give to people is: try it out yourself and you will see what works best for you.
A picture or two says it all. See the attached files for my two testing: one with wifi always on for 24-hour and one with Wi-Fi in auto mode for 24-hour:
The right picture shows 0.0%/hour under current discharge rate... pretty impressive
Ikkari said:
The right picture shows 0.0%/hour under current discharge rate... pretty impressive
Click to expand...
Click to collapse
The keyword is 'Current' -- means at that moment. You can derive the same thing from the left in various sections. The key here is that I don't see any discernible difference. Certainly not a battery killer in any sense as you claimed.
If you look at the first 12-hour period of both chart (when the phone is mostly sleep and not used), the result is almost identical. FYI, there are three push emails connected all the time: Hotmail, GMail and Corporate Exchange Email.
Yes the keyword 'Current' -- means at that moment... so your phone is not discharging although your screen is on... Very accurate app...
Ikkari said:
Yes the keyword 'Current' -- means at that moment... so your phone is not discharging although your screen is on... Very accurate app...
Click to expand...
Click to collapse
So, what you saying is that if you have the screen on, you will see your battery percentage drop immediately? You should return your phone if that is the case.
Battery app get its information from the phone OS reporting. If the OS reported the same battery percentage over a short period of time, the discharge rate won't be anything other than zero. That's limitation of the platform, not app.
Instead of criticize the app which is not the point of the post, why don't you post your findings where leave Wi-Fi always on kills your battery?
it' % per hour... and your phone is using currently using 0,0% per hour so if you leave it like that it will run for ever... so where is the mistake?
Ikkari said:
it' % per hour... and your phone is using currently using 0,0% per hour so if you leave it like that it will run for ever... so where is the mistake?
Click to expand...
Click to collapse
% per hour is a unit of measurement. It doesn't mean you have to take one hour to measure it in order to claim its rate. That will be average rate on that hour, not current rate which is meant to see what your current usage pattern is. It can't be used to predict your battery life. If you notice that when you take your phone off the charger, it will stay on 100% for quite some time before it starts to drop. Does that mean your phone battery can last forever? Think about it before post these ridiculous statements.
Foxbat - you are trying to tell us how our devices should behave while we are telling you how they actually behave in the real world out there. You can repeat your 5 years story as often as you want to but it clearly doesn't live up to the factual reality we experience every day and I guess after trying it out with different ROMs on the 920 and leaving all other settings the same I know the effect it had pretty well.
Nice to know though that you are having a different experience with different devices.

Categories

Resources