how does battery calibration work? There are several posts on how to calibrate android batteries but none describe its working.
How is it that the system can determine at what voltage the battery is considered to be charged (100% or say 4200mV) and what voltage is considered to be discharged (0% or 3400mV)?

"Android stops the battery from charging when reaching 100%" but if it is calibrated wrong, how come it wont stop charging at another voltage (say 4100mV) or even continue discharging at a voltage below its normal operation (say 3200mV)?

Expected answer:


The actual technical insight on how android determines the current battery level


Edit 1: I am stressing that my question has nothing to do with battery statistics and how much battery apps have used but solely on the procedure involved with determining the battery %

This is my first question please excuse any conventions I may have missed
Looking through the android source code recently (I'm new to android building and am still getting used to what makes android tick), I came across a file somewhere that had all sorts of calibration statistics and figures.

All of the figures are set by the vendor of the device itself. From how many mAhs the battery holds, to what values different device features affect the battery (like WiFi scanning, screen brightness etc).

I would assume that it is these figures (from the vendor), that the kernel uses to help itself calculate battery level.

Also, batteries come with little chips in them these days, to provide overcharge protection etc. The chip quite possibly reports on it's health status to the device. But that is merely just a personal assumption based on the fact that I don't use a stock battery (I use a zero lemon in my i9300 which triples my life between charges), and my phone knows the difference (it doesn't drop the same percentage in a given time compared to stock).

I hope this helps!!