Small story to tell. Good a place as any.
Decided it was time to upgrade from my 3G to iPhone4, so went to the local AT&T store & picked up a new phone. iOS 4.1 was pre-installed. Set it up initially by restoring from my backup. Immediately had all kinds of trouble with the proximity sensor - constantly triggering touch tones (usually the '3') &/or switching to speaker spontaneously during calls, even though the phone was held firmly (same as always) against my cheek. Not only that but the call quality was terrible - very choppy audio, at times unintelligible, on 75-80% of the calls.
Contacted AppleCare & was advised to Reset All Settings & see if that helped. It didn't.
Contacted AppleCare a couple of days later & they had me go through the process of starting over & setting up the phone as a new device. That didn't help either. Call quality may have been a tad better, but that's it.
On the third call to AppleCare a couple of days later, they advised that there were no other maneuvers to try and they scheduled an appointment for me at my local Apple store to exchange it for a new phone. Same day appointment, no less.
After checking in at the Apple store I explained my circumstances to the 'genius' (though I would have expected him to know the history since AppleCare scheduled my appointment). He proceeded to test the phone's proximity sensor (which I had done numerous times during each step of the process above, each time 'testing' appropriately but without any change in in-call behavior) and pronounced it normal. I explained that the in-call behavior was intermittent and unpredictable but frequent and that I'd done the same testing with the same results. He insisted that the 4.1 software update had 'fixed the problem' and that replacing the phone would not help. Nothing wrong with the phone. Said, basically, that I wasn't having the problem that I had spent 9 days trying to resolve.
I gently explained that he was full of shit, thank you very much (in much more delicate and courteous language, of course), and offered that if that was the case I would need to return the phone & revert to my 3G, which had never had this issue in over 2 years, as it was very annoying and significantly interfering with routine calls, but that I would prefer to try another piece of hardware before giving up on iPhone4. That if this was 'normal' for iPhone4 it had a serious design flaw. He finally, reluctantly and somewhat condescendingly agreed to replace my phone, the reason for my appointment in the first place.
Got home & set up the phone as a new device. Turns out, interestingly, that the second phone is older than the one AT&T gave me as it had iOS 4.0.1 pre-loaded, which iTunes upgraded to 4.1 during setup.
I've had zero problems with the proximity sensor on the new phone, none. And as an added bonus, the call audio quality is dramatically better, crystal clear on virtually every call I've made. So much for 'replacing the phone won't fix it'.
I'm now very happy with my iPhone4. So if any of you encounter similar problems, defective hardware may be part or all of the problem and I would encourage you to be very persistent with Apple.