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

Commit 7d72bcd4 authored by Ats Jenk's avatar Ats Jenk
Browse files

Fix tap on navbar handle when on desktop

Tapping on navbar handle was hiding the stashed taskbar handle.
When tappin on navbar handle, it starts the recents animation. Which
gets cancelled. Normally, the fullscreen app being visible, it means
launcher activity will be paused after. But when on desktop, launcher is
visible in the background and we need to manually set it to paused
state.
When recents gesture is cancelled after navbar handle tap, the gesture
end state is null. Detect this in DesktopVisibiltyController and mark
launcher as paused in this case.

Bug: 286140120
Flag: persist.wm.debug.desktop_mode_2
Test: open an app on desktop, tap on navbar, observe that user remains
      on desktop
Change-Id: Iee915026265721d42a0b722d6b1595521f20a59a
parent 06ca4d9c
Loading
Loading
Loading
Loading
+26 −5
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.quickstep.GestureState;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.views.DesktopAppSelectView;
import com.android.wm.shell.desktopmode.IDesktopTaskListener;
@@ -166,20 +167,40 @@ public class DesktopVisibilityController {
    /**
     * Whether recents gesture is currently in progress.
     */
    public boolean isGestureInProgress() {
    public boolean isRecentsGestureInProgress() {
        return mGestureInProgress;
    }

    /**
     * Sets whether recents gesture is in progress.
     * Notify controller that recents gesture has started.
     */
    public void setGestureInProgress(boolean gestureInProgress) {
        if (DEBUG) {
            Log.d(TAG, "setGestureInProgress: inProgress=" + gestureInProgress);
    public void setRecentsGestureStart() {
        if (!isDesktopModeSupported()) {
            return;
        }
        setRecentsGestureInProgress(true);
    }

    /**
     * Notify controller that recents gesture finished with the given
     * {@link com.android.quickstep.GestureState.GestureEndTarget}
     */
    public void setRecentsGestureEnd(@Nullable GestureState.GestureEndTarget endTarget) {
        if (!isDesktopModeSupported()) {
            return;
        }
        setRecentsGestureInProgress(false);

        if (endTarget == null) {
            // Gesture did not result in a new end target. Ensure launchers gets paused again.
            markLauncherPaused();
        }
    }

    private void setRecentsGestureInProgress(boolean gestureInProgress) {
        if (DEBUG) {
            Log.d(TAG, "setGestureInProgress: inProgress=" + gestureInProgress);
        }
        if (gestureInProgress != mGestureInProgress) {
            mGestureInProgress = gestureInProgress;
        }
+1 −1
Original line number Diff line number Diff line
@@ -865,7 +865,7 @@ public class QuickstepLauncher extends Launcher {
        if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) {
            DesktopVisibilityController controller = mDesktopVisibilityController;
            if (controller != null && controller.areFreeformTasksVisible()
                    && !controller.isGestureInProgress()) {
                    && !controller.isRecentsGestureInProgress()) {
                // Return early to skip setting activity to appear as resumed
                // TODO(b/255649902): shouldn't be needed when we have a separate launcher state
                //  for desktop that we can use to control other parts of launcher
+5 −3
Original line number Diff line number Diff line
@@ -242,7 +242,7 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
        DesktopVisibilityController desktopVisibilityController =
                mActivity.getDesktopVisibilityController();
        if (desktopVisibilityController != null) {
            desktopVisibilityController.setGestureInProgress(true);
            desktopVisibilityController.setRecentsGestureStart();
        }
    }

@@ -250,9 +250,11 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
    public void onGestureAnimationEnd() {
        DesktopVisibilityController desktopVisibilityController = null;
        boolean showDesktopApps = false;
        GestureState.GestureEndTarget endTarget = null;
        if (DesktopTaskView.DESKTOP_MODE_SUPPORTED) {
            desktopVisibilityController = mActivity.getDesktopVisibilityController();
            if (mCurrentGestureEndTarget == GestureState.GestureEndTarget.LAST_TASK
            endTarget = mCurrentGestureEndTarget;
            if (endTarget == GestureState.GestureEndTarget.LAST_TASK
                    && desktopVisibilityController.areFreeformTasksVisible()) {
                // Recents gesture was cancelled and we are returning to the previous task.
                // After super class has handled clean up, show desktop apps on top again
@@ -261,7 +263,7 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
        }
        super.onGestureAnimationEnd();
        if (desktopVisibilityController != null) {
            desktopVisibilityController.setGestureInProgress(false);
            desktopVisibilityController.setRecentsGestureEnd(endTarget);
        }
        if (showDesktopApps) {
            SystemUiProxy.INSTANCE.get(mActivity).showDesktopApps(mActivity.getDisplayId());