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

Commit 6188d5c4 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "Long press to kill" into ics

parents f9d6bed4 b1e5eba5
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());
                }
            }
        }