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

Commit c6b184f2 authored by Will Osborn's avatar Will Osborn
Browse files

Better null safety in DesktopStateImpl

Bug: 423497193
Test: look at logs
Flag: EXEMPT bugfix

Change-Id: I270effaa4fdda75cdcc08af1bb683dfb6b375f87
parent 5a480c2d
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -108,11 +108,11 @@ class DesktopStateImpl(context: Context) : DesktopState {
                && isDesktopModeSupportedOnDisplay(display)

    override fun isMultipleDesktopFrontendEnabledOnDisplay(displayId: Int): Boolean =
        displayManager.getDisplay(displayId)?.let { isMultipleDesktopFrontendEnabledOnDisplay(it) }
        displayManager?.getDisplay(displayId)?.let { isMultipleDesktopFrontendEnabledOnDisplay(it) }
            ?: false

    override fun isDesktopModeSupportedOnDisplay(displayId: Int): Boolean =
        displayManager.getDisplay(displayId)?.let { isDesktopModeSupportedOnDisplay(it) } ?: false
        displayManager?.getDisplay(displayId)?.let { isDesktopModeSupportedOnDisplay(it) } ?: false

    override fun isDesktopModeSupportedOnDisplay(display: Display): Boolean {
        if (!canEnterDesktopMode) return false
@@ -131,13 +131,13 @@ class DesktopStateImpl(context: Context) : DesktopState {
            return false
        }

        return displayManager.displays
        return displayManager?.displays
            ?.any { display -> isDesktopModeSupportedOnDisplay(display)
            } ?: false
    }

    private val deviceHasLargeScreen =
        displayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED)
        displayManager?.getDisplays(DisplayManager.DISPLAY_CATEGORY_ALL_INCLUDING_DISABLED)
            ?.filter { display -> display.type == Display.TYPE_INTERNAL }
            ?.any { display ->
                display.minSizeDimensionDp >= WindowManager.LARGE_SCREEN_SMALLEST_SCREEN_WIDTH_DP