Update DisplayMetrics even on default display

am: 4309721843

Change-Id: Ib79935f0b80df42db789d94e0a88ac7a0b0b40d5
This commit is contained in:
Adam Lesinski
2016-10-14 22:34:06 +00:00
committed by android-build-merger
2 changed files with 16 additions and 12 deletions

View File

@@ -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);
}

View File

@@ -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;