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.