How does the Android OS estimate remaining battery time? Is it known how the Android OS estimates time to failure / remaining battery charge?
I am doing a school project about battery estimation on mobile devices but have not been able to find any information about which techniques are used in the industry.

Several people have written articles about how time to failure can be estimated on an Android device, but I have not been able to locate any official information about how it is actual done.

The optimal answer I would like is a link to a scientific article or tech-spec that describe it.
In the API it is described that the battery percentage is calculated by dividing the current level with the maximum level.
This can be seen in the quote below.
This leads me to believe that BatteryManager.EXTRA_LEVEL is either measured in Milli amps Hour (mAh) or a value between 0-100. This is a simple approach and not the answer that I hoped to find but it is an answer never the less. Now I just need a official source that states the answer. :)

Determine the Current Battery Level
In some cases it's also useful to
determine the current battery level. You may choose to reduce the rate
of your background updates if the battery charge is below a certain
level.
You can find the current battery charge by extracting the current
battery level and scale from the battery status intent as shown here:
int level = batteryStatus.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
int scale = batteryStatus.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
float batteryPct = level / (float)scale;