diff --git a/core/java/android/app/ResourcesManager.java b/core/java/android/app/ResourcesManager.java index d2e032721022b..8adec03df8cf6 100644 --- a/core/java/android/app/ResourcesManager.java +++ b/core/java/android/app/ResourcesManager.java @@ -839,19 +839,19 @@ public class ResourcesManager { tmpConfig = new Configuration(); } tmpConfig.setTo(config); - if (!isDefaultDisplay) { - // Get new DisplayMetrics based on the DisplayAdjustments given - // to the ResourcesImpl. Udate a copy if the CompatibilityInfo - // changed, because the ResourcesImpl object will handle the - // update internally. - DisplayAdjustments daj = r.getDisplayAdjustments(); - if (compat != null) { - daj = new DisplayAdjustments(daj); - daj.setCompatibilityInfo(compat); - } - dm = getDisplayMetrics(displayId, daj); - applyNonDefaultDisplayMetricsToConfiguration(dm, tmpConfig); + + // Get new DisplayMetrics based on the DisplayAdjustments given + // to the ResourcesImpl. Update a copy if the CompatibilityInfo + // changed, because the ResourcesImpl object will handle the + // update internally. + DisplayAdjustments daj = r.getDisplayAdjustments(); + if (compat != null) { + daj = new DisplayAdjustments(daj); + daj.setCompatibilityInfo(compat); } + dm = getDisplayMetrics(displayId, daj); + applyNonDefaultDisplayMetricsToConfiguration(dm, tmpConfig); + if (hasOverrideConfiguration) { tmpConfig.updateFrom(key.mOverrideConfiguration); } diff --git a/core/java/android/util/DisplayMetrics.java b/core/java/android/util/DisplayMetrics.java index f4db4d6611eaf..b7099b642e98a 100644 --- a/core/java/android/util/DisplayMetrics.java +++ b/core/java/android/util/DisplayMetrics.java @@ -268,6 +268,10 @@ public class DisplayMetrics { } public void setTo(DisplayMetrics o) { + if (this == o) { + return; + } + widthPixels = o.widthPixels; heightPixels = o.heightPixels; density = o.density;