iPhone Proximity Sensor Mystified

Apparently my buddies and I missed it when Steve Jobs showed off the proximity sensor during the unveiling of the iPhone 3G, because we recently spent about 30 minutes sitting around the table at a bar trying to figure out how the hell the iPhone turned off the display when the phone approached your ear.

Rather than googling for the answer, we took turns making conjectures at how it may work. Summary of the dialog follows. (Names have been changed to protect the innocent.) 

Warning: Reading on will rob you of a few minutes of your life that you’ll never get back.

Mr. Red: Ambient Noise.
Mr. Pink: What?
Mr. Red: The iPhone detects ambient noise in the room, and as you move it closer to your ear the ambient noise becomes less audible, and the iPhone shuts the display.

Mr. Pink: There’s a temperature sensor built in, and as it detects to warmth from your face, the display turns off.

Mr. Yellow: SONAR!

Mr. Black: Infrared Light.
Mr. Yellow: Yeah right, that’s almost as ludicrous as SONAR.
Mr. Black: It just detects quick movement (…starts shaking phone rapidly with no effect.)

I believe in the end we decided to google it. Apparently there is an infrared sensor built in right around the speaker. Conversation then moved on to which gym class games we missed the most. Nominated contests included kickball, dodgeball, speedball, kill the man with the ball, smear the queer, running bases, pickel, parachute, ambulence, tennis baseball, and others.