Set fit insets type for decor insets test
Otherwise because since the key of InsetsState#mSources is based on hashcode (InsetsSource.createId), the order to iterate mSources may be indeterministic for the same insets type. Then WindowLayout#computeFrames may compute different results according to the hashcode, that causes the test to be flaky. By setting fit insets type to 0, the insets won't affect each other. Fix: 284435531 Test: DisplayPolicyTests#testUpdateDisplayConfigurationByDecor Change-Id: I30ea22c051f84264a03d0b698d50d83c62059869
This commit is contained in:
@@ -362,10 +362,12 @@ public class DisplayPolicyTests extends WindowTestsBase {
|
||||
new InsetsFrameProvider(bar2, 0, WindowInsets.Type.statusBars())
|
||||
.setInsetsSize(Insets.of(0, STATUS_BAR_HEIGHT, 0, 0))
|
||||
};
|
||||
bar2.mAttrs.setFitInsetsTypes(0);
|
||||
bar2.mAttrs.paramsForRotation = new WindowManager.LayoutParams[4];
|
||||
final int doubleHeightFor90 = STATUS_BAR_HEIGHT * 2;
|
||||
for (int i = ROTATION_0; i <= Surface.ROTATION_270; i++) {
|
||||
final WindowManager.LayoutParams params = new WindowManager.LayoutParams();
|
||||
params.setFitInsetsTypes(0);
|
||||
if (i == Surface.ROTATION_90) {
|
||||
params.providedInsets = new InsetsFrameProvider[] {
|
||||
new InsetsFrameProvider(bar2, 0, WindowInsets.Type.statusBars())
|
||||
|
||||
@@ -485,6 +485,7 @@ class WindowTestsBase extends SystemServiceTestsBase {
|
||||
new InsetsFrameProvider(owner, 0, WindowInsets.Type.statusBars())
|
||||
.setInsetsSize(Insets.of(0, STATUS_BAR_HEIGHT, 0, 0))
|
||||
};
|
||||
statusBar.mAttrs.setFitInsetsTypes(0);
|
||||
dc.getDisplayPolicy().addWindowLw(statusBar, statusBar.mAttrs);
|
||||
return statusBar;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user