Fix max bounds doesn't get updated on dual TDA build
Previously ConfigurationContainer only respects provideMaxBounds in #setBounds, which leads to set bounds from WindowTransaction doesn't work because it invokes onRequestedOverrideConfiguration. This CL move the logic to override max bounds to onRequestedOverrideConfiguration. It also modifies DC#onRequestedOverrideConfiguration a bit because ConfigurationContainer changes requestedOverrideConfiguration on-the-fly. Test: atest ConfigurationContainerTests#testOnRequestedOverrideConfigurationChangedOverrideMaxBounds Test: atest WindowMetricsTests on Dual TDA test build fixes: 173770528 Change-Id: Ibc0a98d21291bc3f04d2d4ba981b8a5dc3ab5312
This commit is contained in:
@@ -182,6 +182,11 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> {
|
|||||||
// writing to proto (which has significant cost if we write a lot of empty configurations).
|
// writing to proto (which has significant cost if we write a lot of empty configurations).
|
||||||
mHasOverrideConfiguration = !Configuration.EMPTY.equals(overrideConfiguration);
|
mHasOverrideConfiguration = !Configuration.EMPTY.equals(overrideConfiguration);
|
||||||
mRequestedOverrideConfiguration.setTo(overrideConfiguration);
|
mRequestedOverrideConfiguration.setTo(overrideConfiguration);
|
||||||
|
final Rect newBounds = mRequestedOverrideConfiguration.windowConfiguration.getBounds();
|
||||||
|
if (mHasOverrideConfiguration && providesMaxBounds()
|
||||||
|
&& diffRequestedOverrideMaxBounds(newBounds) != BOUNDS_CHANGE_NONE) {
|
||||||
|
mRequestedOverrideConfiguration.windowConfiguration.setMaxBounds(newBounds);
|
||||||
|
}
|
||||||
// Update full configuration of this container and all its children.
|
// Update full configuration of this container and all its children.
|
||||||
final ConfigurationContainer parent = getParent();
|
final ConfigurationContainer parent = getParent();
|
||||||
onConfigurationChanged(parent != null ? parent.getConfiguration() : Configuration.EMPTY);
|
onConfigurationChanged(parent != null ? parent.getConfiguration() : Configuration.EMPTY);
|
||||||
@@ -341,9 +346,6 @@ public abstract class ConfigurationContainer<E extends ConfigurationContainer> {
|
|||||||
|
|
||||||
mRequestsTmpConfig.setTo(getRequestedOverrideConfiguration());
|
mRequestsTmpConfig.setTo(getRequestedOverrideConfiguration());
|
||||||
mRequestsTmpConfig.windowConfiguration.setBounds(bounds);
|
mRequestsTmpConfig.windowConfiguration.setBounds(bounds);
|
||||||
if (overrideMaxBounds) {
|
|
||||||
mRequestsTmpConfig.windowConfiguration.setMaxBounds(bounds);
|
|
||||||
}
|
|
||||||
onRequestedOverrideConfigurationChanged(mRequestsTmpConfig);
|
onRequestedOverrideConfigurationChanged(mRequestsTmpConfig);
|
||||||
|
|
||||||
return boundsChange;
|
return boundsChange;
|
||||||
|
|||||||
@@ -5188,7 +5188,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
|||||||
mCurrentOverrideConfigurationChanges = currOverrideConfig.diff(overrideConfiguration);
|
mCurrentOverrideConfigurationChanges = currOverrideConfig.diff(overrideConfiguration);
|
||||||
super.onRequestedOverrideConfigurationChanged(overrideConfiguration);
|
super.onRequestedOverrideConfigurationChanged(overrideConfiguration);
|
||||||
mCurrentOverrideConfigurationChanges = 0;
|
mCurrentOverrideConfigurationChanges = 0;
|
||||||
mWmService.setNewDisplayOverrideConfiguration(overrideConfiguration, this);
|
mWmService.setNewDisplayOverrideConfiguration(currOverrideConfig, this);
|
||||||
mAtmService.addWindowLayoutReasons(
|
mAtmService.addWindowLayoutReasons(
|
||||||
ActivityTaskManagerService.LAYOUT_REASON_CONFIG_CHANGED);
|
ActivityTaskManagerService.LAYOUT_REASON_CONFIG_CHANGED);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -366,6 +366,30 @@ public class ConfigurationContainerTests {
|
|||||||
assertTrue(child.getConfiguration().windowConfiguration.getMaxBounds().isEmpty());
|
assertTrue(child.getConfiguration().windowConfiguration.getMaxBounds().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testOnRequestedOverrideConfigurationChangedOverrideMaxBounds() {
|
||||||
|
final TestConfigurationContainer root =
|
||||||
|
new TestConfigurationContainer(true /* providesMaxBounds */);
|
||||||
|
final Rect bounds = new Rect(0, 0, 10, 10);
|
||||||
|
final TestConfigurationContainer child = new TestConfigurationContainer();
|
||||||
|
root.addChild(child);
|
||||||
|
final Configuration configuration = new Configuration();
|
||||||
|
configuration.windowConfiguration.setBounds(bounds);
|
||||||
|
|
||||||
|
root.onRequestedOverrideConfigurationChanged(configuration);
|
||||||
|
|
||||||
|
assertEquals(bounds, root.getBounds());
|
||||||
|
assertEquals(bounds, root.getConfiguration().windowConfiguration.getBounds());
|
||||||
|
assertEquals(bounds, child.getBounds());
|
||||||
|
assertEquals(bounds, child.getConfiguration().windowConfiguration.getBounds());
|
||||||
|
|
||||||
|
assertEquals(bounds, root.getMaxBounds());
|
||||||
|
assertEquals(bounds, root.getConfiguration().windowConfiguration.getMaxBounds());
|
||||||
|
assertEquals(bounds, child.getMaxBounds());
|
||||||
|
assertEquals(bounds, child.getConfiguration().windowConfiguration.getMaxBounds());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains minimal implementation of {@link ConfigurationContainer}'s abstract behavior needed
|
* Contains minimal implementation of {@link ConfigurationContainer}'s abstract behavior needed
|
||||||
* for testing.
|
* for testing.
|
||||||
|
|||||||
Reference in New Issue
Block a user