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

Commit 62c5781d authored by Daniel Hillenbrand's avatar Daniel Hillenbrand Committed by Gerrit Code Review
Browse files

Merge "Kill app back-button : Don't kill default launcher" into jellybean

parents f412f1e8 e2a1515b
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import android.content.IntentFilter;
import android.content.ServiceConnection;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.res.CompatibilityInfo;
import android.content.res.Configuration;
import android.content.res.Resources;
@@ -884,6 +885,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    Runnable mBackLongPress = new Runnable() {
        public void run() {
            try {
                final Intent intent = new Intent(Intent.ACTION_MAIN);
                String defaultHomePackage = "com.android.launcher";
                intent.addCategory(Intent.CATEGORY_HOME);
                final ResolveInfo res = mContext.getPackageManager().resolveActivity(intent, 0);
                if (res.activityInfo != null && !res.activityInfo.packageName.equals("android")) {
                    defaultHomePackage = res.activityInfo.packageName;
                }
                boolean targetKilled = false;
                IActivityManager am = ActivityManagerNative.getDefault();
                List<RunningAppProcessInfo> apps = am.getRunningAppProcesses();
@@ -895,7 +903,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                            && appInfo.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
                        if (appInfo.pkgList != null && (appInfo.pkgList.length > 0)) {
                            for (String pkg : appInfo.pkgList) {
                                if (!pkg.equals("com.android.systemui")) {
                                if (!pkg.equals("com.android.systemui") && !pkg.equals(defaultHomePackage)) {
                                    am.forceStopPackage(pkg);
                                    targetKilled = true;
                                    break;