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

Commit 44273420 authored by Tracy Zhou's avatar Tracy Zhou Committed by Android (Google) Code Review
Browse files

Merge "Notify when quickstep gesture starts" into sc-dev

parents bc10cd12 73705bf0
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ interface ISystemUiProxy {
     * Notifies that quickstep will switch to a new task
     * @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.
@@ -137,5 +137,8 @@ interface ISystemUiProxy {
    /** Sets home rotation enabled. */
    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 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
     * rotate the phone
     * 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
     * {@link #mTasksFrozenListener} fires
     */
@@ -319,7 +319,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
        }

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

        @Override
        public void onQuickSwitchToNewTask(@Surface.Rotation int rotation) {
            if (!verifyCaller("onQuickSwitchToNewTask")) {
        public void notifySwipeUpGestureStarted() {
            if (!verifyCaller("notifySwipeUpGestureStarted")) {
                return;
            }
            final long token = Binder.clearCallingIdentity();
            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 {
                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) {
            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) {
            mConnectionCallbacks.get(i).onSwipeToHomeFinished();
            mConnectionCallbacks.get(i).onSwipeUpGestureStarted();
        }
    }

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