I have a Xiaomi Redmi Note 9S which has the following behaviour: it works normally until the moment it goes under the sun, then (apparently only) the backlight of the screen is turned off and never turns on again until I restart the smartphone, where it works normally until the very moment it "detects" a bright light like under the sun, then the screen goes black. When this happens, sometimes you can still see the shape of what was on screen, but most times it only goes totally black.
When the screen is black, the telephone keeps working normally (music keeps being played, receives calls, vibration responses keep working, etc...(confirmed it using scrcpy and all is working normally)), only that the backlight is turned off and it keeps totally black. During the night, i.e. with artificial light, the telephone works normally (I was able to replicate the error using a strong flashlight above the telephone, the screen also went black the very moment I turned it on).
What I tried to resolve: restarted many times, disabled every auto brightness (also one that I think is a Xiaomi MIUI only, sunlight detector, something like this) settings that are in the configuration menu, restarted using vol up + power button. Factory reseted the smartphone. Disabled pocket mode before and after factory reset.
Any idea how to proceed? What is killing me is that it seem to be a software issue, like, why the screen don't turn on back after a while, but every time you restart it, or why the phone works all night long (i.e. there no strong light on it)? How to capture the telephone log (logcat perhaps?) and be sure of what is the exact event that is disabling screen? Maybe I can manipulate it to prevent from happening, or to make screen goes back to normal after a while, as I work as a software developer.