I need to use the DPI of my device to calculate how many pixels are in an actual physical inch for some tests which I am writing that need to always have a line drawn that is 1 inch in length.
I’m using the driver.getDisplayDensity() of the Android Driver to retrieve this information from my device under test, however it appears to be incorrect. For example, I am using a Samsung Galaxy Tab S6 as my main DUT. The specs on this device (and the math) say that this device has a pixel density of about 287 ppi. But, when I call driver.getDisplayDensity() against this device, the number that is returned to me is 360 which is drastically different. I don’t want to hardcode any values here because I need to be able to run these tests across a wide range of devices.
Am I doing something wrong here or not understanding what the getDisplayDensity() method is actually giving me back? Any help would be greatly appreciated.