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

Commit 286af4bb authored by Andreas Miko's avatar Andreas Miko
Browse files

[SceneContainer] Fix touchable area when a HUN is displayed

When a HUN is shown sceneContainer would be set to visible, which would
hard set the touchable area to the entire screen in
`StatusBarTouchableRegionManager`. This fix now instead observes the
scene transition state instead and sets the touchable area to full
screen on all scenes except for Gone. While on Gone the touchable area
is determined by the region where a HUN is shown.

There is currently a different bug for some edge cases in
`getTouchableRegion()` that is now tracked in b/347007367.

Bug: 343688970
Flag: com.android.systemui.scene_container
Test: Manual tests
Change-Id: I9deb003df3dcf5c90d96666124e62c73cdbc1c23
parent dd7b1173
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -202,6 +202,7 @@ public class HeadsUpManagerPhone extends BaseHeadsUpManager implements
     * Gets the touchable region needed for heads up notifications. Returns null if no touchable
     * region is required (ie: no heads up notification currently exists).
     */
    // TODO(b/347007367): With scene container enabled this method may report outdated regions
    @Override
    public @Nullable Region getTouchableRegion() {
        NotificationEntry topEntry = getTopEntry();
+11 −10
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnComputeInternalInsetsListener;
import android.view.WindowInsets;

import com.android.compose.animation.scene.ObservableTransitionState;
import com.android.internal.policy.SystemBarUtils;
import com.android.systemui.Dumpable;
import com.android.systemui.ScreenDecorations;
@@ -38,7 +39,7 @@ import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.res.R;
import com.android.systemui.scene.domain.interactor.SceneInteractor;
import com.android.systemui.scene.shared.flag.SceneContainerFlag;
import com.android.systemui.shade.ShadeExpansionStateManager;
import com.android.systemui.scene.shared.model.Scenes;
import com.android.systemui.shade.domain.interactor.ShadeInteractor;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.policy.ConfigurationController;
@@ -67,7 +68,7 @@ public final class StatusBarTouchableRegionManager implements Dumpable {
    private final UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;

    private boolean mIsStatusBarExpanded = false;
    private boolean mIsSceneContainerVisible = false;
    private boolean mIsIdleOnGone = false;
    private boolean mShouldAdjustInsets = false;
    private View mNotificationShadeWindowView;
    private View mNotificationPanelView;
@@ -87,7 +88,6 @@ public final class StatusBarTouchableRegionManager implements Dumpable {
            NotificationShadeWindowController notificationShadeWindowController,
            ConfigurationController configurationController,
            HeadsUpManager headsUpManager,
            ShadeExpansionStateManager shadeExpansionStateManager,
            ShadeInteractor shadeInteractor,
            Provider<SceneInteractor> sceneInteractor,
            JavaAdapter javaAdapter,
@@ -131,8 +131,8 @@ public final class StatusBarTouchableRegionManager implements Dumpable {

        if (SceneContainerFlag.isEnabled()) {
            javaAdapter.alwaysCollectFlow(
                    sceneInteractor.get().isVisible(),
                    this::onSceneContainerVisibilityChanged);
                    sceneInteractor.get().getTransitionState(),
                    this::onSceneChanged);
        } else {
            javaAdapter.alwaysCollectFlow(
                    shadeInteractor.isAnyExpanded(),
@@ -167,10 +167,11 @@ public final class StatusBarTouchableRegionManager implements Dumpable {
        }
    }

    private void onSceneContainerVisibilityChanged(Boolean isVisible) {
        if (isVisible != mIsSceneContainerVisible) {
            mIsSceneContainerVisible = isVisible;
            if (isVisible) {
    private void onSceneChanged(ObservableTransitionState transitionState) {
        boolean isIdleOnGone = transitionState.isIdle(Scenes.Gone);
        if (isIdleOnGone != mIsIdleOnGone) {
            mIsIdleOnGone = isIdleOnGone;
            if (!isIdleOnGone) {
                // make sure our state is sensible
                mForceCollapsedUntilLayout = false;
            }
@@ -281,7 +282,7 @@ public final class StatusBarTouchableRegionManager implements Dumpable {
        // since we don't want stray touches to go through the light reveal scrim to whatever is
        // underneath.
        return mIsStatusBarExpanded
                || mIsSceneContainerVisible
                || !mIsIdleOnGone
                || mPrimaryBouncerInteractor.isShowing().getValue()
                || mAlternateBouncerInteractor.isVisibleState()
                || mUnlockedScreenOffAnimationController.isAnimationPlaying();