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

Commit 73705bf0 authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Notify when quickstep gesture starts

Also rename notifyQuickSwitchToNewTask

Fixes: 188568083
Test: manual

Change-Id: Ic42825c60f69bcf1b13b92a096d182e82759d72a
parent 330f8f00
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -116,7 +116,7 @@ interface ISystemUiProxy {
     * Notifies that quickstep will switch to a new task
     * Notifies that quickstep will switch to a new task
     * @param rotation indicates which Surface.Rotation the gesture was started in
     * @param rotation indicates which Surface.Rotation the gesture was started in
     */
     */
    void onQuickSwitchToNewTask(int rotation) = 25;
    void notifyPrioritizedRotation(int rotation) = 25;


    /**
    /**
     * Handle the provided image as if it was a screenshot.
     * Handle the provided image as if it was a screenshot.
@@ -137,5 +137,8 @@ interface ISystemUiProxy {
    /** Sets home rotation enabled. */
    /** Sets home rotation enabled. */
    void setHomeRotationEnabled(boolean enabled) = 45;
    void setHomeRotationEnabled(boolean enabled) = 45;


    // Next id = 46
    /** Notifies that a swipe-up gesture has started */
    oneway void notifySwipeUpGestureStarted() = 46;

    // Next id = 47
}
}
+2 −2
Original line number Original line Diff line number Diff line
@@ -246,7 +246,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
     * gesture to indicate to them that they can continue in that orientation without having to
     * gesture to indicate to them that they can continue in that orientation without having to
     * rotate the phone
     * rotate the phone
     * The secondary handle will show when we get
     * The secondary handle will show when we get
     * {@link OverviewProxyListener#onQuickSwitchToNewTask(int)} callback with the
     * {@link OverviewProxyListener#notifyPrioritizedRotation(int)} callback with the
     * original handle hidden and we'll flip the visibilities once the
     * original handle hidden and we'll flip the visibilities once the
     * {@link #mTasksFrozenListener} fires
     * {@link #mTasksFrozenListener} fires
     */
     */
@@ -319,7 +319,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
        }
        }


        @Override
        @Override
        public void onQuickSwitchToNewTask(@Surface.Rotation int rotation) {
        public void onPrioritizedRotation(@Surface.Rotation int rotation) {
            mStartingQuickSwitchRotation = rotation;
            mStartingQuickSwitchRotation = rotation;
            if (rotation == -1) {
            if (rotation == -1) {
                mShowOrientedHandleForImmersiveMode = false;
                mShowOrientedHandleForImmersiveMode = false;
+1 −1
Original line number Original line Diff line number Diff line
@@ -128,7 +128,7 @@ public class EdgeBackGestureHandler extends CurrentUserTracker
    private OverviewProxyService.OverviewProxyListener mQuickSwitchListener =
    private OverviewProxyService.OverviewProxyListener mQuickSwitchListener =
            new OverviewProxyService.OverviewProxyListener() {
            new OverviewProxyService.OverviewProxyListener() {
                @Override
                @Override
                public void onQuickSwitchToNewTask(@Surface.Rotation int rotation) {
                public void onPrioritizedRotation(@Surface.Rotation int rotation) {
                    mStartingQuickstepRotation = rotation;
                    mStartingQuickstepRotation = rotation;
                    updateDisabledForQuickstep(mContext.getResources().getConfiguration());
                    updateDisabledForQuickstep(mContext.getResources().getConfiguration());
                }
                }
+22 −10
Original line number Original line Diff line number Diff line
@@ -425,20 +425,32 @@ public class OverviewProxyService extends CurrentUserTracker implements
                mPipOptional.ifPresent(
                mPipOptional.ifPresent(
                        pip -> pip.setPinnedStackAnimationType(
                        pip -> pip.setPinnedStackAnimationType(
                                PipAnimationController.ANIM_TYPE_ALPHA));
                                PipAnimationController.ANIM_TYPE_ALPHA));
                mHandler.post(() -> notifySwipeToHomeFinishedInternal());
            } finally {
            } finally {
                Binder.restoreCallingIdentity(token);
                Binder.restoreCallingIdentity(token);
            }
            }
        }
        }


        @Override
        @Override
        public void onQuickSwitchToNewTask(@Surface.Rotation int rotation) {
        public void notifySwipeUpGestureStarted() {
            if (!verifyCaller("onQuickSwitchToNewTask")) {
            if (!verifyCaller("notifySwipeUpGestureStarted")) {
                return;
                return;
            }
            }
            final long token = Binder.clearCallingIdentity();
            final long token = Binder.clearCallingIdentity();
            try {
            try {
                mHandler.post(() -> notifyQuickSwitchToNewTask(rotation));
                mHandler.post(() -> notifySwipeUpGestureStartedInternal());
            } finally {
                Binder.restoreCallingIdentity(token);
            }
        }

        @Override
        public void notifyPrioritizedRotation(@Surface.Rotation int rotation) {
            if (!verifyCaller("notifyPrioritizedRotation")) {
                return;
            }
            final long token = Binder.clearCallingIdentity();
            try {
                mHandler.post(() -> notifyPrioritizedRotationInternal(rotation));
            } finally {
            } finally {
                Binder.restoreCallingIdentity(token);
                Binder.restoreCallingIdentity(token);
            }
            }
@@ -880,9 +892,9 @@ public class OverviewProxyService extends CurrentUserTracker implements
        }
        }
    }
    }


    private void notifyQuickSwitchToNewTask(@Surface.Rotation int rotation) {
    private void notifyPrioritizedRotationInternal(@Surface.Rotation int rotation) {
        for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
        for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
            mConnectionCallbacks.get(i).onQuickSwitchToNewTask(rotation);
            mConnectionCallbacks.get(i).onPrioritizedRotation(rotation);
        }
        }
    }
    }


@@ -910,9 +922,9 @@ public class OverviewProxyService extends CurrentUserTracker implements
        }
        }
    }
    }


    public void notifySwipeToHomeFinishedInternal() {
    private void notifySwipeUpGestureStartedInternal() {
        for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
        for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) {
            mConnectionCallbacks.get(i).onSwipeToHomeFinished();
            mConnectionCallbacks.get(i).onSwipeUpGestureStarted();
        }
        }
    }
    }


@@ -1007,8 +1019,8 @@ public class OverviewProxyService extends CurrentUserTracker implements
    public interface OverviewProxyListener {
    public interface OverviewProxyListener {
        default void onConnectionChanged(boolean isConnected) {}
        default void onConnectionChanged(boolean isConnected) {}
        default void onQuickStepStarted() {}
        default void onQuickStepStarted() {}
        default void onSwipeToHomeFinished() {}
        default void onSwipeUpGestureStarted() {}
        default void onQuickSwitchToNewTask(@Surface.Rotation int rotation) {}
        default void onPrioritizedRotation(@Surface.Rotation int rotation) {}
        default void onOverviewShown(boolean fromHome) {}
        default void onOverviewShown(boolean fromHome) {}
        default void onQuickScrubStarted() {}
        default void onQuickScrubStarted() {}
        /** Notify the recents app (overview) is started by 3-button navigation. */
        /** Notify the recents app (overview) is started by 3-button navigation. */