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

Commit de271b5d authored by Fabian Kozynski's avatar Fabian Kozynski Committed by Android (Google) Code Review
Browse files

Merge "Prevent duplicate config change in ComposeView" into main

parents 68974fd2 49a27b27
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1196,6 +1196,8 @@ private class FrameLayoutTouchPassthrough(
    private val isInBottomReservedArea: (Float, Float) -> Boolean,
) : FrameLayout(context) {

    private val lastConfig = Configuration(context.resources.configuration)

    init {
        repeatWhenAttached {
            repeatOnLifecycle(Lifecycle.State.STARTED) {
@@ -1336,6 +1338,12 @@ private class FrameLayoutTouchPassthrough(
        return super.onTouchEvent(event)
    }

    override fun dispatchConfigurationChanged(newConfig: Configuration) {
        if (lastConfig.updateFrom(newConfig) != 0) {
            super.dispatchConfigurationChanged(newConfig)
        }
    }

    override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
        // If there's a touch on this view and we can scroll down, we don't want to be intercepted
        val action = ev.actionMasked