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

Commit 3a925384 authored by Bryce Lee's avatar Bryce Lee
Browse files

Clear touch region on dream overlay container on start.

Since the updated TouchInsetManager logic only sets the touch regions
for surface controls of tracked views, the dream overlay's touch
region will not be set if no view is tracked. This changelist ensures
that the touch region for the overlay is cleared on attach.

Test: atest DreamOverlayContainerViewControllerTest#testRootSurfaceControlInsetSetOnAttach
Fixes: 276023607
Change-Id: I8cc96ba3c1d35510620ca6ed605e386fe11aecc1
parent d5678fa6
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static com.android.systemui.dreams.complication.ComplicationLayoutParams.

import android.animation.Animator;
import android.content.res.Resources;
import android.graphics.Region;
import android.os.Handler;
import android.util.MathUtils;
import android.view.View;
@@ -223,6 +224,9 @@ public class DreamOverlayContainerViewController extends
        mJitterStartTimeMillis = System.currentTimeMillis();
        mHandler.postDelayed(this::updateBurnInOffsets, mBurnInProtectionUpdateInterval);
        mPrimaryBouncerCallbackInteractor.addBouncerExpansionCallback(mBouncerExpansionCallback);
        final Region emptyRegion = Region.obtain();
        mView.getRootSurfaceControl().setTouchableRegion(emptyRegion);
        emptyRegion.recycle();

        // Start dream entry animations. Skip animations for low light clock.
        if (!mStateController.isLowLightActive()) {
+13 −0
Original line number Diff line number Diff line
@@ -26,8 +26,10 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import android.content.res.Resources;
import android.graphics.Region;
import android.os.Handler;
import android.testing.AndroidTestingRunner;
import android.view.AttachedSurfaceControl;
import android.view.ViewGroup;
import android.view.ViewRootImpl;
import android.view.ViewTreeObserver;
@@ -75,6 +77,9 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase {
    @Mock
    ComplicationHostViewController mComplicationHostViewController;

    @Mock
    AttachedSurfaceControl mAttachedSurfaceControl;

    @Mock
    ViewGroup mDreamOverlayContentView;

@@ -108,6 +113,8 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase {
        when(mDreamOverlayContainerView.getResources()).thenReturn(mResources);
        when(mDreamOverlayContainerView.getViewTreeObserver()).thenReturn(mViewTreeObserver);
        when(mDreamOverlayContainerView.getViewRootImpl()).thenReturn(mViewRoot);
        when(mDreamOverlayContainerView.getRootSurfaceControl())
                .thenReturn(mAttachedSurfaceControl);

        mController = new DreamOverlayContainerViewController(
                mDreamOverlayContainerView,
@@ -127,6 +134,12 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase {
                mBouncerlessScrimController);
    }

    @Test
    public void testRootSurfaceControlInsetSetOnAttach() {
        mController.onViewAttached();
        verify(mAttachedSurfaceControl).setTouchableRegion(eq(Region.obtain()));
    }

    @Test
    public void testDreamOverlayStatusBarViewControllerInitialized() {
        mController.init();