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

Commit b669a46c authored by Alejandro Nijamkin's avatar Alejandro Nijamkin
Browse files

[flexiglass] Fixes crashloop in LockscreenScene.

Not sure what had changed, but it looks like LockscreenScene produces an
IAE when attempting to find the views in KeyguardRootView early on. Moving these to happen later fixes the problem.

Bug: 280879610
Test: it no longer crashloops when Compose + Flexiglass is on.
Change-Id: I241ca6bc95f7664a0c4fd6130484a271d0590ef2
parent 7ee8e80f
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -102,17 +102,19 @@ private fun LockscreenScene(
    longPressViewModel: KeyguardLongPressViewModel,
    modifier: Modifier = Modifier,
) {
    var settingsMenu: View? = null
    fun findSettingsMenu(): View {
        return viewProvider().requireViewById(R.id.keyguard_settings_button)
    }

    Box(
        modifier = modifier,
    ) {
        LongPressSurface(
            viewModel = longPressViewModel,
            isSettingsMenuVisible = { settingsMenu?.isVisible == true },
            isSettingsMenuVisible = { findSettingsMenu().isVisible },
            settingsMenuBounds = {
                val bounds = android.graphics.Rect()
                settingsMenu?.getHitRect(bounds)
                findSettingsMenu().getHitRect(bounds)
                bounds.toComposeRect()
            },
            modifier = Modifier.fillMaxSize(),
@@ -124,12 +126,8 @@ private fun LockscreenScene(
                // Remove the KeyguardRootView from any parent it might already have in legacy code
                // just in case (a view can't have two parents).
                (keyguardRootView.parent as? ViewGroup)?.removeView(keyguardRootView)
                settingsMenu = keyguardRootView.requireViewById(R.id.keyguard_settings_button)
                keyguardRootView
            },
            update = { keyguardRootView ->
                keyguardRootView.requireViewById<View>(R.id.lock_icon_view)
            },
            modifier = Modifier.fillMaxSize(),
        )
    }