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

Commit afcb9148 authored by Bryce Lee's avatar Bryce Lee Committed by Android (Google) Code Review
Browse files

Merge "Tie bouncer over dream state to visibility." into tm-qpr-dev

parents 26b037f4 4de1c13f
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import com.android.systemui.statusbar.phone.panelstate.PanelExpansionChangeEvent
import com.android.wm.shell.animation.FlingAnimationUtils;

import java.util.Optional;

import javax.inject.Inject;
import javax.inject.Named;

@@ -153,8 +154,6 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler {

    private void setPanelExpansion(float expansion, float dragDownAmount) {
        mCurrentExpansion = expansion;
        mCentralSurfaces.ifPresent(centralSurfaces -> centralSurfaces.setBouncerShowingOverDream(
                mCurrentExpansion != KeyguardBouncer.EXPANSION_HIDDEN));
        PanelExpansionChangeEvent event =
                new PanelExpansionChangeEvent(
                        /* fraction= */ mCurrentExpansion,
+4 −0
Original line number Diff line number Diff line
@@ -164,6 +164,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb

        @Override
        public void onVisibilityChanged(boolean isVisible) {
            mCentralSurfaces
                    .setBouncerShowingOverDream(
                            isVisible && mDreamOverlayStateController.isOverlayActive());

            if (!isVisible) {
                mCentralSurfaces.setBouncerHiddenFraction(KeyguardBouncer.EXPANSION_HIDDEN);
            }
+0 −2
Original line number Diff line number Diff line
@@ -428,7 +428,6 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
    @Test
    public void testInformBouncerShowingOnExpand() {
        swipeToPosition(1f, Direction.UP, 0);
        verify(mCentralSurfaces).setBouncerShowingOverDream(true);
    }

    /**
@@ -441,7 +440,6 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
        Mockito.clearInvocations(mCentralSurfaces);

        swipeToPosition(0f, Direction.DOWN, 0);
        verify(mCentralSurfaces).setBouncerShowingOverDream(false);
    }


+28 −0
Original line number Diff line number Diff line
@@ -61,7 +61,9 @@ import com.google.common.truth.Truth;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;

import java.util.Optional;
@@ -97,6 +99,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
    @Mock private LatencyTracker mLatencyTracker;

    private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
    private KeyguardBouncer.BouncerExpansionCallback mBouncerExpansionCallback;

    @Before
    public void setUp() {
@@ -136,6 +139,11 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
                mBypassController);
        when(mKeyguardStateController.isOccluded()).thenReturn(false);
        mStatusBarKeyguardViewManager.show(null);
        ArgumentCaptor<KeyguardBouncer.BouncerExpansionCallback> callbackArgumentCaptor =
                ArgumentCaptor.forClass(KeyguardBouncer.BouncerExpansionCallback.class);
        verify(mKeyguardBouncerFactory).create(any(ViewGroup.class),
                callbackArgumentCaptor.capture());
        mBouncerExpansionCallback = callbackArgumentCaptor.getValue();
    }

    @Test
@@ -417,4 +425,24 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
        return new PanelExpansionChangeEvent(
                fraction, expanded, tracking, /* dragDownPxAmount= */ 0f);
    }

    @Test
    public void testReportBouncerOnDreamWhenVisible() {
        mBouncerExpansionCallback.onVisibilityChanged(true);
        verify(mCentralSurfaces).setBouncerShowingOverDream(false);
        Mockito.clearInvocations(mCentralSurfaces);
        when(mDreamOverlayStateController.isOverlayActive()).thenReturn(true);
        mBouncerExpansionCallback.onVisibilityChanged(true);
        verify(mCentralSurfaces).setBouncerShowingOverDream(true);
    }

    @Test
    public void testReportBouncerOnDreamWhenNotVisible() {
        mBouncerExpansionCallback.onVisibilityChanged(false);
        verify(mCentralSurfaces).setBouncerShowingOverDream(false);
        Mockito.clearInvocations(mCentralSurfaces);
        when(mDreamOverlayStateController.isOverlayActive()).thenReturn(true);
        mBouncerExpansionCallback.onVisibilityChanged(false);
        verify(mCentralSurfaces).setBouncerShowingOverDream(false);
    }
}