[tetris] Lockscreen freeze root cause identified - UdfpsController race condition

Following up on this locked thread and GitLab issue #8521.

After digging into the android_frameworks_base source I believe I’ve identified the specific race condition causing the lockscreen
freeze on CMF Phone 1.

Root cause:

dispatchOnUiReady() schedules a 50ms delayed callback via mHandler.postDelayed() to enable HBM (high brightness mode) on the panel
sysfs node. If the finger lifts before that 50ms elapses, onFingerUp() runs — writes HBM “off” and tears down the overlay. Then
50ms later the delayed callback fires anyway and writes HBM “on”, leaving the display driver in an inconsistent state → full
freeze.

The December 2024 fix (d28bdd8c) addressed the Goodix HAL double-acquire but didn’t cancel this pending callback. That’s why
freezes reduced but didn’t stop entirely on later builds.

Fix:

One line in UdfpsController.java, in onFingerUp() before the sysfs write:

mHandler.removeCallbacksAndMessages(null);

Status: Currently testing via LSPosed hook on e/OS 3.5-a14-20260211580870 on my CMF Phone 1. Hook is confirmed active. Will report
back after a few days.

If it holds I’ll submit a proper MR to android_frameworks_base. Would appreciate if someone with GitLab access could flag this on
issue #8521.

1 Like

Finally! This is the killer bug that always teases me on the least favorable moment….

Hope to see the effect of your finding soon.

Update: Been running the hook for a few days now with no freezes. Stress tested by lifting my finger quickly and repeatedly to force the race condition, the hook is firing with no errors
in the logs. I am optimistic this was the issue but will keep monitoring over the next few days before calling it fixed and submitting the MR.

Sadly it locked up on me once, it was first time in almost a week. So not sure if fix helped or not will have to dig into it more. Just updated to 3.6 so will work from that.