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

Unverified Commit b16a042f authored by LuK1337's avatar LuK1337 Committed by Michael Bestas
Browse files

fixup! SystemUI: Add API for runtime taskbar config

Reason: QPR2 reworked this code, doesn't apply easily

Change-Id: Ib14c9bed1518be213ab86eecc45ae9690ab49a6c
parent bb2d9970
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -67,10 +67,6 @@ public interface NavigationBarController {

    boolean isOverviewEnabled(int displayId);

    private boolean shouldShowTaskbar() {
        return mTaskbarShowing;
    }

    /** @return {@link NavigationBar} on the default display. */
    @Nullable
    NavigationBar getDefaultNavigationBar();
+21 −9
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_FLOATIN
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_GESTURE;
import static android.provider.Settings.Secure.ACCESSIBILITY_BUTTON_MODE_NAVIGATION_BAR;
import static com.android.systemui.navigationbar.gestural.EdgeBackGestureHandler.DEBUG_MISSING_GESTURE_TAG;
import static com.android.systemui.shared.recents.utilities.Utilities.isLargeScreen;
import static com.android.wm.shell.Flags.enableTaskbarNavbarUnification;

import android.content.Context;
@@ -76,6 +75,7 @@ import javax.inject.Inject;
public class NavigationBarControllerImpl implements
        ConfigurationController.ConfigurationListener,
        NavigationModeController.ModeChangedListener,
        OverviewProxyService.OverviewProxyListener,
        Dumpable, NavigationBarController {

    private static final String TAG = NavigationBarControllerImpl.class.getSimpleName();
@@ -89,7 +89,7 @@ public class NavigationBarControllerImpl implements
    private final TaskbarDelegate mTaskbarDelegate;
    private final NavBarHelper mNavBarHelper;
    private int mNavMode;
    @VisibleForTesting boolean mIsLargeScreen;
    @VisibleForTesting boolean mTaskbarShowing;

    /** A displayId - nav bar maps. */
    @VisibleForTesting
@@ -138,16 +138,15 @@ public class NavigationBarControllerImpl implements
                navBarHelper, navigationModeController, sysUiFlagsContainer,
                dumpManager, autoHideController, lightBarController, pipOptional,
                backAnimation.orElse(null), taskStackChangeListeners);
        mIsLargeScreen = isLargeScreen(mContext);
        overviewProxyService.addCallback(this);
        dumpManager.registerDumpable(this);
    }

    @Override
    public void onConfigChanged(Configuration newConfig) {
        boolean isOldConfigLargeScreen = mIsLargeScreen;
        mIsLargeScreen = isLargeScreen(mContext);
        boolean oldShouldShowTaskbar = shouldShowTaskbar();
        boolean willApplyConfig = mConfigChanges.applyNewConfig(mContext.getResources());
        boolean largeScreenChanged = mIsLargeScreen != isOldConfigLargeScreen;
        boolean largeScreenChanged = shouldShowTaskbar() != oldShouldShowTaskbar;
        // TODO(b/243765256): Disable this logging once b/243765256 is fixed.
        Log.i(DEBUG_MISSING_GESTURE_TAG, "NavbarController: newConfig=" + newConfig
                + " mTaskbarDelegate initialized=" + mTaskbarDelegate.isInitialized()
@@ -196,6 +195,16 @@ public class NavigationBarControllerImpl implements
        });
    }

    @Override
    public void onTaskbarEnabled(boolean enabled) {
        boolean oldShouldShowTaskbar = shouldShowTaskbar();
        mTaskbarShowing = enabled;
        boolean largeScreenChanged = shouldShowTaskbar() != oldShouldShowTaskbar;
        if (largeScreenChanged) {
            updateNavbarForTaskbar();
        }
    }

    private void updateAccessibilityButtonModeIfNeeded() {
        final int mode = mSecureSettings.getIntForUser(
                Settings.Secure.ACCESSIBILITY_BUTTON_MODE,
@@ -254,7 +263,7 @@ public class NavigationBarControllerImpl implements
    /** @return {@code true} if taskbar is enabled, false otherwise */
    private boolean initializeTaskbarIfNecessary() {
        // Enable for large screens or (phone AND flag is set); assuming phone = !mIsLargeScreen
        boolean taskbarEnabled = (mIsLargeScreen || enableTaskbarNavbarUnification())
        boolean taskbarEnabled = (shouldShowTaskbar() || enableTaskbarNavbarUnification())
                && shouldCreateNavBarAndTaskBar(mContext.getDisplayId());

        if (taskbarEnabled) {
@@ -284,7 +293,6 @@ public class NavigationBarControllerImpl implements
        @Override
        public void onDisplayReady(int displayId) {
            Display display = mDisplayManager.getDisplay(displayId);
            mIsLargeScreen = isLargeScreen(mContext);
            createNavigationBar(display, null /* savedState */, null /* result */);
        }

@@ -479,6 +487,10 @@ public class NavigationBarControllerImpl implements
        }
    }

    private boolean shouldShowTaskbar() {
        return mTaskbarShowing;
    }

    @Override
    @Nullable
    public NavigationBar getDefaultNavigationBar() {
@@ -488,7 +500,7 @@ public class NavigationBarControllerImpl implements
    @NeverCompile
    @Override
    public void dump(@NonNull PrintWriter pw, @NonNull String[] args) {
        pw.println("mIsLargeScreen=" + mIsLargeScreen);
        pw.println("mTaskbarShowing=" + mTaskbarShowing);
        pw.println("mNavMode=" + mNavMode);
        for (int i = 0; i < mNavigationBars.size(); i++) {
            if (i > 0) {