Revert "Try to reland Ib3ee007bc"

This reverts commit b6415618f1.

Reason for revert: Caused regression of b/149213586

Bug: 148639826
Bug: 149213586

Change-Id: I5248e03b42e3f24a6e2abb134d0bf339e77f484b
This commit is contained in:
Darryl Johnson
2020-04-24 23:31:30 +00:00
parent b6415618f1
commit 87f93a5585
3 changed files with 13 additions and 68 deletions

View File

@@ -236,7 +236,7 @@ public class Presentation extends Dialog {
// to be rare but surprising, so we'll write a log message about it.
if (!isConfigurationStillValid()) {
Log.i(TAG, "Presentation is being dismissed because the "
+ "display metrics have changed since it was created while onStart.");
+ "display metrics have changed since it was created.");
mHandler.sendEmptyMessage(MSG_CANCEL);
}
}
@@ -296,8 +296,8 @@ public class Presentation extends Dialog {
// is invalid and the application must recreate the presentation to get
// a new context.
if (!isConfigurationStillValid()) {
Log.i(TAG, "Presentation is being dismissed because the display metrics have changed "
+ "since it was created while handleDisplayChanged.");
Log.i(TAG, "Presentation is being dismissed because the "
+ "display metrics have changed since it was created.");
cancel();
}
}

View File

@@ -1111,6 +1111,7 @@ public class ResourcesManager {
}
int displayId = key.mDisplayId;
final boolean hasOverrideConfiguration = key.hasOverrideConfiguration();
tmpConfig.setTo(config);
// 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
@@ -1120,15 +1121,17 @@ public class ResourcesManager {
daj = new DisplayAdjustments(daj);
daj.setCompatibilityInfo(compat);
}
tmpConfig.setTo(config);
if (displayId == Display.DEFAULT_DISPLAY) {
daj.setConfiguration(config);
}
DisplayMetrics dm = getDisplayMetrics(displayId, daj);
if (displayId != Display.DEFAULT_DISPLAY) {
applyNonDefaultDisplayMetricsToConfiguration(dm, tmpConfig);
}
if (hasOverrideConfiguration) {
tmpConfig.updateFrom(key.mOverrideConfiguration);
}
// Only apply for default display
if (displayId == Display.DEFAULT_DISPLAY) {
daj.setConfiguration(tmpConfig);
}
DisplayMetrics dm = getDisplayMetrics(displayId, daj);
resourcesImpl.updateConfiguration(tmpConfig, dm, compat);
}