summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Charles Chen <charlesccchen@google.com> 2023-10-27 07:05:20 +0800
committer Charles Chen <charlesccchen@google.com> 2023-11-01 08:57:32 +0800
commit04a540dccd9f2cb833c5eb914c8c4d4727a68e48 (patch)
tree4015418a504db8b8619e86918e9cdcd64f122890
parent7f68fdfe9d7ce53fff583f57c8ab672dfd005110 (diff)
Deflake #testGetSettingsContextOnDualDisplayContent
The test flakiness is due to WindowTokenClient may receive more than one #onConfigurationChanged callbacks. The callbacks are from: 1. register the WindowContext to DA 2. The second display is changed to dual DA policy This CL clear invocations before we place IME container to the sub-DA to reduce test flakiness. Test: re-run https://android-build.corp.google.com/builds/abtd/run/L60800030000011658 Bug: 307050578 Change-Id: I5c070f83a3ac6bf46bdaa49bdddc61a80f97670f
-rw-r--r--core/java/android/window/WindowTokenClient.java5
-rw-r--r--services/tests/wmtests/src/com/android/server/wm/InputMethodDialogWindowContextTest.java3
2 files changed, 4 insertions, 4 deletions
diff --git a/core/java/android/window/WindowTokenClient.java b/core/java/android/window/WindowTokenClient.java
index f4f1b3b9b27b..c20b278f7eaa 100644
--- a/core/java/android/window/WindowTokenClient.java
+++ b/core/java/android/window/WindowTokenClient.java
@@ -31,10 +31,8 @@ import android.content.res.Configuration;
import android.inputmethodservice.AbstractInputMethodService;
import android.os.Binder;
import android.os.Build;
-import android.os.Bundle;
import android.os.Debug;
import android.os.Handler;
-import android.os.IBinder;
import android.util.Log;
import com.android.internal.annotations.GuardedBy;
@@ -76,8 +74,7 @@ public class WindowTokenClient extends Binder {
* Attaches {@code context} to this {@link WindowTokenClient}. Each {@link WindowTokenClient}
* can only attach one {@link Context}.
* <p>This method must be called before invoking
- * {@link android.view.IWindowManager#attachWindowContextToDisplayArea(IBinder, int, int,
- * Bundle)}.<p/>
+ * {@link android.view.IWindowManager#attachWindowContextToDisplayArea}.<p/>
*
* @param context context to be attached
* @throws IllegalStateException if attached context has already existed.
diff --git a/services/tests/wmtests/src/com/android/server/wm/InputMethodDialogWindowContextTest.java b/services/tests/wmtests/src/com/android/server/wm/InputMethodDialogWindowContextTest.java
index 41659113b1b2..da3a02ac525a 100644
--- a/services/tests/wmtests/src/com/android/server/wm/InputMethodDialogWindowContextTest.java
+++ b/services/tests/wmtests/src/com/android/server/wm/InputMethodDialogWindowContextTest.java
@@ -160,6 +160,9 @@ public class InputMethodDialogWindowContextTest extends WindowTestsBase {
final DisplayAreaGroup firstDaGroup = mSecondaryDisplay.mFirstRoot;
maxBoundsVerifier.setMaxBounds(firstDaGroup.getMaxBounds());
+ // Clear the previous invocation histories in case we may count the previous
+ // onConfigurationChanged invocation into the next verification.
+ clearInvocations(tokenClient, imeContainer);
firstDaGroup.placeImeContainer(imeContainer);
verify(imeContainer, timeout(WAIT_TIMEOUT_MS)).onConfigurationChanged(