CyanogenDefy / android_device_motorola_jordan

Motorola Defy MB525 CM7 XDA (jordan)
http://forum.xda-developers.com/showthread.php?t=1065798
80 stars 60 forks source link

Bug with using proximity sensor with plugged headset in sleep mode #123

Closed ncc-1701 closed 12 years ago

ncc-1701 commented 12 years ago

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); }