Calculate the height and width (in centimetres or inches) of the mobile phone/ tablet screen

Since the navigation bar always has 48dp, the calculation is very simple.

Pixel 2XL: