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

Commit 64f48601 authored by Winson Chung's avatar Winson Chung
Browse files

Notify sysui of side swipe gestures that will show the bars transiently

- This won't be needed in T when immersive mode gestures are moved
  to SysUI (b/161689946)

Bug: 208886351
Test: atest SystemUITests
Test: In both 3button/gestural (all orientations), swipe from bar
      areas, swipe from sides show entry point only when swiping over
      bars
Change-Id: Ie8f15a5fbd3248bc86a50ffcd1fc73cd08c4e214
parent 5a1d0103
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