What is the technically right thing: the function of a battery cell in a battery in a phone is to maintain certain voltage or provide certain current?
In general, batteries rely on chemical reaction to provide power. The chemical reactions generate a potential difference (voltage) between the terminals and this voltage depends on the battery chemistry.
Table 1. Nominal voltages for various battery chemistries.




Chemistry
Nominal (V)




NiCd
1.2


Lead-acid
2.1


NiMh
1.2


Lithium ion
3.6





I am not sure whether one of the functions should be to provide voltage or provide variable current?

Batteries are considered as voltage sources with some internal resistance. The internal resistance causes the terminal voltage to drop with increasing current drawn.

This question arises because I think that primarily the battery cell creates a voltage across its ends and the current is a by product of its connection to a load and so the function of the battery cell should be to provide voltage and not the current but I am not sure.

Your thinking is correct.

Is it then the battery management system or something like that, that modulates the voltage or current to suit the laptop’s needs such as when high power is required for gaming?

In general the load draws whatever current it requires from the voltage source. In a phone a single Li-ion cell will provide 3.6 to 3.7 V and this is adequate. In a laptop there will be an integer number of cells (obviously) and Li-ion is most common so battery voltages of, for example, 5 × 3.6 = 18 V are common. Meanwhile the electronics may be working on 5 V or 3.3 V so the laptop's internal power supply (external to the battery) will step the battery voltage down to the required voltages.


Also, how is it ensured that the battery voltage does not drop below minimum required by the device since many phones or laptops are capable of doing heavy activities like gaming at 100% and at 5% charge.

Some battery chemistries are damaged by over-discharge. Li-ion is one of them. For that reason a battery management system (BMS) is built in to shut off supply when voltage drops to critical level. The BMS may also control the battery charge. (Your mobile phone or laptop &quot;charger&quot; is actually just a constant voltage power supply. The charge controller is built into the phone or laptop.)
The state of charge is a tricky calculation done by the BMS. As you say, it's not like reading the liquid level in a petrol tank because of the &quot;constant&quot; voltage nature of the cell. The BMS will count charge in and out of the cell while monitoring the cell voltage. I imagine that a good algorithm would recalibrate the state of charge (SoC) when it sees the voltage approach the critical level. This would then compensate for loss of capacity due to age of the cell.
Voltage or current?
Most of the world is run on &quot;constant voltage&quot;. This makes switching loads very easy. All the devices in your home are wired in parallel on the mains supply. Devices with different power requirements can be plugged in or switched on and the current required by the device is drawn from the constant voltage supply. It's the same in a 12 V vehicle system. Computers can be more complex because different sub-systems may require different voltages. In that case converters are used to step the primary supply voltages to those required and each of those is treated as a constant voltage source.