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

Commit b16a870a authored by William Xiao's avatar William Xiao
Browse files

Set touchable region to full screen when glanceable hub is visible

The hub is a full-screen UI so we want the touchable region to be the
full screen. Without this change, touches when opening the hub over the
dream go to the dream instead as the shade window is not touchable.

This was not an issue with Tangor as there was no camera cut out and
thus StatusBarTouchableRegionManager was not actively adjusting the
touchable region.

Existing logic accounts for this when the scene container is enabled so
we only need to make this work with scene container disabled.

Bug: 375273090
Fixed: 375273090
Test: atest StatusBarTouchableRegionManagerTest
Flag: EXEMPT WIP will create flag soon
Change-Id: I16b73ae5e66c0b12fc0192ca52ab5f5ed038075e
parent 3b88d4b6
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.compose.animation.scene.ObservableTransitionState
import com.android.systemui.SysuiTestCase
import com.android.systemui.communal.data.repository.fakeCommunalSceneRepository
import com.android.systemui.communal.shared.model.CommunalScenes
import com.android.systemui.flags.DisableSceneContainer
import com.android.systemui.flags.EnableSceneContainer
import com.android.systemui.kosmos.testScope
@@ -111,6 +113,23 @@ class StatusBarTouchableRegionManagerTest : SysuiTestCase() {
            )
            runCurrent()

            assertThat(underTest.shouldMakeEntireScreenTouchable()).isFalse()
        }

    @Test
    @DisableSceneContainer
    fun entireScreenTouchable_communalVisible() =
        testScope.runTest {
            assertThat(underTest.shouldMakeEntireScreenTouchable()).isFalse()

            kosmos.fakeCommunalSceneRepository.snapToScene(CommunalScenes.Communal)
            runCurrent()

            assertThat(underTest.shouldMakeEntireScreenTouchable()).isTrue()

            kosmos.fakeCommunalSceneRepository.snapToScene(CommunalScenes.Blank)
            runCurrent()

            assertThat(underTest.shouldMakeEntireScreenTouchable()).isFalse()
        }
}
+14 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.systemui.Dumpable;
import com.android.systemui.ScreenDecorations;
import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor;
import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor;
import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.res.R;
import com.android.systemui.scene.domain.interactor.SceneInteractor;
@@ -78,6 +79,7 @@ public final class StatusBarTouchableRegionManager implements Dumpable {
    private View mNotificationShadeWindowView;
    private View mNotificationPanelView;
    private boolean mForceCollapsedUntilLayout = false;
    private Boolean mCommunalVisible = false;

    private Region mTouchableRegion = new Region();
    private int mDisplayCutoutTouchableRegionSize;
@@ -98,7 +100,8 @@ public final class StatusBarTouchableRegionManager implements Dumpable {
            JavaAdapter javaAdapter,
            UnlockedScreenOffAnimationController unlockedScreenOffAnimationController,
            PrimaryBouncerInteractor primaryBouncerInteractor,
            AlternateBouncerInteractor alternateBouncerInteractor
            AlternateBouncerInteractor alternateBouncerInteractor,
            CommunalSceneInteractor communalSceneInteractor
    ) {
        mContext = context;
        initResources();
@@ -145,6 +148,9 @@ public final class StatusBarTouchableRegionManager implements Dumpable {
            javaAdapter.alwaysCollectFlow(
                    shadeInteractor.isAnyExpanded(),
                    this::onShadeOrQsExpanded);
            javaAdapter.alwaysCollectFlow(
                    communalSceneInteractor.isCommunalVisible(),
                    this::onCommunalVisible);
        }

        mPrimaryBouncerInteractor = primaryBouncerInteractor;
@@ -196,6 +202,10 @@ public final class StatusBarTouchableRegionManager implements Dumpable {
        }
    }

    private void onCommunalVisible(Boolean visible) {
        mCommunalVisible = visible;
    }

    /**
     * Calculates the touch region needed for heads up notifications, taking into consideration
     * any existing display cutouts (notch)
@@ -304,6 +314,9 @@ public final class StatusBarTouchableRegionManager implements Dumpable {
                && (!mIsSceneContainerUiEmpty || mIsRemoteUserInteractionOngoing))
                || mPrimaryBouncerInteractor.isShowing().getValue()
                || mAlternateBouncerInteractor.isVisibleState()
                // The glanceable hub is a full-screen UI within the notification shade window. When
                // it's visible, the touchable region should be the full screen.
                || mCommunalVisible
                || mUnlockedScreenOffAnimationController.isAnimationPlaying();
    }

+2 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.phone
import android.content.applicationContext
import com.android.systemui.bouncer.domain.interactor.alternateBouncerInteractor
import com.android.systemui.bouncer.domain.interactor.primaryBouncerInteractor
import com.android.systemui.communal.domain.interactor.communalSceneInteractor
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.testScope
import com.android.systemui.scene.domain.interactor.sceneInteractor
@@ -43,5 +44,6 @@ var Kosmos.statusBarTouchableRegionManager by
            mock<UnlockedScreenOffAnimationController>(),
            primaryBouncerInteractor,
            alternateBouncerInteractor,
            communalSceneInteractor,
        )
    }