Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 04a540dc authored by Charles Chen's avatar Charles Chen
Browse files

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
parent 7f68fdfe
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -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.
+3 −0
Original line number Diff line number Diff line
@@ -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(