[Nexus One General] RogerPodacter:
i finally found out why our phones are not charging up to the full capacity, and why this so called "bump charging" works. searching AOSP git site code, i found the following:

static int battery_adjust_charge_state(struct ds2784_device_info *di)
361 {
362 unsigned long flags;
363 unsigned source;
364 int rc = 0;
365 int temp, volt;
366 u8 charge_mode;
367
368 spin_lock_irqsave(&charge_state_lock, flags);
369
370 temp = di->status.temp_C;
371 volt = di->status.voltage_uV / 1000;
372
373 source = di->status.charge_source;
374
375 /* initially our charge mode matches our source:
376 * NONE:OFF, USB:SLOW, AC:FAST
377 */
378 charge_mode = source;
379
380 /* shut off charger when full:
381 * - CHGTF flag is set
382 * - battery drawing less than 80mA
383 * - battery at 100% capacity
384 */
385 if ((di->status.status_reg & 0x80) &&
386 (di->status.current_uA <= 80000) &&
387 (di->status.percentage == 100)) {
388 di->status.battery_full = 1;
389 charge_mode = CHARGE_OFF;
390 } else {
391 /* We don't move from full to not-full until
392 * we drop below 99%, to avoid confusing the
393 * user while we're maintaining a full charge
394 * (slowly draining to 99 and charging back
395 * to 100)
396 */
397 if (di->status.percentage < 99)
398 di->status.battery_full = 0;
399 }

the OS is stopping the charge when the battery pulls in less than 80 mA. this line specifically is exactly our problem:

(di->status.current_uA <= 80000) &&

as we know, the battery has its own charging circuit hard coded into it, which is why we can charge with our phones turned off and not blow up our battery. obviously we know that when we charge with the phone off, or "bump charge" it, we get up around 1420 mAh or so. this is because the OS, specifically that code above, is not limiting the charging sequence. and instead the battery is allowing itself to fully be charged properly. we need to change this value to either something lower, like

(di->status.current_uA <= 20000) &&

or hell we could even set it to zero and let the battery's circuit dictate when its full.

(di->status.current_uA <= 00000) &&

it would be safer to set it to 10 mAh or 20 mAh, but really it shouldnt matter, because what would happen is that condition would be satisfied when there is zero current being pulled by the battery, and we'd have our "bump charge" without having to turn off the phone.

this also makes complete sense why very rarely once in a while we are able to get up to 1400 mAh with the phone still turned on. because let's say you really used your phone hard for an extended period of time (i happen to a lot), which would really pull down the voltage more than normal relative to the drained mAh in that same time period. so when you go to charge back up, the voltage is low enough relative to current so as to not trip that 80 mA requirement until much later in the charge cycle, which just HAPPEN to allow for the mAh to get up high enough and the battery's hard coded circuit kicked in.

so the file in question is ds2784_battery.c. if anyone knows how to build from source i would try this out. i wonder if its possible to create an flashable zip file and just push this change somehow.