diff options
author | 2023-11-07 23:09:06 +0000 | |
---|---|---|
committer | 2023-11-07 23:09:06 +0000 | |
commit | 29e125bc25bd6fac44df6d9bbaf9152ad4a99b3e (patch) | |
tree | 6416339060310cbc5dba3085b6180c5d9d7500a5 | |
parent | 10614f6487059a631cda474e820a6e6ff33e208d (diff) | |
parent | 885afbc9f995d3c7661d4cc255968da63239a904 (diff) |
Merge "wmshell: skip check for DesktopModeStatus" into main
-rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java | 20 |
1 files changed, 12 insertions, 8 deletions
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 beae96ec3f3b..54cf84c32276 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 @@ public abstract class WMShellBaseModule { // 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 @@ public abstract class WMShellBaseModule { // 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(); + }); } // |