Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 885afbc9 authored by Yifei Zhang's avatar Yifei Zhang
Browse files

wmshell: skip check for DesktopModeStatus

- Skip unncessary check if Optional<Lazy>.get will yield NPE
- No behavior change

Flag: NA
Bug: 308819157
Test: build
Change-Id: I8a4ab3634dc33c5234d0a10538572c202b5a5818
parent 0197306a
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -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.
        return desktopTasksController.flatMap((lazy)-> {
            if (DesktopModeStatus.isEnabled()) {
            return desktopTasksController.map(Lazy::get);
                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.
        return desktopModeTaskRepository.flatMap((lazy)-> {
            if (DesktopModeStatus.isEnabled()) {
            return desktopModeTaskRepository.map(Lazy::get);
                return Optional.of(lazy.get());
            }
            return Optional.empty();
        });
    }

    //