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

Commit bc30e25c authored by Tony Wickham's avatar Tony Wickham
Browse files

Hide taskbar icons when recents button is disabled

The idea is that both taskbar icons and recents navigate you to new apps, which we'd want to disable in similar contexts. Hence reusing FLAG_DISABLE_RECENTS.

Test: locally set FLAG_DISABLE_RECENTS=true, ensure taskbar icons don't show up (both in 3 button mode and gesture nav)
Bug: 193183428
Bug: 194990283
Change-Id: I9537f57dc25663151b1414c5260dadb58506fdb0
parent 497a6ad8
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -260,6 +260,13 @@ public class NavbarButtonsViewController {
        return (mState & FLAG_IME_VISIBLE) != 0;
    }

    /**
     * Returns true if the recents (overview) button is disabled
     */
    public boolean isRecentsDisabled() {
        return (mState & FLAG_DISABLE_RECENTS) != 0;
    }

    /**
     * Adds the bounds corresponding to all visible buttons to provided region
     */
+2 −0
Original line number Diff line number Diff line
@@ -236,6 +236,8 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
                systemUiStateFlags, forceUpdate);
        mControllers.taskbarViewController.setImeIsVisible(
                mControllers.navbarButtonsViewController.isImeVisible());
        mControllers.taskbarViewController.setRecentsButtonDisabled(
                mControllers.navbarButtonsViewController.isRecentsDisabled());
        mControllers.taskbarKeyguardController.updateStateForSysuiFlags(systemUiStateFlags);
    }

+11 −1
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@ public class TaskbarViewController {
    public static final int ALPHA_INDEX_IME = 1;
    public static final int ALPHA_INDEX_KEYGUARD = 2;
    public static final int ALPHA_INDEX_STASH = 3;
    public static final int ALPHA_INDEX_RECENTS_DISABLED = 4;
    private static final int NUM_ALPHA_CHANNELS = 5;

    private final TaskbarActivityContext mActivity;
    private final TaskbarView mTaskbarView;
@@ -67,7 +69,7 @@ public class TaskbarViewController {
    public TaskbarViewController(TaskbarActivityContext activity, TaskbarView taskbarView) {
        mActivity = activity;
        mTaskbarView = taskbarView;
        mTaskbarIconAlpha = new MultiValueAlpha(mTaskbarView, 4);
        mTaskbarIconAlpha = new MultiValueAlpha(mTaskbarView, NUM_ALPHA_CHANNELS);
        mTaskbarIconAlpha.setUpdateVisibility(true);
        mModelCallbacks = new TaskbarModelCallbacks(activity, mTaskbarView);
    }
@@ -100,6 +102,14 @@ public class TaskbarViewController {
        mTaskbarView.setTouchesEnabled(!isImeVisible);
    }

    /**
     * Should be called when the recents button is disabled, so we can hide taskbar icons as well.
     */
    public void setRecentsButtonDisabled(boolean isDisabled) {
        // TODO: check TaskbarStashController#supportsStashing(), to stash instead of setting alpha.
        mTaskbarIconAlpha.getProperty(ALPHA_INDEX_RECENTS_DISABLED).setValue(isDisabled ? 0 : 1);
    }

    /**
     * Sets OnClickListener and OnLongClickListener for the given view.
     */