Fix density issues when maxUiWidth is set
Currently the code assumes that display size and density are forced if and only if the mBase* values are different from the mInitial* values. This is incorrect because base size and density may not be forced but a result of applying the maxUiWidth property. Assuming the restricted density is forced makes updateBaseDisplayMetricsIfNeeded() always pick it instead of "newDensity". As result of that if we have maxUiWidth=1920 each time we set a 4k mode the density will double as a result of the calculations in updateBaseDisplayMetrics(). The same problem occurs with `adb shell wm size 3840x2160`, because setForcedSize() assumes mBaseDensity should be used. Instead this change picks a density which preserves the ratio density/width constant. Test: manually tested the abovementioned scenarios Bug: 156100799 Change-Id: I8bda1b9883307fe94fed50be4a874b153e743a8f
Loading
Please register or sign in to comment