Do not unregister CONSTRAIN_DISPLAY_APIS for WmTests
Because it uses a static member to decide whether to register. If there are multiple tests depend on it, the tests after the first one will fail because the listener was removed in tearDown. Bug: 219640050 Test: atest SizeCompatTests Change-Id: Icd2e1e4edd3c986b0c714b97a2a4f50d78242fa0
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.server.wm;
|
||||
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
|
||||
import static android.provider.DeviceConfig.NAMESPACE_CONSTRAIN_DISPLAY_APIS;
|
||||
import static android.testing.DexmakerShareClassLoaderRule.runWithDexmakerShareClassLoader;
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
|
||||
@@ -190,7 +191,11 @@ public class SystemServicesTestRule implements TestRule {
|
||||
private void setUpSystemCore() {
|
||||
doReturn(mock(Watchdog.class)).when(Watchdog::getInstance);
|
||||
doAnswer(invocation -> {
|
||||
mDeviceConfigListeners.add(invocation.getArgument(2));
|
||||
// Exclude CONSTRAIN_DISPLAY_APIS because ActivityRecord#sConstrainDisplayApisConfig
|
||||
// only registers once and it doesn't reference to outside.
|
||||
if (!NAMESPACE_CONSTRAIN_DISPLAY_APIS.equals(invocation.getArgument(0))) {
|
||||
mDeviceConfigListeners.add(invocation.getArgument(2));
|
||||
}
|
||||
// SizeCompatTests uses setNeverConstrainDisplayApisFlag, and ActivityRecordTests
|
||||
// uses splash_screen_exception_list. So still execute real registration.
|
||||
return invocation.callRealMethod();
|
||||
|
||||
Reference in New Issue
Block a user