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

Commit bf91dc84 authored by Winson Chung's avatar Winson Chung Committed by Automerger Merge Worker
Browse files

Merge "Notify sysui of side swipe gestures that will show the bars...

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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16422448

Change-Id: Idd7e52ee5506e6dd1b955fc7824396a114f4a987
parents 8125937c c80ff172
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -207,8 +207,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
@@ -227,6 +227,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;
@@ -871,6 +872,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);
    }
@@ -989,7 +993,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;
        }
@@ -998,6 +1003,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
        }
        if (!mTransientShown) {
            mTransientShown = true;
            mTransientShownFromGestureOnSystemBar = isGestureOnSystemBar;
            handleTransientChanged();
        }
    }
@@ -1016,12 +1022,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
@@ -369,7 +369,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
@@ -348,10 +348,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[]).
         */
@@ -1038,9 +1046,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();
        }
    }

@@ -1444,8 +1453,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