

You’re thinking of the gyroscope, but no. Some phones have a dedicated proximity sensor for things like detecting if you’re in a call and have the phone up to your ear, but more and more phones (especially the budget ones) these days use a “virtual” proximity sensor which utilizes the front camera to perform the same function.
~~Not always. More and more phones in the budget range utilize a “virtual” proximity sensor which actually uses the camera for the same function.~~