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

Commit f80552b6 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Notify sysui of side swipe gestures that will show the bars transiently" into sc-v2-dev

parents 3440697a 64f48601
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -205,8 +205,10 @@ oneway interface IStatusBar
     *
     * @param displayId the ID of the display to notify.
     * @param types the internal insets types of the bars are about to show transiently.
     * @param isGestureOnSystemBar whether the gesture to show the transient bar was a gesture on
     *        one of the bars itself.
     */
    void showTransient(int displayId, in int[] types);
    void showTransient(int displayId, in int[] types, boolean isGestureOnSystemBar);

    /**
     * Notifies System UI to abort the transient state of system bars, which prevents the bars being
+10 −2
Original line number Diff line number Diff line
@@ -228,6 +228,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
    private @Behavior int mBehavior;

    private boolean mTransientShown;
    private boolean mTransientShownFromGestureOnSystemBar;
    private int mNavBarMode = NAV_BAR_MODE_3BUTTON;
    private LightBarController mLightBarController;
    private final LightBarController mMainLightBarController;
@@ -872,6 +873,9 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
                + windowStateToString(mNavigationBarWindowState));
        pw.println("  mNavigationBarMode="
                + BarTransitions.modeToString(mNavigationBarMode));
        pw.println("  mTransientShown=" + mTransientShown);
        pw.println("  mTransientShownFromGestureOnSystemBar="
                + mTransientShownFromGestureOnSystemBar);
        dumpBarTransitions(pw, "mNavigationBarView", mNavigationBarView.getBarTransitions());
        mNavigationBarView.dump(pw);
    }
@@ -990,7 +994,8 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
    }

    @Override
    public void showTransient(int displayId, @InternalInsetsType int[] types) {
    public void showTransient(int displayId, @InternalInsetsType int[] types,
            boolean isGestureOnSystemBar) {
        if (displayId != mDisplayId) {
            return;
        }
@@ -999,6 +1004,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
        }
        if (!mTransientShown) {
            mTransientShown = true;
            mTransientShownFromGestureOnSystemBar = isGestureOnSystemBar;
            handleTransientChanged();
        }
    }
@@ -1017,12 +1023,14 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
    private void clearTransient() {
        if (mTransientShown) {
            mTransientShown = false;
            mTransientShownFromGestureOnSystemBar = false;
            handleTransientChanged();
        }
    }

    private void handleTransientChanged() {
        mNavigationBarView.onTransientStateChanged(mTransientShown);
        mNavigationBarView.onTransientStateChanged(mTransientShown,
                mTransientShownFromGestureOnSystemBar);
        final int barMode = barMode(mTransientShown, mAppearance);
        if (updateBarMode(barMode) && mLightBarController != null) {
            mLightBarController.onNavigationBarModeChanged(barMode);
+6 −1
Original line number Diff line number Diff line
@@ -447,12 +447,17 @@ public class NavigationBarView extends FrameLayout implements
        mRegionSamplingHelper.setWindowHasBlurs(hasBlurs);
    }

    void onTransientStateChanged(boolean isTransient) {
    void onTransientStateChanged(boolean isTransient, boolean isGestureOnSystemBar) {
        mEdgeBackGestureHandler.onNavBarTransientStateChanged(isTransient);

        // The visibility of the navigation bar buttons is dependent on the transient state of
        // the navigation bar.
        if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
            // Always allow the overlay if in non-gestural nav mode, otherwise, only allow showing
            // the overlay if the user is swiping directly over a system bar
            boolean allowNavBarOverlay = !QuickStepContract.isGesturalMode(mNavBarMode)
                    || isGestureOnSystemBar;
            isTransient = isTransient && allowNavBarOverlay;
            mNavBarOverlayController.setButtonState(isTransient, /* force */ false);
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -350,7 +350,7 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
    }

    @Override
    public void showTransient(int displayId, int[] types) {
    public void showTransient(int displayId, int[] types, boolean isGestureOnSystemBar) {
        if (displayId != mDisplayId) {
            return;
        }
+14 −4
Original line number Diff line number Diff line
@@ -343,10 +343,18 @@ public class CommandQueue extends IStatusBar.Stub implements
                String packageName) { }

        /**
         * @see IStatusBar#showTransient(int, int[]).
         * @see IStatusBar#showTransient(int, int[], boolean).
         */
        default void showTransient(int displayId, @InternalInsetsType int[] types) { }

        /**
         * @see IStatusBar#showTransient(int, int[], boolean).
         */
        default void showTransient(int displayId, @InternalInsetsType int[] types,
                boolean isGestureOnSystemBar) {
            showTransient(displayId, types);
        }

        /**
         * @see IStatusBar#abortTransient(int, int[]).
         */
@@ -1019,9 +1027,10 @@ public class CommandQueue extends IStatusBar.Stub implements
    }

    @Override
    public void showTransient(int displayId, int[] types) {
    public void showTransient(int displayId, int[] types, boolean isGestureOnSystemBar) {
        synchronized (mLock) {
            mHandler.obtainMessage(MSG_SHOW_TRANSIENT, displayId, 0, types).sendToTarget();
            mHandler.obtainMessage(MSG_SHOW_TRANSIENT, displayId, isGestureOnSystemBar ? 1 : 0,
                    types).sendToTarget();
        }
    }

@@ -1404,8 +1413,9 @@ public class CommandQueue extends IStatusBar.Stub implements
                case MSG_SHOW_TRANSIENT: {
                    final int displayId = msg.arg1;
                    final int[] types = (int[]) msg.obj;
                    final boolean isGestureOnSystemBar = msg.arg2 != 0;
                    for (int i = 0; i < mCallbacks.size(); i++) {
                        mCallbacks.get(i).showTransient(displayId, types);
                        mCallbacks.get(i).showTransient(displayId, types, isGestureOnSystemBar);
                    }
                    break;
                }
Loading