I believe mi9 in general has problems with sensores. Mine is one of them. I thought it was ok but I started to see many mi9 users starring to complain and decided to test my phone. Screen don't rotate, screen brightness is always on max, screen won't turn off on calls for example.
Using aida64...