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

Commit 2a390f27 authored by Josh Tsuji's avatar Josh Tsuji Committed by Automerger Merge Worker
Browse files

Merge "Make entire screen touchable if screen off is playing." into tm-qpr-dev am: 0fd7d630

parents e07901de 0fd7d630
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3623,6 +3623,7 @@ public class CentralSurfacesImpl extends CoreStartable implements
            dismissVolumeDialog();
            mWakeUpCoordinator.setFullyAwake(false);
            mKeyguardBypassController.onStartedGoingToSleep();
            mStatusBarTouchableRegionManager.updateTouchableRegion();

            // The unlocked screen off and fold to aod animations might use our LightRevealScrim -
            // we need to be expanded for it to be visible.
@@ -3651,6 +3652,7 @@ public class CentralSurfacesImpl extends CoreStartable implements
                // once we fully woke up.
                updateRevealEffect(true /* wakingUp */);
                updateNotificationPanelTouchState();
                mStatusBarTouchableRegionManager.updateTouchableRegion();

                // If we are waking up during the screen off animation, we should undo making the
                // expanded visible (we did that so the LightRevealScrim would be visible).
+21 −4
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ public final class StatusBarTouchableRegionManager implements Dumpable {
    private final Context mContext;
    private final HeadsUpManagerPhone mHeadsUpManager;
    private final NotificationShadeWindowController mNotificationShadeWindowController;
    private final UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;

    private boolean mIsStatusBarExpanded = false;
    private boolean mShouldAdjustInsets = false;
@@ -72,7 +73,8 @@ public final class StatusBarTouchableRegionManager implements Dumpable {
            Context context,
            NotificationShadeWindowController notificationShadeWindowController,
            ConfigurationController configurationController,
            HeadsUpManagerPhone headsUpManager
            HeadsUpManagerPhone headsUpManager,
            UnlockedScreenOffAnimationController unlockedScreenOffAnimationController
    ) {
        mContext = context;
        initResources();
@@ -115,6 +117,8 @@ public final class StatusBarTouchableRegionManager implements Dumpable {
        mNotificationShadeWindowController.setForcePluginOpenListener((forceOpen) -> {
            updateTouchableRegion();
        });

        mUnlockedScreenOffAnimationController = unlockedScreenOffAnimationController;
    }

    protected void setup(
@@ -179,7 +183,7 @@ public final class StatusBarTouchableRegionManager implements Dumpable {
    /**
     * Set the touchable portion of the status bar based on what elements are visible.
     */
    private void updateTouchableRegion() {
    public void updateTouchableRegion() {
        boolean hasCutoutInset = (mNotificationShadeWindowView != null)
                && (mNotificationShadeWindowView.getRootWindowInsets() != null)
                && (mNotificationShadeWindowView.getRootWindowInsets().getDisplayCutout() != null);
@@ -242,12 +246,25 @@ public final class StatusBarTouchableRegionManager implements Dumpable {
        touchableRegion.union(bounds);
    }

    /**
     * Helper to let us know when calculating the region is not needed because we know the entire
     * screen needs to be touchable.
     */
    private boolean shouldMakeEntireScreenTouchable() {
        // The touchable region is always the full area when expanded, whether we're showing the
        // shade or the bouncer. It's also fully touchable when the screen off animation is playing
        // since we don't want stray touches to go through the light reveal scrim to whatever is
        // underneath.
        return mIsStatusBarExpanded
                || mCentralSurfaces.isBouncerShowing()
                || mUnlockedScreenOffAnimationController.isAnimationPlaying();
    }

    private final OnComputeInternalInsetsListener mOnComputeInternalInsetsListener =
            new OnComputeInternalInsetsListener() {
        @Override
        public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo info) {
            if (mIsStatusBarExpanded || mCentralSurfaces.isBouncerShowing()) {
                // The touchable region is always the full area when expanded
            if (shouldMakeEntireScreenTouchable()) {
                return;
            }