Merge "wmshell: skip check for DesktopModeStatus" into main
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java
index beae96e..54cf84c 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java
@@ -838,10 +838,12 @@
// Use optional-of-lazy for the dependency that this provider relies on.
// Lazy ensures that this provider will not be the cause the dependency is created
// when it will not be returned due to the condition below.
- if (DesktopModeStatus.isEnabled()) {
- return desktopTasksController.map(Lazy::get);
- }
- return Optional.empty();
+ return desktopTasksController.flatMap((lazy)-> {
+ if (DesktopModeStatus.isEnabled()) {
+ return Optional.of(lazy.get());
+ }
+ return Optional.empty();
+ });
}
@BindsOptionalOf
@@ -855,10 +857,12 @@
// Use optional-of-lazy for the dependency that this provider relies on.
// Lazy ensures that this provider will not be the cause the dependency is created
// when it will not be returned due to the condition below.
- if (DesktopModeStatus.isEnabled()) {
- return desktopModeTaskRepository.map(Lazy::get);
- }
- return Optional.empty();
+ return desktopModeTaskRepository.flatMap((lazy)-> {
+ if (DesktopModeStatus.isEnabled()) {
+ return Optional.of(lazy.get());
+ }
+ return Optional.empty();
+ });
}
//