How does the Android estimate the battery level without a current sensor? The BatteryManager class doesn't have the metric for current: http://developer.android.com/reference/android/os/BatteryManager.html

And then I have found this post: https://stackoverflow.com/questions/2439619/getting-the-battery-current-values-for-the-android-phone  It seems that the author also found it was not possible to get current value from the Linux entry.

I also downloaded the widget called CurrentWidget into my Nexus 7. For the current value, it shows "no data".

So probably a current sensor is required to get the current value and some android systems just do not have such sensors. Then how can the android system know the current battery level? Maybe it will just use the voltage of the battery to infer that(voltage will decrease during the discharge)? But then it would be very coarse-grained. Someone says that there is some 'trick' used to estimate the battery level without current values in Android(probably based on Voltage?). Is there any reference?

PS: for some reason, I know current value can be recorded on iphone 3GS
Battery level estimation is usually performed by a special “fuel gauge” chip; different phone models use different chips. E.g., Samsung GT-I8150 (Galaxy W), according to the kernel config, uses the Maxim MAX17043 chip, which, according to its datasheet, does not have any inputs to measure the current — it has only a battery voltage sensor. According to the manufacturer's description, this chip uses “a sophisticated Li+ battery-modeling scheme, called ModelGauge™ to track the battery’s relative state-of-charge (SOC) continuously over a widely varying charge/discharge profile”. Some information is available in the datasheet, but details of this “ModelGauge” scheme do not seem to be publicly available.

BTW, the driver used for Samsung Galaxy W seems to apply some corrections to the charge level returned by the MAX17043 chip, so probably the estimation performed by the chip is not ideal.

Other fuel gauge chips (e.g., MAX17047) measure both voltage and current, and sometimes also the battery temperature. Such chips can probably provide a more precise estimation of the battery charge level. Again, the datasheet does not provide all details of the used method.

However, even if the fuel gauge chip used in a particular phone can measure the current, accessing that information from Android might be impossible for several reasons:


The chip might just use the current measurement internally and not expose it to the outside. This is not the case with MAX17047 — it has registers holding current measurement values, which can be read over the I2C bus.
The kernel driver for the fuel gauge chip might not have code to expose the current measurement information to user applications.
Even if the kernel driver makes the current measurement information available (e.g., through some sysfs file), Android does not have a standard API for such sensors — neither BatteryManager nor Sensor have anything appropriate for an electrical current sensor. Therefore the CurrentWidget app that you have found may work only on some models for which the developer has information about accessing this nonstandard sensor.