Mobile.getDeviceWidth and Mobile.getDeviceHeight() returns wrong value for Pixel 4, Pixel 4XL and Samsung Galaxy S20FE

I am trying to get the device width using the commands Mobile.getDeviceWidth() and Mobile.getDeviceHeight. I am using Pixel 4, Pixel 4XL simulator from android studio and Samsung Galaxy S20FE real device. But I can see that on all these devices the value returned by the commands Mobile.getDeviceWidth() and Mobile.getDeviceHeight is smaller than the actual size of the device. I am using appium 1.19.1 and katalon 7.8.1. My issue seems similar to this one. But mine is related to height than width. Please let me know if anyone has a solution for this.

Thank you,

Hi I have found this to be the case as well, however it is correct if you factor in the size of the touch bar at the bottom of the screen.