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

Commit 3f7579cd authored by Brad Hinegardner's avatar Brad Hinegardner Committed by Android (Google) Code Review
Browse files

Merge "Force Now Playing to re-layout after lock icon moves when folding" into main

parents 2bfdc287 a0bbc849
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -219,5 +219,37 @@ constructor(
                sensorRect.left
            )
        }

        // This is only intended to be here until the KeyguardBottomAreaRefactor flag is enabled
        // Without this logic, the lock icon location changes but the KeyguardBottomAreaView is not
        // updated and visible ui layout jank occurs. This is due to AmbientIndicationContainer
        // being in NPVC and laying out prior to the KeyguardRootView.
        // Remove when both DeviceEntryUdfpsRefactor and KeyguardBottomAreaRefactor are enabled.
        if (DeviceEntryUdfpsRefactor.isEnabled && !KeyguardBottomAreaRefactor.isEnabled) {
            with(notificationPanelView) {
                val isUdfpsSupported = deviceEntryIconViewModel.get().isUdfpsSupported.value
                val bottomAreaViewRight = findViewById<View>(R.id.keyguard_bottom_area)?.right ?: 0
                findViewById<View>(R.id.ambient_indication_container)?.let {
                    val (ambientLeft, ambientTop) = it.locationOnScreen
                    if (isUdfpsSupported) {
                        // make top of ambient indication view the bottom of the lock icon
                        it.layout(
                            ambientLeft,
                            sensorRect.bottom,
                            bottomAreaViewRight - ambientLeft,
                            ambientTop + it.measuredHeight
                        )
                    } else {
                        // make bottom of ambient indication view the top of the lock icon
                        it.layout(
                            ambientLeft,
                            sensorRect.top - it.measuredHeight,
                            bottomAreaViewRight - ambientLeft,
                            sensorRect.top
                        )
                    }
                }
            }
        }
    }
}