Battery charging time calculation One of the very useful feature of Android version 5.0 Lollipop is that it shows how much time is left for the charging to be completed. How is the time for the device to get fully charged determined?
As per the training document Monitoring the Battery Level and Charging State Determine the Current Battery Level section describes a method, which I presume is implemented in OS and measured periodically (most likely at every 1% change of battery 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;



Once you know the current level and the time taken to reach that level, I presume time for full charge is stored in ROM (not sure how and where) it is only a matter of extrapolating


Note: This is an educated guess and would welcome inputs