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

This commit is contained in:
Jagrut Desai
2023-06-09 18:50:52 +00:00
committed by Android (Google) Code Review
2 changed files with 20 additions and 11 deletions

View File

@@ -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,18 +88,21 @@ public class TaskbarAutohideSuspendController implements
boolean isSuspended = isSuspended();
mSystemUiProxy.notifyTaskbarAutohideSuspend(isSuspended);
mActivity.onTransientAutohideSuspendFlagChanged(isSuspended);
mActivity.onTransientAutohideSuspendFlagChanged(isTransientTaskbarStashingSuspended());
}
/**
* Returns true iff taskbar autohide is currently suspended.
* Returns true iff taskbar autohide is currently suspended for immersive mode.
*/
public boolean isSuspended() {
private boolean isSuspended() {
return mAutohideSuspendFlags != 0;
}
public boolean isSuspendedForTransientTaskbarInOverview() {
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
@@ -115,6 +121,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();
}
}

View File

@@ -508,10 +508,8 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
return;
}
if (stash && mControllers.taskbarAutohideSuspendController.isSuspended()
&& !mControllers.taskbarAutohideSuspendController
.isSuspendedForTransientTaskbarInOverview()) {
// Avoid stashing if autohide is currently suspended.
if (stash && mControllers.taskbarAutohideSuspendController
.isTransientTaskbarStashingSuspended()) {
return;
}
@@ -1038,6 +1036,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));
}
}
@@ -1130,7 +1131,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
}
private void onTaskbarTimeout(Alarm alarm) {
if (mControllers.taskbarAutohideSuspendController.isSuspended()) {
if (mControllers.taskbarAutohideSuspendController.isTransientTaskbarStashingSuspended()) {
return;
}
updateAndAnimateTransientTaskbar(true);