1156 * @param state current state of the phone (see {@link Phone#State})
1157 */
1158 /* package */ void updateProximitySensorMode(Phone.State state) {
1159 if (VDBG) Log.d(LOG_TAG, "updateProximitySensorMode: state = " + state);
1160
1161 if (proximitySensorModeEnabled()) {
1162 synchronized (mProximityWakeLock) {
1163 // turn proximity sensor off and turn screen on immediately if
1164 // we are using a headset, the keyboard is open, or the device
1165 // is being held in a horizontal position.
1166 boolean screenOnImmediately = (isHeadsetPlugged()
1167 || PhoneUtils.isSpeakerOn(this)
1168 || ((mBtHandsfree != null) && mBtHandsfree.isAudioOn())
1169 || mIsHardKeyboardOpen
1170 || mOrientation == AccelerometerListener.ORIENTATION_HORIZONTAL);
1171