[CD Taskbar] Move DisplayController method calls to BaseTaskbarContext

To ensure consistent, controllable Taskbar in Connected Displays Behavior, move all independent calls to the singleton DisplayController's various methods into one place in BaseTaskbarContext, where we have access to the parent context and can override default behaviors of these methods throughout taskbar if in external display.

Flag: EXEMPT not adding new behavior
Bug: 401553128
Test: m
Change-Id: If9efc0cfc18bac3ee75bb64bf5280ea979d1faa2
This commit is contained in:
Sukesh Ram committed 2025-03-17 03:15:45 -07:00
1 parent 3a4595c207
commit 16e04e84eb
12 files changed
+138 -55

No files matched your search

@@ -405,9 +405,41 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
dispatchDeviceProfileChanged();
}
/** Returns whether current taskbar is transient. */
@Override
public boolean isTransientTaskbar() {
return super.isTransientTaskbar() && !isPhoneMode();
return DisplayController.isTransientTaskbar(this) && mIsPrimaryDisplay && !isPhoneMode();
}
@Override
public boolean isPinnedTaskbar() {
return DisplayController.isPinnedTaskbar(this);
}
@Override
public NavigationMode getNavigationMode() {
return isPrimaryDisplay() ? DisplayController.getNavigationMode(this)
: NavigationMode.THREE_BUTTONS;
}
@Override
public boolean isInDesktopMode() {
return mControllers != null
&& mControllers.taskbarDesktopModeController.isInDesktopMode(getDisplayId());
}
@Override
public boolean showLockedTaskbarOnHome() {
return DisplayController.showLockedTaskbarOnHome(this);
}
@Override
public boolean showDesktopTaskbarForFreeformDisplay() {
return DisplayController.showDesktopTaskbarForFreeformDisplay(this);
}
@Override
public boolean isPrimaryDisplay() {
return mIsPrimaryDisplay;
}
/**
@@ -443,9 +475,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
.setIsTransientTaskbar(true)
.build();
}
mNavMode = (DesktopExperienceFlags.ENABLE_TASKBAR_CONNECTED_DISPLAYS.isTrue()
&& !mIsPrimaryDisplay) ? NavigationMode.THREE_BUTTONS
: DisplayController.getNavigationMode(this);
mNavMode = getNavigationMode();
}
/** Called when the visibility of the bubble bar changed. */
@@ -1338,11 +1368,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
mControllers.uiController.startSplitSelection(splitSelectSource);
}
boolean isInDesktopMode() {
return mControllers != null
&& mControllers.taskbarDesktopModeController.isInDesktopMode(getDisplayId());
}
protected void onTaskbarIconClicked(View view) {
TaskbarUIController taskbarUIController = mControllers.uiController;
RecentsView recents = taskbarUIController.getRecentsView();