I have the same issue that seemed to only happen after the last mini-update to the S4.
In any event, blowing hard into the earpiece did not work.
I looked at the sensor, and it looked fine.
I then dialed *#0*# to get to the diagnostic mode, and clicked on SENSOR.
I then watched the sensor value change from around 75 (with nothing near it) to 255 (max) when I had my hand up to it.
SO, this leads me to believe that the sensor DOES in fact work - it SEES my HAND.
Did the last mini-SW-update screw something up ?
This is very annoying, as whenever I make a call, the screen immediately turns off.
I have to click the center button to turn on the display to enter digits, end the call, etc.
The proximity sensor won't function properly in a call.
I then googled this issue some more and came across this link:
http://forum.xda-developers.com/showthread.php?t=2684507
The ONE thing that made me consider what was suggested in the post was to install a FREE app called "Proximity Sensor Finder".
Even though the diagnostics I ran (*#0*#) seemed to show that the sensor was indeed seeing my hand moving closer/away from it - this APP showed me that it was in fact NOT working properly.
(The app will show you an 8.0 when nothing is in front of it, then 0.0 when sensor is covered - BUT, it should go immediately BACK to 8.0 when you remove your finger from the sensor. My S4 did not go back to 8.0, it actually stayed at 0.0.)
This, and only this convinced me that I really needed to take the phone apart and "clean" the proximity sensor and lens holes.
Basically, if you follow the link - it explained how to disassemble the S4, and how to clean out the sensor, and the chassis/body of the proximity sensor.
I was hesitant to do this - not being comfortable taking apart such a delicate piece of technology, but the instructions, (and video) were extremely helpful and made it easy. (thanks Internet and Youtube !)
In any event, once I had it all apart, and I had the sensor out - I looked at it and it honestly looked clean, but I cleaned it with a Q-tip and blew air on it just in case.
The real issue was the (inside) of the chassis / display lens holes for the sensor, etc.
I did not see any dust or debris, but what I DID see looked like a waxy film which was coating the inside of the lens holes of the display.
I could not see that when the phone was assembled (it honestly looked clean to me from the outside).
This explains why simply blowing air into the earphone (with the phone still assembled) did NOT work for me.
It wasn't dust/debris, but some dirty "coating" that would (never) be able to be removed by just blowing air on it.
So, I cleaned all that with the Q-tip, put it all back together and fired it up.
Low and behold, it now WORKS like it used to !!!
I am SO glad I found that link (see above) and followed the instructions and had the guts to take the phone apart - since blowing air into it would never have worked.
I write this in the hope that it may convince others with this issue to take the leap and take the phone apart to clean the affected parts - as there will be NO other way to fix it other than this.
What bothers me the most about this is the fact that this can even happen in the first place, and that I'll probably have to do it again when it gets "gummed up" in there in a few weeks/months, etc...
I would not have thought that the proximity sensor would be THAT sensitive/finicky that a bit of dirt, dust, film, whatever would cause it to not work properly.
Perhaps the most recent update that Samsung did to the phone changed a sensitivity parameter - basically making the proximity sensor not work as originally engineered. I say this because I could swear that this problem ONLY happened after doing the last system update about a month ago.
Model sgh-i337m
Android version 4.4.2
Kernel version 3.4.0-1529758 thu may 1 23:08:25 KST 2014
Build Number K0T49H.i337mvlufne1