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

Commit 99bfbf7f authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Fix high flakiness of InsetsPolicyTest"

parents 617b5195 5a06af21
Loading
Loading
Loading
Loading
+12 −5
Original line number Diff line number Diff line
@@ -37,6 +37,8 @@ import static android.view.WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR_SUB_PANEL;

import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -46,7 +48,6 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;

import android.app.StatusBarManager;
@@ -265,7 +266,8 @@ public class InsetsPolicyTest extends WindowTestsBase {
        final WindowState navBar = addNavigationBar();
        navBar.setHasSurface(true);
        navBar.getControllableInsetProvider().setServerVisible(true);
        final InsetsPolicy policy = spy(mDisplayContent.getInsetsPolicy());
        final InsetsPolicy policy = mDisplayContent.getInsetsPolicy();
        spyOn(policy);
        doNothing().when(policy).startAnimation(anyBoolean(), any());

        // Make both system bars invisible.
@@ -302,12 +304,15 @@ public class InsetsPolicyTest extends WindowTestsBase {
        addStatusBar().getControllableInsetProvider().getSource().setVisible(false);
        addNavigationBar().getControllableInsetProvider().setServerVisible(true);

        final InsetsPolicy policy = spy(mDisplayContent.getInsetsPolicy());
        final InsetsPolicy policy = mDisplayContent.getInsetsPolicy();
        spyOn(policy);
        doNothing().when(policy).startAnimation(anyBoolean(), any());
        policy.updateBarControlTarget(mAppWindow);
        policy.showTransient(new int[]{ITYPE_STATUS_BAR, ITYPE_NAVIGATION_BAR},
                true /* isGestureOnSystemBar */);
        waitUntilWindowAnimatorIdle();
        assertTrue(policy.isTransient(ITYPE_STATUS_BAR));
        assertFalse(policy.isTransient(ITYPE_NAVIGATION_BAR));
        final InsetsSourceControl[] controls =
                mDisplayContent.getInsetsStateController().getControlsForDispatch(mAppWindow);

@@ -335,7 +340,8 @@ public class InsetsPolicyTest extends WindowTestsBase {
        navBarSource.setVisible(false);
        mAppWindow.mAboveInsetsState.addSource(navBarSource);
        mAppWindow.mAboveInsetsState.addSource(statusBarSource);
        final InsetsPolicy policy = spy(mDisplayContent.getInsetsPolicy());
        final InsetsPolicy policy = mDisplayContent.getInsetsPolicy();
        spyOn(policy);
        doNothing().when(policy).startAnimation(anyBoolean(), any());
        policy.updateBarControlTarget(mAppWindow);
        policy.showTransient(new int[]{ITYPE_STATUS_BAR, ITYPE_NAVIGATION_BAR},
@@ -383,7 +389,8 @@ public class InsetsPolicyTest extends WindowTestsBase {
        final WindowState app = addWindow(TYPE_APPLICATION, "app");
        final WindowState app2 = addWindow(TYPE_APPLICATION, "app");

        final InsetsPolicy policy = spy(mDisplayContent.getInsetsPolicy());
        final InsetsPolicy policy = mDisplayContent.getInsetsPolicy();
        spyOn(policy);
        doNothing().when(policy).startAnimation(anyBoolean(), any());
        policy.updateBarControlTarget(app);
        policy.showTransient(new int[]{ITYPE_STATUS_BAR, ITYPE_NAVIGATION_BAR},