From b1e5eba50cef5d72d81b733f87ac39c09d4212de Mon Sep 17 00:00:00 2001 From: Danesh M Date: Sun, 1 Jan 2012 23:52:41 -0500 Subject: Long press to kill Bring changes done in cm7 to ics. - Vibrate on press - Show message - http://review.cyanogenmod.com/#change,5191,patchset=2 --- .../com/android/internal/policy/impl/PhoneWindowManager.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'policy') diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 9511a62..32a0cd9 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -135,6 +135,7 @@ import android.view.KeyCharacterMap.FallbackAction; import android.view.accessibility.AccessibilityEvent; import android.view.animation.Animation; import android.view.animation.AnimationUtils; +import android.widget.Toast; import android.media.IAudioService; import android.media.AudioManager; @@ -666,6 +667,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { Runnable mBackLongPress = new Runnable() { public void run() { try { + performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false); IActivityManager mgr = ActivityManagerNative.getDefault(); List apps = mgr.getRunningAppProcesses(); for (RunningAppProcessInfo appInfo : apps) { @@ -674,8 +676,13 @@ public class PhoneWindowManager implements WindowManagerPolicy { // root, phone, etc.) if (uid >= Process.FIRST_APPLICATION_UID && uid <= Process.LAST_APPLICATION_UID && appInfo.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND) { + Toast.makeText(mContext, R.string.app_killed_message, Toast.LENGTH_SHORT).show(); // Kill the entire pid - Process.killProcess(appInfo.pid); + if (appInfo.pkgList!=null && (apps.size() > 0)){ + mgr.forceStopPackage(appInfo.pkgList[0]); + }else{ + Process.killProcess(appInfo.pid); + } break; } } @@ -1661,7 +1668,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.KILL_APP_LONGPRESS_BACK, 0) == 1) { if (down && repeatCount == 0) { - mHandler.postDelayed(mBackLongPress, 2000); + mHandler.postDelayed(mBackLongPress, ViewConfiguration.getGlobalActionKeyTimeout()); } } } -- cgit v1.1