Avoid some unnecessary taskbar recreations

Skips recreate taskbar calls for desktop taskbar on freeform display
feature. When the feature is enabled, the taskbar will be consistent on
freeform displays across different UI states. This means that changes in
launcher visibility, and desktop mode will not expected to change the
flavour of taskbar used on the display, making taskbar recreation
unnecessary in those cases.

Bug: 390665752
Flag: com.android.window.flags.enable_desktop_taskbar_on_freeform_displays
Test: manual on desktop device. verify correct taskbar is shown
      on home screen, in overview, in desktop mode, with fullscreen
      app shown. Verify opening/launching apps from taskbar works
      as expected.

Change-Id: Ib679aa27afc1087226f05d0e914bfe6ff67bd24b
This commit is contained in:
Toni Barzic
2025-03-18 17:56:14 +00:00
parent 21c065ae3d
commit fd39b428f9
2 changed files with 9 additions and 4 deletions
@@ -224,8 +224,10 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
*/
@Override
public void onLauncherVisibilityChanged(boolean isVisible) {
final TaskbarActivityContext taskbarContext = mControllers.taskbarActivityContext;
if (DesktopModeStatus.enterDesktopByDefaultOnFreeformDisplay(mLauncher)
&& mControllers.taskbarActivityContext.isPrimaryDisplay()) {
&& !taskbarContext.showDesktopTaskbarForFreeformDisplay()
&& taskbarContext.isPrimaryDisplay()) {
DisplayController.INSTANCE.get(mLauncher).notifyConfigChange();
}
@@ -230,7 +230,8 @@ public class TaskbarManager implements DisplayDecorationListener {
}
// Only Handles Special Exit Cases for Desktop Mode Taskbar Recreation.
if (((flags & CHANGE_TASKBAR_PINNING) != 0) || (taskbarActivityContext != null
&& !taskbarActivityContext.showLockedTaskbarOnHome())) {
&& !taskbarActivityContext.showLockedTaskbarOnHome()
&& !taskbarActivityContext.showDesktopTaskbarForFreeformDisplay())) {
recreateTaskbars();
}
} else {
@@ -324,7 +325,8 @@ public class TaskbarManager implements DisplayDecorationListener {
TaskbarActivityContext taskbarActivityContext = getTaskbarForDisplay(
displayId);
if (taskbarActivityContext != null
&& !taskbarActivityContext.isInOverview()) {
&& !taskbarActivityContext.isInOverview()
&& !taskbarActivityContext.showDesktopTaskbarForFreeformDisplay()) {
mShouldIgnoreNextDesktopModeChangeFromDisplayController = true;
AnimatorSet animatorSet = taskbarActivityContext.onDestroyAnimation(
TASKBAR_DESTROY_DURATION);
@@ -347,7 +349,8 @@ public class TaskbarManager implements DisplayDecorationListener {
TaskbarActivityContext taskbarActivityContext = getTaskbarForDisplay(
displayId);
if (taskbarActivityContext != null) {
if (taskbarActivityContext != null
&& !taskbarActivityContext.showDesktopTaskbarForFreeformDisplay()) {
mShouldIgnoreNextDesktopModeChangeFromDisplayController = true;
AnimatorSet animatorSet = taskbarActivityContext.onDestroyAnimation(
TASKBAR_DESTROY_DURATION);