I have created a function to calculate diagonal screen size based on the resolution and pixel density. viz-
def find_display_size(d):
width=float(720);
height=float(1280);
dens=float(294);
wi=float(width)/(dens);
hi=float(height)/(dens);
x = math.pow(wi,2);
y = math.pow(hi,2);
screenInches = math.sqrt(x+y);
diagScreenSizeRoundedoff = round(screenInches)
logger.info("screenInches "+str(screenInches),also_console=True)
logger.info("diagScreenSizeRoundedoff"+str(diagScreenSizeRoundedoff),also_console=True)
I want to fetch the information (resolution & pixel density) using adb shell. When I am trying this command-
$adb shell wm density
Result-
Physical density: 320
The result I am getting is the physical density of a device(=320), however the pixel density of the particular device is (~294). Curious to know what exactly is the difference between these two, also how I can find the pixel density using adb commands which is ~294 in this case.
PS- The device I am working on is- MOTO XT1068