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

Commit 9da2d403 authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Fix swiping away recents to always kill processes.

This would only kill processes if there were activities associated
with the recent task; now it always kills processes.

Always fix some debug output.

Change-Id: Iccda19ba0a20823347b06c13b450587283d28284
parent 5108b1b3
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -5443,15 +5443,16 @@ public final class ActivityManagerService extends ActivityManagerNative
                    "removeSubTask()");
            long ident = Binder.clearCallingIdentity();
            try {
                return mMainStack.removeTaskActivitiesLocked(taskId, subTaskIndex) != null;
                return mMainStack.removeTaskActivitiesLocked(taskId, subTaskIndex,
                        true) != null;
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
        }
    }
    private void cleanUpRemovedTaskLocked(ActivityRecord root, boolean killProcesses) {
        TaskRecord tr = root.task;
    private void cleanUpRemovedTaskLocked(TaskRecord tr, int flags) {
        final boolean killProcesses = (flags&ActivityManager.REMOVE_TASK_KILL_PROCESS) != 0;
        Intent baseIntent = new Intent(
                tr.intent != null ? tr.intent : tr.affinityIntent);
        ComponentName component = baseIntent.getComponent();
@@ -5462,7 +5463,7 @@ public final class ActivityManagerService extends ActivityManagerNative
        // Find any running services associated with this app.
        ArrayList<ServiceRecord> services = new ArrayList<ServiceRecord>();
        for (ServiceRecord sr : mServiceMap.getAllServices(root.userId)) {
        for (ServiceRecord sr : mServiceMap.getAllServices(tr.userId)) {
            if (sr.packageName.equals(component.getPackageName())) {
                services.add(sr);
            }
@@ -5517,11 +5518,11 @@ public final class ActivityManagerService extends ActivityManagerNative
                    "removeTask()");
            long ident = Binder.clearCallingIdentity();
            try {
                ActivityRecord r = mMainStack.removeTaskActivitiesLocked(taskId, -1);
                ActivityRecord r = mMainStack.removeTaskActivitiesLocked(taskId, -1,
                        false);
                if (r != null) {
                    mRecentTasks.remove(r.task);
                    cleanUpRemovedTaskLocked(r,
                            (flags&ActivityManager.REMOVE_TASK_KILL_PROCESS) != 0);
                    cleanUpRemovedTaskLocked(r.task, flags);
                    return true;
                } else {
                    TaskRecord tr = null;
@@ -5539,6 +5540,8 @@ public final class ActivityManagerService extends ActivityManagerNative
                            // Caller is just removing a recent task that is
                            // not actively running.  That is easy!
                            mRecentTasks.remove(i);
                            cleanUpRemovedTaskLocked(tr, flags);
                            return true;
                        } else {
                            Slog.w(TAG, "removeTask: task " + taskId
                                    + " does not have activities to remove, "
@@ -9360,7 +9363,7 @@ public final class ActivityManagerService extends ActivityManagerNative
    boolean dumpProvidersLocked(FileDescriptor fd, PrintWriter pw, String[] args,
            int opti, boolean dumpAll, String dumpPackage) {
        boolean needSep = false;
        boolean needSep = true;
        ItemMatcher matcher = new ItemMatcher();
        matcher.build(args, opti);
+8 −3
Original line number Diff line number Diff line
@@ -4011,10 +4011,13 @@ final class ActivityStack {
        return info;
    }

    public ActivityRecord removeTaskActivitiesLocked(int taskId, int subTaskIndex) {
    public ActivityRecord removeTaskActivitiesLocked(int taskId, int subTaskIndex,
            boolean taskRequired) {
        TaskAccessInfo info = getTaskAccessInfoLocked(taskId, false);
        if (info.root == null) {
            if (taskRequired) {
                Slog.w(TAG, "removeTaskLocked: unknown taskId " + taskId);
            }
            return null;
        }

@@ -4025,7 +4028,9 @@ final class ActivityStack {
        }

        if (subTaskIndex >= info.subtasks.size()) {
            if (taskRequired) {
                Slog.w(TAG, "removeTaskLocked: unknown subTaskIndex " + subTaskIndex);
            }
            return null;
        }

+1 −1
Original line number Diff line number Diff line
@@ -157,7 +157,7 @@ class ContentProviderRecord extends ContentProviderHolder {
        sb.append("ContentProviderRecord{");
        sb.append(Integer.toHexString(System.identityHashCode(this)));
        sb.append(' ');
        sb.append(info.name);
        sb.append(name.flattenToShortString());
        sb.append('}');
        return stringName = sb.toString();
    }
+14 −10
Original line number Diff line number Diff line
@@ -183,16 +183,20 @@ public class ProviderMap {
                r.dump(pw, "    ");
            } else {
                pw.print("  * ");
                pw.print(r.name.toShortString());
                /*
                if (r.app != null) {
                    pw.println(":");
                    pw.print("      ");
                    pw.println(r.app);
                } else {
                    pw.println();
                pw.println(r);
                if (r.proc != null) {
                    pw.print("    proc=");
                    pw.println(r.proc);
                }
                if (r.launchingApp != null) {
                    pw.print("    launchingApp=");
                    pw.println(r.launchingApp);
                }
                if (r.clients.size() > 0 || r.externalProcessNoHandleCount > 0) {
                    pw.print("    "); pw.print(r.clients.size());
                            pw.print(" clients, "); pw.print(r.externalProcessNoHandleCount);
                            pw.println(" external handles");
                }
                */
            }
        }
    }
+1 −1

File changed.

Contains only whitespace changes.