Index: frameworks/policies/base/phone/com/android/internal/policy/impl/PhoneWindowManager.java
===================================================================
--- frameworks/policies/base/phone/com/android/internal/policy/impl/PhoneWindowManager.java	(revision 64026)
+++ frameworks/policies/base/phone/com/android/internal/policy/impl/PhoneWindowManager.java	(revision 64027)
@@ -373,7 +373,7 @@
         }
     }
 
-    Runnable mEndCallLongPress = new Runnable() {
+    Runnable mPowerLongPress = new Runnable() {
         public void run() {
             mShouldTurnOffOnKeyUp = false;
             performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false);
@@ -897,6 +897,7 @@
                 }
             }
         }
+		
         
         // Shortcuts are invoked through Search+key, so intercept those here
         if (mSearchKeyPressed) {
@@ -1457,7 +1458,8 @@
         boolean down = event.value != 0;
 
         if (type == RawInputEvent.EV_KEY) {
-            if (code == KeyEvent.KEYCODE_ENDCALL) {
+            if (code == KeyEvent.KEYCODE_ENDCALL
+                    || code == KeyEvent.KEYCODE_POWER) {
                 if (down) {
                     boolean hungUp = false;
                     // key repeats are generated by the window manager, and we don't see them
@@ -1473,17 +1475,17 @@
                     } catch (RemoteException ex) {
                         Log.w(TAG, "ITelephony.endCall() threw RemoteException" + ex);
                     }
-                    if (hungUp || !screenIsOn) {
+                    if ((hungUp && code != KeyEvent.KEYCODE_POWER) || !screenIsOn) {
                         mShouldTurnOffOnKeyUp = false;
                     } else {
                         // only try to turn off the screen if we didn't already hang up
                         mShouldTurnOffOnKeyUp = true;
-                        mHandler.postDelayed(mEndCallLongPress,
+                        mHandler.postDelayed(mPowerLongPress,
                                 ViewConfiguration.getGlobalActionKeyTimeout());
                         result &= ~ACTION_PASS_TO_USER;
                     }
                 } else {
-                    mHandler.removeCallbacks(mEndCallLongPress);
+                    mHandler.removeCallbacks(mPowerLongPress);
                     if (mShouldTurnOffOnKeyUp) {
                         mShouldTurnOffOnKeyUp = false;
                         boolean gohome = (mEndcallBehavior & ENDCALL_HOME) != 0;
