Previously we were updating the last reported Configuration whenever
it was reported to WM. However, the original intention of last
reported Configuration was reporting from AM side to the
ActivityRecord, not AM to WM. Updating this value in the latter case
leads to scenarios where we may update the Configuration too soon,
compromising any logic relying on comparing against the truly last
reported value.
This changelist removes call points other than messaging from the AM
side which change this value. It also consolidates all changes to the
method ActivityRecord#setLastReportedConfiguration to better track
where the value is being set.
Change-Id: I958daf6cd2f2163637f8b7e567a0f3e2be540b7d
Fixes:
63813517
Test: go/wm-smoke
Test: cts/hostsidetests/services/activityandwindowmanager/util/run-test CtsServicesHostTestCases android.server.cts.ActivityManagerAppConfigurationTests
// the user leaves that mode.
mLastReportedMultiWindowMode = !task.mFullscreen;
mLastReportedPictureInPictureMode = (task.getStackId() == PINNED_STACK_ID);
// the user leaves that mode.
mLastReportedMultiWindowMode = !task.mFullscreen;
mLastReportedPictureInPictureMode = (task.getStackId() == PINNED_STACK_ID);
-
- onOverrideConfigurationSent();
}
void removeWindowContainer() {
}
void removeWindowContainer() {
* a new merged configuration is sent to the client for this activity.
*/
void setLastReportedConfiguration(@NonNull MergedConfiguration config) {
* a new merged configuration is sent to the client for this activity.
*/
void setLastReportedConfiguration(@NonNull MergedConfiguration config) {
- mLastReportedConfiguration.setTo(config);
+ setLastReportedConfiguration(config.getGlobalConfiguration(),
+ config.getOverrideConfiguration());
- /** Call when override config was sent to the Window Manager to update internal records. */
- // TODO(b/36505427): Why do we set last reported based on sending the config to WM? Seems like
- // we should only set this when we actually report to the activity which is what the method
- // setLastReportedMergedOverrideConfiguration() does. Investigate if this is really needed.
- void onOverrideConfigurationSent() {
- mLastReportedConfiguration.setOverrideConfiguration(getMergedOverrideConfiguration());
+ void setLastReportedConfiguration(Configuration global, Configuration override) {
+ mLastReportedConfiguration.setConfiguration(global, override);
return;
}
mWindowContainerController.onOverrideConfigurationChanged(newConfig, mBounds);
return;
}
mWindowContainerController.onOverrideConfigurationChanged(newConfig, mBounds);
- // TODO(b/36505427): Can we consolidate the call points of onOverrideConfigurationSent()
- // to just use this method instead?
- onOverrideConfigurationSent();
}
// TODO(b/36505427): Consider moving this method and similar ones to ConfigurationContainer.
}
// TODO(b/36505427): Consider moving this method and similar ones to ConfigurationContainer.
// Update last reported values.
final Configuration newMergedOverrideConfig = getMergedOverrideConfiguration();
// Update last reported values.
final Configuration newMergedOverrideConfig = getMergedOverrideConfiguration();
- mLastReportedConfiguration.setConfiguration(service.getGlobalConfiguration(),
- newMergedOverrideConfig);
+
+ setLastReportedConfiguration(service.getGlobalConfiguration(), newMergedOverrideConfig);
if (changes == 0 && !forceNewConfig) {
if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION,
if (changes == 0 && !forceNewConfig) {
if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION,
// created controller for the activity we are starting yet.
mWindowContainerController.positionChildAt(appController, index);
}
// created controller for the activity we are starting yet.
mWindowContainerController.positionChildAt(appController, index);
}
- r.onOverrideConfigurationSent();
// Make sure the list of display UID whitelists is updated
// now that this record is in a new task.
// Make sure the list of display UID whitelists is updated
// now that this record is in a new task.