Proximity sensors on future iPhones may be more sophisticated than current components. According to the patent titled Proximity sensors with smudge detection capabilities, malfunctions due to dirt on the display can be prevented. Sometimes a smudge on the glass will prevent the proximity sensor from switching the display on. The problem is the sensor believes the iPhone is against the user's head.
While cleaning the screen is the simplest solution, the patent details a method where light is beamed inside the glass of the display. When this light tracks normally (Fig. 5 above) the proximity sensor is expected to work properly. Any deviation from normal, such as a smudge on the glass, causes the light to deviate from this path (Fig. 6). In this case, activation of the proximity sensor can be altered to compensate for the smudge. This can reduce false positives, and keep the display illuminated when the iPhone is not against someone's ear.
iPhone watchers can expect the levels of sophistication in sensors across the board to improve over time. In the meantime, a lens cleaner cloth will keep the proximity sensor working at top capacity.