Skip to content

Commit

Permalink
fix metrics density comparisons
Browse files Browse the repository at this point in the history
In Resources.java, we explicitly call setDensity() on the local
DisplayMetircs object when there is a configuration update - which
sets some more fields than the original implementation.

In fw/b/core/java/android/app/Presentation.java there is a DisplayInfo
comparison which fails because our getMetricsWithSize() did not always
set those fields that updateConfiguration would always set.

So now we always return a DisplayMetrics object with the fields filled
out as expected.

Ref: OPO-539

Change-Id: Ie80e7a9cfd249ec59d31b4044ad09e07e34d1194
Signed-off-by: Roman Birg <[email protected]>
  • Loading branch information
romanbb authored and dankoman30 committed May 20, 2016
1 parent 4a7d7a8 commit 6a4dca1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/java/android/view/DisplayInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,8 @@ private void getMetricsWithSize(DisplayMetrics outMetrics, CompatibilityInfo com
} else if (type == Display.TYPE_BUILT_IN
&& (flags & Display.FLAG_PRESENTATION) == 0) {
outMetrics.setDensity(DisplayMetrics.DENSITY_PREFERRED);
} else {
outMetrics.setDensity(logicalDensityDpi);
}
}

Expand Down

0 comments on commit 6a4dca1

Please sign in to comment.