diff options
author | Mike Lockwood <lockwood@android.com> | 2009-10-22 13:14:31 -0400 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2009-10-22 13:14:31 -0400 |
commit | 146ef723bc0fc87aba00400196a5e64ab128ee17 (patch) | |
tree | 91eb5af2cec3f5af82bce3e4e2b2b86729f6d6bc | |
parent | d6adf0ae620ca3b64eee38cd53aaeedb7bd98457 (diff) | |
download | base-146ef723bc0fc87aba00400196a5e64ab128ee17.tar.gz |
When phone is ringing, power button should hang up phone in addition to turning off the screen.
Fixes bug b/2201585 (Pressing power button when phone ringing should mute ringer)
Change-Id: Ief3e26044f9b0ceaf41c5dc6be52f0d1e9897810
Signed-off-by: Mike Lockwood <lockwood@android.com>
-rwxr-xr-x | phone/com/android/internal/policy/impl/PhoneWindowManager.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/phone/com/android/internal/policy/impl/PhoneWindowManager.java b/phone/com/android/internal/policy/impl/PhoneWindowManager.java index d376341..135dc83 100755 --- a/phone/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/phone/com/android/internal/policy/impl/PhoneWindowManager.java @@ -1686,19 +1686,22 @@ public class PhoneWindowManager implements WindowManagerPolicy { // key repeats are generated by the window manager, and we don't see them // here, so unless the driver is doing something it shouldn't be, we know // this is the real press event. - if (code == KeyEvent.KEYCODE_ENDCALL) { + ITelephony phoneServ = getPhoneInterface(); + if (phoneServ != null) { try { - ITelephony phoneServ = getPhoneInterface(); - if (phoneServ != null) { + // power button should hang up only when ringing + // but not after the call has been answered + if (code == KeyEvent.KEYCODE_ENDCALL || phoneServ.isRinging()) { hungUp = phoneServ.endCall(); - } else { - Log.w(TAG, "!!! Unable to find ITelephony interface !!!"); } } catch (RemoteException ex) { - Log.w(TAG, "ITelephony.endCall() threw RemoteException" + ex); + Log.w(TAG, "ITelephony threw RemoteException" + ex); } + } else { + Log.w(TAG, "!!! Unable to find ITelephony interface !!!"); } - if (hungUp || !screenIsOn) { + // power button should turn off screen in addition to hanging up the phone + if ((hungUp && code != KeyEvent.KEYCODE_POWER) || !screenIsOn) { mShouldTurnOffOnKeyUp = false; } else { // only try to turn off the screen if we didn't already hang up |