How does a mobile phone understand how much the battery is charged?
This is usually done depending on the voltage drop of the battery. But lithium ion battery using mobile phones. In the case of lithium, this method does not work.
Fuel gauge is used so there are several algorithms for Li-ion chemistry and the gauge can use one or more of them.
One of the most common is the Columb Counter. Fuel gauge has a current shunt with amplifier that measures current used, adds it over time, and compares with programmed battery capacity.
Columbus Counter is Impedance Tracking. Fuel gauge measures the impedance of the battery. Different values of this impedance are found on the stage of lithium battery. Those values are calculated using algorithms and shown in percentages.
Generally, a fuel gauge has its own temperature sensor or other sensors. It is used to give various temperature reports.
And from this fuel gauge information goes to the operating system of the mobile. Then you can see the different status of the operating system according to different conditions. Such as: low battery, fully charged, overheated etc. Other times, the operating system will turn off some services according to battery status.