diff options
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java | 2 | ||||
-rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 54 |
2 files changed, 28 insertions, 28 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java index b8dc63d..408436a 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java @@ -496,7 +496,7 @@ public class RecentsPanelView extends RelativeLayout // the task. final ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE); - am.removeTask(ad.taskId, 0); + am.removeTask(ad.taskId, ActivityManager.REMOVE_TASK_KILL_PROCESS); } public void handleLongPress(View selectedView) { diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index bf877f6..48b0b66 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -5171,7 +5171,7 @@ public final class ActivityManagerService extends ActivityManagerNative } } - private void removeTaskProcessesLocked(ActivityRecord root) { + private void cleanUpRemovedTaskLocked(ActivityRecord root, boolean killProcesses) { TaskRecord tr = root.task; Intent baseIntent = new Intent( tr.intent != null ? tr.intent : tr.affinityIntent); @@ -5194,6 +5194,7 @@ public final class ActivityManagerService extends ActivityManagerNative ServiceRecord sr = services.get(i); if (sr.startRequested) { if ((sr.serviceInfo.flags&ServiceInfo.FLAG_STOP_WITH_TASK) != 0) { + Slog.i(TAG, "Stopping service " + sr.shortName + ": remove task"); stopServiceLocked(sr); } else { sr.pendingStarts.add(new ServiceRecord.StartItem(sr, true, @@ -5205,26 +5206,28 @@ public final class ActivityManagerService extends ActivityManagerNative } } - // Find any running processes associated with this app. - ArrayList<ProcessRecord> procs = new ArrayList<ProcessRecord>(); - SparseArray<ProcessRecord> appProcs - = mProcessNames.getMap().get(component.getPackageName()); - if (appProcs != null) { - for (int i=0; i<appProcs.size(); i++) { - procs.add(appProcs.valueAt(i)); - } - } - - // Kill the running processes. - for (int i=0; i<procs.size(); i++) { - ProcessRecord pr = procs.get(i); - if (pr.setSchedGroup == Process.THREAD_GROUP_BG_NONINTERACTIVE) { - Slog.i(TAG, "Killing " + pr + ": remove task"); - EventLog.writeEvent(EventLogTags.AM_KILL, pr.pid, - pr.processName, pr.setAdj, "remove task"); - Process.killProcessQuiet(pr.pid); - } else { - pr.waitingToKill = "remove task"; + if (killProcesses) { + // Find any running processes associated with this app. + ArrayList<ProcessRecord> procs = new ArrayList<ProcessRecord>(); + SparseArray<ProcessRecord> appProcs + = mProcessNames.getMap().get(component.getPackageName()); + if (appProcs != null) { + for (int i=0; i<appProcs.size(); i++) { + procs.add(appProcs.valueAt(i)); + } + } + + // Kill the running processes. + for (int i=0; i<procs.size(); i++) { + ProcessRecord pr = procs.get(i); + if (pr.setSchedGroup == Process.THREAD_GROUP_BG_NONINTERACTIVE) { + Slog.i(TAG, "Killing " + pr.toShortString() + ": remove task"); + EventLog.writeEvent(EventLogTags.AM_KILL, pr.pid, + pr.processName, pr.setAdj, "remove task"); + Process.killProcessQuiet(pr.pid); + } else { + pr.waitingToKill = "remove task"; + } } } } @@ -5238,11 +5241,8 @@ public final class ActivityManagerService extends ActivityManagerNative ActivityRecord r = mMainStack.removeTaskActivitiesLocked(taskId, -1); if (r != null) { mRecentTasks.remove(r.task); - - if ((flags&ActivityManager.REMOVE_TASK_KILL_PROCESS) != 0) { - removeTaskProcessesLocked(r); - } - + cleanUpRemovedTaskLocked(r, + (flags&ActivityManager.REMOVE_TASK_KILL_PROCESS) != 0); return true; } } finally { @@ -13169,7 +13169,7 @@ public final class ActivityManagerService extends ActivityManagerNative + " to " + app.curSchedGroup); if (app.waitingToKill != null && app.setSchedGroup == Process.THREAD_GROUP_BG_NONINTERACTIVE) { - Slog.i(TAG, "Killing " + app + ": " + app.waitingToKill); + Slog.i(TAG, "Killing " + app.toShortString() + ": " + app.waitingToKill); EventLog.writeEvent(EventLogTags.AM_KILL, app.pid, app.processName, app.setAdj, app.waitingToKill); Process.killProcessQuiet(app.pid); |