[EVO 4G Android Development] myn:
Background

As many of you recently saw in my Warm TwoPointTwo RLS2 thread there was an optional download for Collin_ph's battery tweak ported to the EVO by me.

This mod was so large I figured It deserved it's own thread and at the same time I'd like to share it with the community so other ROM devs can incorporate this into their ROMs

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 EVO and INCredible. The original thread from Collin_ph can be found here and the original documentation can be found here.

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 compcache (if enabled) for current power source

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 2 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 an LED fix if your LED is stuck on

Includes optional experimental performance tweaks (disabled by default)

Includes optional Disk performance tweaks (enabled by default)

Includes optional froyo Audio quality fix (disables stagefright)

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:

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 998 literally means that 998400 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.

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.

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.

Audio 'Fix'

Disables stagefright for bettery audio quality, though it will hinder your benchmark scores only because it affects the AAC codec and how it behaves.

CFS Tweak

Currently not functional. Will evolve in time. What it will eventually do is Echo NO_NEW_FAIR_SLEEPERS to sched_features to change CFS into more of a traditional scheduler like BFS, which gives a noticeable benchmark performance boost, but hinders how gps behaves(kind of like the real BFS).

Prerequisites needed to run this

If you're running a version of CM6 or Warm TwoPointTwo RLS2 and above, this will work completely fine.

If you're running any other kind of rom, that developer will need to add an 'import' call in the init.rc(in the ramdisk) that imports the init.d script necessary for this application to function at boot. If you don't know how to do this, please see post #2.

This script will WORK even if you don't have the import call at boot, but it won't survive on the next reboot.

You can check via:

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

Download And Install:

Version 3 RC2 Download Herehttp://www.mediafire.com/?xmjdd797f6v2m90

A new guide is available: [GUIDE]* How to properly flash collin_ph battery tweak & have best battery life ever! *

Disable SetCPU or other overclocking programs as they will interfere with this tweak.

Kernels that manage and throttle CPU (ex HAVS) may interfere with the operation of this mod as they will fight and conflict with CPU deltas.

Download, the zip, copy to SD card.

Reboot into recovery and flash.

Reboot and run the batt-cfg configuration utility.