What is this strange screen I'm stuck into; no response to any touch [LineageOS, HCT M8] HTC One M8 with LineageOS 15.0 (custom ROM, has always worked well until now).

Suddenly I only see this screen: 5:37 (the time it got stuck) in cyan dots, and a field of green and white dots (possibly a big battery icon).

Phone doesn't respond to touching touchscreen, or even the hardware buttons. Tried to press Power to turn the phone off, but nothing happens.

I was doing nothing in particular with the phone when or before this happened, just woke it up from sleep and found it in this state.

What is this screen?

How to get out of this?

Could this even be a virus or other malware maybe?
This is a screen corresponding to the HTC Dot View Case - normally you should be seeing this screen through the case's lid when it's closed, so it will provide clock, notification, etc. at a glance. This screen appearing in normal use likely means that your device's Hall (magnetic) sensor, responsible for detecting cover lid status, is malfunctioning.

You should still be able to forcefully reboot - try holding both POWER and VOL_UP simultaneously under adequate lighting (to trigger the ambient light sensor, so it won't think the button combination was mispressed and prevent the reboot). If successful the phone should vibrate then reboot.

If a reboot doesn't remedy the problem, boot into a custom recovery (assuming you're using TWRP). From there mount /system and use the built-in file manager to find and remove an app named FlipFlap inside /system/app or /system/priv-app. That specific app is responsible for displaying the screen you see.

If that still doesn't solve the problem, you either need a LOS build that disables the Hall sensor entirely, or have the device repaired.