Allow to show pinned taskbar when Launcher is visible
This CL allows freeform-first devices to lock the taskbar in a pinned state when Launcher is visible. Bug: 361419732 Flag: com.android.window.flags.enter_desktop_by_default_on_freeform_displays Test: DisplayControllerTest Test: manual Change-Id: Ic0d2740e33fee19c676d88aa2bcf370eb64366e8
This commit is contained in:
1 parent
13ffcc7242
commit
6ddfe9b179
7 files changed
+100
-4
No files matched your search
@@ -194,6 +194,13 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
|
||||
INSTANCE.get(context).handleInfoChange(context.getDisplay());
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles info change for launcher visibility.
|
||||
*/
|
||||
public static void handleInfoChangeForLauncherVisibilityChanged(Context context) {
|
||||
INSTANCE.get(context).handleInfoChange(context.getDisplay());
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables transient taskbar status for tests.
|
||||
*/
|
||||
@@ -217,6 +224,13 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
|
||||
return INSTANCE.get(context).getInfo().isPinnedTaskbar();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the taskbar is forced to be pinned when home is visible.
|
||||
*/
|
||||
public static boolean showLockedTaskbarOnHome(Context context) {
|
||||
return INSTANCE.get(context).getInfo().showLockedTaskbarOnHome();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
mDestroyed = true;
|
||||
@@ -345,7 +359,8 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
|
||||
}
|
||||
if ((newInfo.mIsTaskbarPinned != oldInfo.mIsTaskbarPinned)
|
||||
|| (newInfo.mIsTaskbarPinnedInDesktopMode
|
||||
!= oldInfo.mIsTaskbarPinnedInDesktopMode)) {
|
||||
!= oldInfo.mIsTaskbarPinnedInDesktopMode)
|
||||
|| newInfo.isPinnedTaskbar() != oldInfo.isPinnedTaskbar()) {
|
||||
change |= CHANGE_TASKBAR_PINNING;
|
||||
}
|
||||
if (newInfo.mIsInDesktopMode != oldInfo.mIsInDesktopMode) {
|
||||
@@ -399,6 +414,9 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
|
||||
|
||||
private final boolean mIsInDesktopMode;
|
||||
|
||||
private final boolean mShowLockedTaskbarOnHome;
|
||||
private final boolean mIsHomeVisible;
|
||||
|
||||
public Info(Context displayInfoContext) {
|
||||
/* don't need system overrides for external displays */
|
||||
this(displayInfoContext, new WindowManagerProxy(), new ArrayMap<>());
|
||||
@@ -460,6 +478,8 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
|
||||
mIsTaskbarPinnedInDesktopMode = LauncherPrefs.get(displayInfoContext).get(
|
||||
TASKBAR_PINNING_IN_DESKTOP_MODE);
|
||||
mIsInDesktopMode = wmProxy.isInDesktopMode();
|
||||
mShowLockedTaskbarOnHome = wmProxy.showLockedTaskbarOnHome(displayInfoContext);
|
||||
mIsHomeVisible = wmProxy.isHomeVisible(displayInfoContext);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -476,6 +496,10 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
|
||||
return sTransientTaskbarStatusForTests;
|
||||
}
|
||||
if (enableTaskbarPinning()) {
|
||||
// If Launcher is visible on the freeform display, ensure the taskbar is pinned.
|
||||
if (mShowLockedTaskbarOnHome && mIsHomeVisible) {
|
||||
return false;
|
||||
}
|
||||
if (mIsInDesktopMode) {
|
||||
return !mIsTaskbarPinnedInDesktopMode;
|
||||
}
|
||||
@@ -543,6 +567,13 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
|
||||
return TYPE_PHONE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the taskbar is forced to be pinned when home is visible.
|
||||
*/
|
||||
public boolean showLockedTaskbarOnHome() {
|
||||
return mShowLockedTaskbarOnHome;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user