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

Commit a0bbc849 authored by Brad Hinegardner's avatar Brad Hinegardner
Browse files

Force Now Playing to re-layout after lock icon moves when folding

With DeviceEntryUdfpsRefactor ON and KeyguardBottomAreaRefactor OFF,
now playing is not able to constrain off of the lock icon at the correct
time, which allowed for the possibility of layout timing issue.

Once the constraints are set on the lock icon, we will now re-layout the
ambient indication container (now playing).

This temporary solution will be removed once the
KeyguardBottomAreaRefactor flag is enabled.

Fixes: 340566200
Test: manual - activate now playing on foldable, unfold and re-fold
Flag: com.android.systemui.device_entry_udfps_refactor
Change-Id: I22e238843dd62ff0281c9b73ff1accb7065fe5a6
parent 2dc7b8b3
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
                        )
                    }
                }
            }
        }
    }
}