[Nexus S 4G Android Development] shabbypenguin:
Shabbypenguin and the Android Creative Syndicate

present to you

Battery Tweak RC1​

This is really a tool for power users

If you don't consider yourself 'comfortable' with messing with your phone, then don't.

This is mostly the work of collin_ph, all the ideas are mostly his and I have only contributed in part to getting some things functioning correctly and some optimizations for the NS4G.

What does it do?

This tweak creates a service that periodically checks the phone's power source.

If the power source changes, it reconfigures the device for maximum performace, battery and safety.

Tweaks memory settings for current power source

Re-clocks CPU based upon battery remaining or current power source

Reclocks for maximum performance if on AC power

Reclocks for maximum performance and charging safety if on USB

Reclocks for performance and battery if on Battery

As Battery life is diminished, Maximum CPU frequency is lowered

Tweaks scaling charactaristics depending on power sourcee

CPU Scales up less frequently on battery power

CPU Scales up more frequently on USB/AC power

The CPU is allowed to scale dynamically in all charging states based upon CPU usage

Includes a batt-cfg utility to configure the system

You may load 1 of 3 pre built profiles

Manually configure CPU Frequencies in all charging states

Determine the percentage of underclocking as the battery drains

Configure how often to poll the power state / battery statys

Disable batt.sh service from running at startup

Includes a batt-rm.sh uninstall utility

Includes a batt-diag diagnostic utility

Includes optional Disk performance tweaks (enabled by default)

Includes overheating controls to lower your cpu if the phone starts to overheat

The Tools

The entire 'application' is written in shell code and was first written just to give a performance and battery boost, but since has evolved more and more.

All the tools mentioned will be utilized either through the terminal, or in adb shell.

batt.sh

This is the core of the entire script. Don't mess with it.

The one thing you should do after installing the script:

Code:
pidof batt.sh

If theres any number showing up after it, then it's working fine.

batt-cfg

This is the 'main menu' of sorts, as it gives the user all the options and allows them to toggle tweaks/mods on the fly.

batt-diag

It's a diagnostics utility, allowing you or someone knowledgeable to figure out any issues that you may be having with your device and be able to pinpoint exactly where the problem is.

batt-diag -v gives a more thorough output as you can see here; http://pastie.org/1162034

batt-rm.sh

It's a battery tweak removal script, follow the onscreen prompts and it should remove just about any trace of the battery tweak script.

The Presets

The presets are just default configurations that I have set up that can make your phone more efficient without you, the user, having to manually set everything.

The preset of 800 literally means that 800000 is the scaling_max_freq, or the max frequency, that your phone can achieve after you enable it.

Just typing 1, and then enter, you'll be ready and set to go. Same with 2 or 3.

Customize Settings

This is only for the experienced user, and it allows you to manipulate most/ifnotall the configurables on your device.

Note, you do not need to configure anything to enable this battery mod. Default settings will be assigned at 800MHz.

All the settings explain what each option does, so read them carefully.

Disk Boost

Remounts via noatime and nodiratime. Look up what that means on your own, and why it benefits performance the way it does.

Prerequisites needed to run this

netarchy's kernel

Matr1x kernel

seems to work with every rom

If you're running any other kind of kernel, feel free to try it but i cannot guarantee that it will work.

This script will WORK even if you don't have the import call at boot, but it won't survive on the next reboot. AKA if you dont have this rom kernel, when the phone boots it may not start batt.sh if you are willing please check and let me know if the rom/kernel supports it.

You can check via:

Code:
pidof batt.sh

NOTE: This script will also prompt you to try to run itself as root if you use it in terminal.

Contributors:

Collin_ph

Decad3nce

myn

onicrom

shabbypenguin

nullghost (aka tehdarkknight)

nubecoder - so he might not cry any moar

Download

*make sure to ignore some of the finer things on the screens they came from the epic version which im working on :P*

*make sure you are running these as root*

*disable setcpu while running this*