Use pinned taskbar with desktop tasks on freeform displays

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: I5c1e21799609c28ec44cc190bfc681934907199f
This commit is contained in:
Toni Barzic committed 2025-02-04 13:00:37 -08:00
1 parent 6c19792dcd
commit 860c4ee680
7 files changed
+128 -5

No files matched your search

@@ -220,6 +220,14 @@ public class DisplayController implements ComponentCallbacks,
return INSTANCE.get(context).getInfo().showLockedTaskbarOnHome();
}
/**
* Returns whether desktop taskbar (pinned taskbar that shows desktop tasks) is to be used
* on the display because the display is a freeform display.
*/
public static boolean showDesktopTaskbarForFreeformDisplay(Context context) {
return INSTANCE.get(context).getInfo().showDesktopTaskbarForFreeformDisplay();
}
@Override
public void onDesktopVisibilityChanged(boolean visible) {
notifyConfigChange();
@@ -259,7 +267,9 @@ public class DisplayController implements ComponentCallbacks,
new PortraitSize(config.screenHeightDp, config.screenWidthDp))
|| mWindowContext.getDisplay().getRotation() != mInfo.rotation
|| mWMProxy.showLockedTaskbarOnHome(mWindowContext)
!= mInfo.showLockedTaskbarOnHome()) {
!= mInfo.showLockedTaskbarOnHome()
|| mWMProxy.showDesktopTaskbarForFreeformDisplay(mWindowContext)
!= mInfo.showDesktopTaskbarForFreeformDisplay()) {
notifyConfigChange();
}
}
@@ -376,6 +386,8 @@ public class DisplayController implements ComponentCallbacks,
private final boolean mShowLockedTaskbarOnHome;
private final boolean mIsHomeVisible;
private final boolean mShowDesktopTaskbarForFreeformDisplay;
public Info(Context displayInfoContext) {
/* don't need system overrides for external displays */
this(displayInfoContext, new WindowManagerProxy(), new ArrayMap<>());
@@ -438,6 +450,8 @@ public class DisplayController implements ComponentCallbacks,
TASKBAR_PINNING_IN_DESKTOP_MODE);
mIsInDesktopMode = wmProxy.isInDesktopMode();
mShowLockedTaskbarOnHome = wmProxy.showLockedTaskbarOnHome(displayInfoContext);
mShowDesktopTaskbarForFreeformDisplay = wmProxy.showDesktopTaskbarForFreeformDisplay(
displayInfoContext);
mIsHomeVisible = wmProxy.isHomeVisible(displayInfoContext);
}
@@ -455,6 +469,11 @@ public class DisplayController implements ComponentCallbacks,
return sTransientTaskbarStatusForTests;
}
if (enableTaskbarPinning()) {
// If "freeform" display taskbar is enabled, ensure the taskbar is pinned.
if (mShowDesktopTaskbarForFreeformDisplay) {
return false;
}
// If Launcher is visible on the freeform display, ensure the taskbar is pinned.
if (mShowLockedTaskbarOnHome && mIsHomeVisible) {
return false;
@@ -533,6 +552,14 @@ public class DisplayController implements ComponentCallbacks,
public boolean showLockedTaskbarOnHome() {
return mShowLockedTaskbarOnHome;
}
/**
* Returns whether the taskbar should be pinned, and showing desktop tasks, because the
* display is a "freeform" display.
*/
public boolean showDesktopTaskbarForFreeformDisplay() {
return mShowDesktopTaskbarForFreeformDisplay;
}
}
/**