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

Commit 6f63bf9d authored by Danesh M's avatar Danesh M
Browse files

Framework : Long press kill fixes

Jellybean introduced changes to systemui's privelege level.
This patch hardcodes a check to avoid killing it.

Patchset 2 : Minor fix
Patchset 3 : Check length of pkgList rather than apps
Patchset 4 : Vibrate on kill

Change-Id: I24af510a62cae9acc29504912fb133825bb67bb6
parent 5a35f209
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -837,6 +837,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    Runnable mBackLongPress = new Runnable() {
        public void run() {
            try {
                performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false);
                IActivityManager am = ActivityManagerNative.getDefault();
                List<RunningAppProcessInfo> apps = am.getRunningAppProcesses();
                for (RunningAppProcessInfo appInfo : apps) {
@@ -846,14 +847,19 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    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();
                        if (appInfo.pkgList != null && (apps.size() > 0)) {
                            am.forceStopPackage(appInfo.pkgList[0]);
                        if (appInfo.pkgList != null && (appInfo.pkgList.length > 0)) {
                            for (String pkg : appInfo.pkgList) {
                                if (!pkg.equals("com.android.systemui")) {
                                    am.forceStopPackage(pkg);
                                    break;
                                }
                            }
                        } else {
                            Process.killProcess(appInfo.pid);
                        }
                            break;
                        }
                    }
                }
            } catch (RemoteException remoteException) {
                // Do nothing; just let it go.
            }