Merge "Fix WindowContextTests" into rvc-dev am: 5c984b9a09 am: a903d2fab4 am: 993020db5c

Change-Id: I2841dc7dec0914b295e8e6bdf75727bd4be92922
This commit is contained in:
Charles Chen
2020-04-14 18:55:51 +00:00
committed by Automerger Merge Worker
2 changed files with 8 additions and 7 deletions

View File

@@ -67,13 +67,11 @@ public class WindowTokenClient extends IWindowToken.Stub {
}
final int currentDisplayId = context.getDisplayId();
final boolean displayChanged = newDisplayId != currentDisplayId;
final Configuration config = new Configuration(context.getResources()
.getConfiguration());
final boolean configChanged = config.isOtherSeqNewer(newConfig)
&& config.updateFrom(newConfig) != 0;
final Configuration config = context.getResources().getConfiguration();
final boolean configChanged = config.diff(newConfig) != 0;
if (displayChanged || configChanged) {
// TODO(ag/9789103): update resource manager logic to track non-activity tokens
mResourcesManager.updateResourcesForActivity(this, config, newDisplayId,
mResourcesManager.updateResourcesForActivity(this, newConfig, newDisplayId,
displayChanged);
}
if (displayChanged) {

View File

@@ -422,14 +422,17 @@ class WindowToken extends WindowContainer<WindowState> {
if (!shouldReportToClient()) {
return;
}
if (mLastReportedConfig == null) {
mLastReportedConfig = new Configuration();
}
final Configuration config = getConfiguration();
final int displayId = getDisplayContent().getDisplayId();
if (config.equals(mLastReportedConfig) && displayId == mLastReportedDisplay) {
if (config.diff(mLastReportedConfig) == 0 && displayId == mLastReportedDisplay) {
// No changes since last reported time.
return;
}
mLastReportedConfig = config;
mLastReportedConfig.setTo(config);
mLastReportedDisplay = displayId;
IWindowToken windowTokenClient = IWindowToken.Stub.asInterface(token);