Skip to content
Commit 5c29e640 authored by Marin Shalamanov's avatar Marin Shalamanov
Browse files

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
parent 8a18aaaf
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment