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

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

Merge "Allow gestural nav to hide the bar and background" into sc-dev am: 8064ce82

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia732a370eac50b51138a9ea5ca32b94e95864014
parents daee25a6 8064ce82
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -588,4 +588,7 @@

    <!-- Determines whether the shell features all run on another thread. -->
    <bool name="config_enableShellMainThread">false</bool>

    <!-- Determines whether to allow the nav bar handle to be forced to be opaque. -->
    <bool name="allow_force_nav_bar_handle_opaque">true</bool>
</resources>
+2 −8
Original line number Diff line number Diff line
@@ -46,16 +46,10 @@ interface ISystemUiProxy {
     */
    Rect getNonMinimizedSplitScreenSecondaryBounds() = 7;

    /**
     * Control the {@param alpha} of the back button in the navigation bar and {@param animate} if
     * needed from current value
     * @deprecated
     */
    void setBackButtonAlpha(float alpha, boolean animate) = 8;

    /**
     * Control the {@param alpha} of the option nav bar button (back-button in 2 button mode
     * and home bar in no-button mode) and {@param animate} if needed from current value
     * and home handle & background in gestural mode).  The {@param animate} is currently only
     * supported for 2 button mode.
     */
    void setNavBarButtonAlpha(float alpha, boolean animate) = 19;

+23 −4
Original line number Diff line number Diff line
@@ -211,6 +211,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
    private Locale mLocale;
    private int mLayoutDirection;

    private boolean mAllowForceNavBarHandleOpaque;
    private boolean mForceNavBarHandleOpaque;
    private boolean mIsCurrentUserSetup;

@@ -333,13 +334,23 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
                // If the current user is not yet setup, then don't update any button alphas
                return;
            }
            if (QuickStepContract.isLegacyMode(mNavBarMode)) {
                // Don't allow the bar buttons to be affected by the alpha
                return;
            }

            ButtonDispatcher buttonDispatcher = null;
            boolean forceVisible = false;
            if (QuickStepContract.isSwipeUpMode(mNavBarMode)) {
                buttonDispatcher = mNavigationBarView.getBackButton();
            } else if (QuickStepContract.isGesturalMode(mNavBarMode)) {
                forceVisible = mForceNavBarHandleOpaque;
            if (QuickStepContract.isGesturalMode(mNavBarMode)) {
                // Disallow home handle animations when in gestural
                animate = false;
                forceVisible = mAllowForceNavBarHandleOpaque && mForceNavBarHandleOpaque;
                buttonDispatcher = mNavigationBarView.getHomeHandle();
                if (getBarTransitions() != null) {
                    getBarTransitions().setBackgroundOverrideAlpha(alpha);
                }
            } else if (QuickStepContract.isSwipeUpMode(mNavBarMode)) {
                buttonDispatcher = mNavigationBarView.getBackButton();
            }
            if (buttonDispatcher != null) {
                buttonDispatcher.setVisibility(
@@ -506,6 +517,8 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
        // Respect the latest disabled-flags.
        mCommandQueue.recomputeDisableFlags(mDisplayId, false);

        mAllowForceNavBarHandleOpaque = mContext.getResources().getBoolean(
                R.bool.allow_force_nav_bar_handle_opaque);
        mForceNavBarHandleOpaque = DeviceConfig.getBoolean(
                DeviceConfig.NAMESPACE_SYSTEMUI,
                NAV_BAR_HANDLE_FORCE_OPAQUE,
@@ -1468,6 +1481,12 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
    @Override
    public void onNavigationModeChanged(int mode) {
        mNavBarMode = mode;
        if (!QuickStepContract.isGesturalMode(mode)) {
            // Reset the override alpha
            if (getBarTransitions() != null) {
                getBarTransitions().setBackgroundOverrideAlpha(1f);
            }
        }
        updateScreenPinningGestures();

        if (!canShowSecondaryHandle()) {
+18 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.phone.BarTransitions;
import com.android.systemui.statusbar.phone.LightBarTransitionsController;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

@@ -135,6 +136,10 @@ public final class NavigationBarTransitions extends BarTransitions implements
        mBarBackground.setFrame(frame);
    }

    void setBackgroundOverrideAlpha(float alpha) {
        mBarBackground.setOverrideAlpha(alpha);
    }

    @Override
    protected boolean isLightsOut(int mode) {
        return super.isLightsOut(mode) || (mAllowAutoDimWallpaperNotVisible && mAutoDim
@@ -230,4 +235,17 @@ public final class NavigationBarTransitions extends BarTransitions implements
    public void removeDarkIntensityListener(DarkIntensityListener listener) {
        mDarkIntensityListeners.remove(listener);
    }

    public void dump(PrintWriter pw) {
        pw.println("NavigationBarTransitions:");
        pw.println("  mMode: " + getMode());
        pw.println("  mAlwaysOpaque: " + isAlwaysOpaque());
        pw.println("  mAllowAutoDimWallpaperNotVisible: " + mAllowAutoDimWallpaperNotVisible);
        pw.println("  mWallpaperVisible: " + mWallpaperVisible);
        pw.println("  mLightsOut: " + mLightsOut);
        pw.println("  mAutoDim: " + mAutoDim);
        pw.println("  bg overrideAlpha: " + mBarBackground.getOverrideAlpha());
        pw.println("  bg color: " + mBarBackground.getColor());
        pw.println("  bg frame: " + mBarBackground.getFrame());
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -1158,6 +1158,8 @@ public class NavigationBarView extends FrameLayout implements
            int frameHeight = getResources().getDimensionPixelSize(
                    com.android.internal.R.dimen.navigation_bar_frame_height);
            mBarTransitions.setBackgroundFrame(new Rect(0, frameHeight - height, w, h));
        } else {
            mBarTransitions.setBackgroundFrame(null);
        }

        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
@@ -1331,6 +1333,7 @@ public class NavigationBarView extends FrameLayout implements
        if (mNavigationInflaterView != null) {
            mNavigationInflaterView.dump(pw);
        }
        mBarTransitions.dump(pw);
        mContextualButtonGroup.dump(pw);
        mRecentsOnboarding.dump(pw);
        mRegionSamplingHelper.dump(pw);
Loading