Skip to content

Commit 7ac8bbd

Browse files
author
Dianne Hackborn
committed
Fix issue #7585876: When changing the font settings, the movie...
...just keeps attempting to load and doesn't play on the TV Change-Id: Ifcdc969a037a113224632f907d55f60a168dd05a
1 parent 860d0cd commit 7ac8bbd

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

core/java/android/app/Presentation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ private void handleDisplayChanged() {
281281
private boolean isConfigurationStillValid() {
282282
DisplayMetrics dm = new DisplayMetrics();
283283
mDisplay.getMetrics(dm);
284-
return dm.equals(getResources().getDisplayMetrics());
284+
return dm.equalsPhysical(getResources().getDisplayMetrics());
285285
}
286286

287287
private static Context createPresentationContext(

core/java/android/util/DisplayMetrics.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,19 +232,32 @@ public boolean equals(Object o) {
232232
* @return True if the display metrics are equal.
233233
*/
234234
public boolean equals(DisplayMetrics other) {
235+
return equalsPhysical(other)
236+
&& scaledDensity == other.scaledDensity
237+
&& noncompatScaledDensity == other.noncompatScaledDensity;
238+
}
239+
240+
/**
241+
* Returns true if the physical aspects of the two display metrics
242+
* are equal. This ignores the scaled density, which is a logical
243+
* attribute based on the current desired font size.
244+
*
245+
* @param other The display metrics with which to compare.
246+
* @return True if the display metrics are equal.
247+
* @hide
248+
*/
249+
public boolean equalsPhysical(DisplayMetrics other) {
235250
return other != null
236251
&& widthPixels == other.widthPixels
237252
&& heightPixels == other.heightPixels
238253
&& density == other.density
239254
&& densityDpi == other.densityDpi
240-
&& scaledDensity == other.scaledDensity
241255
&& xdpi == other.xdpi
242256
&& ydpi == other.ydpi
243257
&& noncompatWidthPixels == other.noncompatWidthPixels
244258
&& noncompatHeightPixels == other.noncompatHeightPixels
245259
&& noncompatDensity == other.noncompatDensity
246260
&& noncompatDensityDpi == other.noncompatDensityDpi
247-
&& noncompatScaledDensity == other.noncompatScaledDensity
248261
&& noncompatXdpi == other.noncompatXdpi
249262
&& noncompatYdpi == other.noncompatYdpi;
250263
}

0 commit comments

Comments
 (0)