[Galaxy S 4 Q&A, Help & Troubleshooting] divche:
I have i9500. Unrooted with latest OTA update installed (Build XXUBMG1).

I've been having the same problem with proximity sensor. When proximity sensor is enabled during phone calls (both regular calls and Viber calls), the screen is disabled. Also, my screen sometimes remains on during the call until I place it to my ear and sometimes it turns off immediately during the call. It wasn't always like this, but I can't remember when it started happening, but I suspect it was since the last OTA update.

I've searched around online and have noticed several comments.

Apparently this is an issue with several Galaxy models over the years (sorry, I lost the reference) and this thread: http://xdaforums.com/showthread.php?t=2208440&page=2 mentions Galaxy Note 2 and SGS3 having the issue where there is something wrong with the threshold setting in the calibration settings. Mine appears to have the same issue where it always reads 0cm (i.e. always covered). However this thread also suggests a fix to input some code to adjust the calibration if your phone is rooted.

One suggestion is there is a misalignment of the sensor and so it might be partially covered by the phone's front fascia, causing the sensor to always read as covered or "1" or 0cm. But looking carefully at mine, it looks centred dead-on.

This thread http://xdaforums.com/showthread.php?t=2417401 indicates that the sensor is always on as can be seen through a digital camera LCD (but not with your naked eye). I've tried this with my DSLR and confirmed this also happens with mine, even when the option is set to turn it off during calls, and also even when air gesture (which uses the prox sensor) is turned off. Not sure if this affects the problem or not though.

Can't remember where I read this, but someone mentioned that when shining a bright light over the phone, it works. So I downloaded two sensor apps from Google Play: Android Sensor Box, and Proximity Sensor Finder. And also used the inbuilt *#7353* feature. All three report that my proximity sensor is always reading that something is constantly covering it..... EXCEPT when a bright light (the sun works) is shining on the light sensor - not the proximity sensor. I tested this by using a torch on both sensors. When blocking light from the light sensor, the problem persists, but not when I allow the light to shine on the sensor. So it appears that they both act in unison.

Similar issue with air gestures, which used to work when my phone was new, even in relatively ambient light (but obviously not in a dark room), but now doesn't under similar conditions, and again... EXCEPT when a bright light is shining on the light sensor, or when I'm out in the sun.

Anyway, I'm not willing to root my phone at this point, just to try the fix suggested in http://xdaforums.com/showthread.php?t=2208440&page=2 (my phone was bought overseas and returning it wouldn't be convenient for me). And since this wasn't always a problem with my phone, I suspect it is a software problem related to one of the recent OTA updates.

Edit: After further testing, it seems that air gestures use the front camera as well as the light and proximity sensors.