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

Commit 9f566dec authored by Jagrut Desai's avatar Jagrut Desai Committed by Android (Google) Code Review
Browse files

Merge "Suspend immersive mode autohide while pending transient taskbar timeout" into udc-dev

parents 84921778 68ca9743
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -41,8 +41,10 @@ public class TaskbarAutohideSuspendController implements
    public static final int FLAG_AUTOHIDE_SUSPEND_TOUCHING = 1 << 2;
    // Taskbar EDU overlay is open above the Taskbar. */
    public static final int FLAG_AUTOHIDE_SUSPEND_EDU_OPEN = 1 << 3;
    // Taskbar in immersive mode in overview
    // Taskbar is in immersive mode in overview
    public static final int FLAG_AUTOHIDE_SUSPEND_IN_LAUNCHER = 1 << 4;
    // Transient Taskbar is temporarily unstashed (pending a timeout).
    public static final int FLAG_AUTOHIDE_SUSPEND_TRANSIENT_TASKBAR = 1 << 5;

    @IntDef(flag = true, value = {
            FLAG_AUTOHIDE_SUSPEND_FULLSCREEN,
@@ -50,6 +52,7 @@ public class TaskbarAutohideSuspendController implements
            FLAG_AUTOHIDE_SUSPEND_TOUCHING,
            FLAG_AUTOHIDE_SUSPEND_EDU_OPEN,
            FLAG_AUTOHIDE_SUSPEND_IN_LAUNCHER,
            FLAG_AUTOHIDE_SUSPEND_TRANSIENT_TASKBAR,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface AutohideSuspendFlag {}
@@ -85,20 +88,30 @@ public class TaskbarAutohideSuspendController implements

        boolean isSuspended = isSuspended();
        mSystemUiProxy.notifyTaskbarAutohideSuspend(isSuspended);
        mActivity.onTransientAutohideSuspendFlagChanged(isSuspended);
        mActivity.onTransientAutohideSuspendFlagChanged(isTransientTaskbarStashingSuspended());
    }

    /**
     * Returns true iff taskbar autohide is currently suspended.
     */
    public boolean isSuspended() {
    private boolean isSuspended() {
        return mAutohideSuspendFlags != 0;
    }

    public boolean isSuspendedForTransientTaskbarInOverview() {
    /**
     * Returns whether Transient Taskbar should avoid auto-stashing in Launcher(Overview).
     */
    public boolean isSuspendedForTransientTaskbarInLauncher() {
        return (mAutohideSuspendFlags & FLAG_AUTOHIDE_SUSPEND_IN_LAUNCHER) != 0;
    }

    /**
     * Returns whether Transient Taskbar should avoid auto-stashing.
     */
    public boolean isTransientTaskbarStashingSuspended() {
        return (mAutohideSuspendFlags & ~FLAG_AUTOHIDE_SUSPEND_TRANSIENT_TASKBAR) != 0;
    }

    @Override
    public void dumpLogs(String prefix, PrintWriter pw) {
        pw.println(prefix + "TaskbarAutohideSuspendController:");
@@ -115,6 +128,8 @@ public class TaskbarAutohideSuspendController implements
        appendFlag(str, flags, FLAG_AUTOHIDE_SUSPEND_EDU_OPEN, "FLAG_AUTOHIDE_SUSPEND_EDU_OPEN");
        appendFlag(str, flags, FLAG_AUTOHIDE_SUSPEND_IN_LAUNCHER,
                "FLAG_AUTOHIDE_SUSPEND_IN_LAUNCHER");
        appendFlag(str, flags, FLAG_AUTOHIDE_SUSPEND_TRANSIENT_TASKBAR,
                "FLAG_AUTOHIDE_SUSPEND_TRANSIENT_TASKBAR");
        return str.toString();
    }
}
+9 −3
Original line number Diff line number Diff line
@@ -511,9 +511,12 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
            return;
        }

        if (stash && mControllers.taskbarAutohideSuspendController.isSuspended()
        if (
                stash
                && !mControllers.taskbarAutohideSuspendController
                .isSuspendedForTransientTaskbarInOverview()) {
                .isSuspendedForTransientTaskbarInLauncher()
                && mControllers.taskbarAutohideSuspendController
                .isTransientTaskbarStashingSuspended()) {
            // Avoid stashing if autohide is currently suspended.
            return;
        }
@@ -1046,6 +1049,9 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
            mActivity.getStatsLogManager().logger().log(hasAnyFlag(FLAG_STASHED_IN_APP_AUTO)
                    ? LAUNCHER_TRANSIENT_TASKBAR_HIDE
                    : LAUNCHER_TRANSIENT_TASKBAR_SHOW);
            mControllers.taskbarAutohideSuspendController.updateFlag(
                    TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_TRANSIENT_TASKBAR,
                    !hasAnyFlag(FLAG_STASHED_IN_APP_AUTO));
        }
    }

@@ -1138,7 +1144,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
    }

    private void onTaskbarTimeout(Alarm alarm) {
        if (mControllers.taskbarAutohideSuspendController.isSuspended()) {
        if (mControllers.taskbarAutohideSuspendController.isTransientTaskbarStashingSuspended()) {
            return;
        }
        updateAndAnimateTransientTaskbar(true);