How to modify display on/off behaviour in non-standard ways (e.g. keep it from ever turning off) Firstly: my phone is rooted, I am not afraid to use the terminal, modify source code and compile everything myself, I can provide logs, command outputs etc etc, I just need someone who knows where to look and what to modify. I will happily add any necessary info you need to help me.

I have recently replaced a broken display on my OnePlus One running LineageOS 15.1 (Android 8). Allegedly it's an original replacement part, but it is buggy. It often (read: most of the time) won't turn on when I press the power button, double-tap the touchscreen or any notification or call comes in. The system does unlock and the touchscreen does work, as I can hear the unlocking sound and interact with buttons whose locations on screen I remember. But the display doesn't light up - only sometimes, randomly. I can't figure out when it does or doesn't. As long as the display doesn't turn off, it will keep working indefinitely. And whenever I shut down and cold reboot the phone, it also immediately works. Since I'm unwilling to do the whole replacement procedure again including spending another 50 bucks on a part that might not even work (the seller conveniently refuses to accept returns after you use parts in DIY repairs), here's my actual question which is actually multiple questions, in order of my preference if I could choose a solution:

Does anyone know if there's different ways the phone tells the display to turn on? How do they differ between bootup and screen unlocking, since the former way reliably works? Can I somehow force my system to ALWAYS use that method, so that I can once again rely on a working display whenever I need it?

Failing that, does anyone know how to stop the display from turning off altogether, except on system shutdown? I'm currently using an app called "Screen  On" that keeps the screen running, dimmed down. But the magnetic flip cover still turns it off, also it means I can't ever lock my screen with the power button because that would also turn it off. I would like my screen to go to Daydream when it normally would turn off.

I would like to be able to use Daydream on battery at all, but the settings menu only offers "when docked" and "when power cable is connected". Using dumpsys I found that there's a variable called "mDreamsEnabledOnBatteryConfig" and I would like to set it to "true" or "1", but 'dumpsys power set mDreams....' simply does nothing (yes, I am root). I also can't find the config file that I would need to edit.

Please refrain from suggesting I buy a new phone or send it in for professional repair.
Using a app called privset you can change the dream settings to work on battery also, search for dream. Additionally, check out tasker, you can hijack the power button to daydream