// Phone is either idle, or ringing. We don't want any
// special proximity sensor behavior in either case.
if (mProximityWakeLock.isHeld()) {
if (DBG) Log.d(LOG_TAG, "updateProximitySensorMode: releasing...");
// Wait until user has moved the phone away from his head if we are
// releasing due to the phone call ending.
// Qtherwise, turn screen on immediately
int flags =
(screenOnImmediately ? 0 : PowerManager.WAIT_FOR_PROXIMITY_NEGATIVE);
mProximityWakeLock.release(flags); // - in the pocked device haven't to wait to user has moved the phone away from his head if we are
I rebuild with next code (works much better):
// releasing due to the phone call ending.
// Qtherwise, turn screen on immediately
if (mIsHeadsetPlugged == true) mProximityWakeLock.release();
else
{
// if headset is plugged - immediately
int flags = (screenOnImmediately ? 0 : PowerManager.WAIT_FOR_PROXIMITY_NEGATIVE);
mProximityWakeLock.release(flags);
}
If device in pocked and headset is plugged - after end call it steel working even in sleep mode. It too bad for power consumption.
file: packages/apps/Phone/src/com/android/phone/PhoneApp.java function: void updateProximitySensorMode(Phone.State state)
// Phone is either idle, or ringing. We don't want any // special proximity sensor behavior in either case. if (mProximityWakeLock.isHeld()) { if (DBG) Log.d(LOG_TAG, "updateProximitySensorMode: releasing..."); // Wait until user has moved the phone away from his head if we are // releasing due to the phone call ending. // Qtherwise, turn screen on immediately int flags = (screenOnImmediately ? 0 : PowerManager.WAIT_FOR_PROXIMITY_NEGATIVE); mProximityWakeLock.release(flags); // - in the pocked device haven't to wait to user has moved the phone away from his head if we are
I rebuild with next code (works much better):
// releasing due to the phone call ending. // Qtherwise, turn screen on immediately if (mIsHeadsetPlugged == true) mProximityWakeLock.release(); else { // if headset is plugged - immediately
int flags = (screenOnImmediately ? 0 : PowerManager.WAIT_FOR_PROXIMITY_NEGATIVE); mProximityWakeLock.release(flags); }