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

Commit a74577eb authored by Tiger Huang's avatar Tiger Huang Committed by Automerger Merge Worker
Browse files

Merge "Play insets animation while forcibly showing system bars" into udc-qpr-dev am: 5b35c961

parents d6fb3480 5b35c961
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -841,7 +841,6 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation
        return mLastDispatchedState;
    }

    @VisibleForTesting
    public boolean onStateChanged(InsetsState state) {
        boolean stateChanged = false;
        if (!CAPTION_ON_SHELL) {
+149 −192

File changed.

Preview size limit exceeded, changes collapsed.

+0 −13
Original line number Diff line number Diff line
@@ -31,17 +31,12 @@ 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;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
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.verify;

import android.app.StatusBarManager;
@@ -268,8 +263,6 @@ public class InsetsPolicyTest extends WindowTestsBase {
        navBar.setHasSurface(true);
        navBarProvider.setServerVisible(true);
        final InsetsPolicy policy = mDisplayContent.getInsetsPolicy();
        spyOn(policy);
        doNothing().when(policy).startAnimation(anyBoolean(), any());

        // Make both system bars invisible.
        mAppWindow.setRequestedVisibleTypes(
@@ -305,8 +298,6 @@ public class InsetsPolicyTest extends WindowTestsBase {
        addNavigationBar().getControllableInsetProvider().setServerVisible(true);

        final InsetsPolicy policy = mDisplayContent.getInsetsPolicy();
        spyOn(policy);
        doNothing().when(policy).startAnimation(anyBoolean(), any());
        policy.updateBarControlTarget(mAppWindow);
        policy.showTransient(navigationBars() | statusBars(),
                true /* isGestureOnSystemBar */);
@@ -341,8 +332,6 @@ public class InsetsPolicyTest extends WindowTestsBase {
        mAppWindow.mAboveInsetsState.addSource(navBarSource);
        mAppWindow.mAboveInsetsState.addSource(statusBarSource);
        final InsetsPolicy policy = mDisplayContent.getInsetsPolicy();
        spyOn(policy);
        doNothing().when(policy).startAnimation(anyBoolean(), any());
        policy.updateBarControlTarget(mAppWindow);
        policy.showTransient(navigationBars() | statusBars(),
                true /* isGestureOnSystemBar */);
@@ -390,8 +379,6 @@ public class InsetsPolicyTest extends WindowTestsBase {
        final WindowState app2 = addWindow(TYPE_APPLICATION, "app");

        final InsetsPolicy policy = mDisplayContent.getInsetsPolicy();
        spyOn(policy);
        doNothing().when(policy).startAnimation(anyBoolean(), any());
        policy.updateBarControlTarget(app);
        policy.showTransient(navigationBars() | statusBars(),
                true /* isGestureOnSystemBar */);
+4 −0
Original line number Diff line number Diff line
@@ -77,6 +77,10 @@ class TestDisplayContent extends DisplayContent {
        spyOn(inputMonitor);
        doNothing().when(inputMonitor).resumeDispatchingLw(any());

        final InsetsPolicy insetsPolicy = getInsetsPolicy();
        WindowTestsBase.suppressInsetsAnimation(insetsPolicy.getPermanentControlTarget());
        WindowTestsBase.suppressInsetsAnimation(insetsPolicy.getTransientControlTarget());

        // For devices that set the sysprop ro.bootanim.set_orientation_<display_id>
        // See DisplayRotation#readDefaultDisplayRotation for context.
        // Without that, meaning of height and width in context of the tests can be swapped if
+13 −0
Original line number Diff line number Diff line
@@ -222,6 +222,10 @@ class WindowTestsBase extends SystemServiceTestsBase {
        displayPolicy.finishWindowsDrawn();
        displayPolicy.finishScreenTurningOn();

        final InsetsPolicy insetsPolicy = mDefaultDisplay.getInsetsPolicy();
        suppressInsetsAnimation(insetsPolicy.getTransientControlTarget());
        suppressInsetsAnimation(insetsPolicy.getPermanentControlTarget());

        mTransaction = mSystemServicesTestRule.mTransaction;
        mMockSession = mock(Session.class);

@@ -278,6 +282,15 @@ class WindowTestsBase extends SystemServiceTestsBase {
        checkDeviceSpecificOverridesNotApplied();
    }

    /**
     * The test doesn't create real SurfaceControls, but mocked ones. This prevents the target from
     * controlling them, or it will cause {@link NullPointerException}.
     */
    static void suppressInsetsAnimation(InsetsControlTarget target) {
        spyOn(target);
        Mockito.doNothing().when(target).notifyInsetsControlChanged();
    }

    @After
    public void tearDown() throws Exception {
        if (mUseFakeSettingsProvider) {