diff options
| author | 2016-10-14 22:41:35 +0000 | |
|---|---|---|
| committer | 2016-10-14 22:41:35 +0000 | |
| commit | d7ec1ea69724db5d06f907cf53adb771977ce95a (patch) | |
| tree | 1ff3388f5ad85ee22c68bb2214f466a5b576d847 | |
| parent | f9dc6498d9fb553f023fd4fe7ba951a9b4833110 (diff) | |
| parent | dab7950d801f77a369aef44169c1a4a6298dbdb5 (diff) | |
Update DisplayMetrics even on default display am: 4309721843
am: dab7950d80
Change-Id: I8bb2c9c303380abd3e1a54af68b8a8f7da3225f7
| -rw-r--r-- | core/java/android/app/ResourcesManager.java | 24 | ||||
| -rw-r--r-- | core/java/android/util/DisplayMetrics.java | 4 |
2 files changed, 16 insertions, 12 deletions
diff --git a/core/java/android/app/ResourcesManager.java b/core/java/android/app/ResourcesManager.java index d2e032721022..8adec03df8cf 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 f4db4d6611ea..b7099b642e98 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; |