Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1e5eba5 authored by Danesh M's avatar Danesh M
Browse files

Long press to kill

Bring changes done in cm7 to ics.
- Vibrate on press
- Show message
- http://review.cyanogenmod.com/#change,5191,patchset=2
parent d56520a3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3415,4 +3415,7 @@
    <!-- STK setup Call -->
    <string name="SetupCallDefault">Accept Call?</string>

    <!--Application killed toast -->
    <string name="app_killed_message">Application killed</string>

</resources>
+9 −2
Original line number Diff line number Diff line
@@ -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<RunningAppProcessInfo> 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
                        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());
                }
            }
        }