diff options
4 files changed, 24 insertions, 21 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index b93ea81..d6fb1fe 100755 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -11376,7 +11376,7 @@ public final class ActivityManagerService extends ActivityManagerNative ActivityManager.ProcessErrorStateInfo.CRASHED, null, shortMsg, longMsg, stackTrace); startAppProblemLocked(app); app.stopFreezingAllLocked(); - return handleAppCrashLocked(app, shortMsg, longMsg, stackTrace); + return handleAppCrashLocked(app, "force-crash" /*reason*/, shortMsg, longMsg, stackTrace); } private void makeAppNotRespondingLocked(ProcessRecord app, @@ -11431,14 +11431,15 @@ public final class ActivityManagerService extends ActivityManagerNative app.waitDialog = null; } if (app.pid > 0 && app.pid != MY_PID) { - handleAppCrashLocked(app, null, null, null); + handleAppCrashLocked(app, "user-terminated" /*reason*/, + null /*shortMsg*/, null /*longMsg*/, null /*stackTrace*/); app.kill("user request after error", true); } } } - private boolean handleAppCrashLocked(ProcessRecord app, String shortMsg, String longMsg, - String stackTrace) { + private boolean handleAppCrashLocked(ProcessRecord app, String reason, + String shortMsg, String longMsg, String stackTrace) { long now = SystemClock.uptimeMillis(); Long crashTime; @@ -11479,7 +11480,7 @@ public final class ActivityManagerService extends ActivityManagerNative } mStackSupervisor.resumeTopActivitiesLocked(); } else { - mStackSupervisor.finishTopRunningActivityLocked(app); + mStackSupervisor.finishTopRunningActivityLocked(app, reason); } // Bump up the crash count of any services currently running in the proc. diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java index 9507958..363f0e3 100644 --- a/services/core/java/com/android/server/am/ActivityStack.java +++ b/services/core/java/com/android/server/am/ActivityStack.java @@ -1634,7 +1634,7 @@ final class ActivityStack { if (DEBUG_STATES) Slog.d(TAG, "no-history finish of " + mLastNoHistoryActivity + " on new resume"); requestFinishActivityLocked(mLastNoHistoryActivity.appToken, Activity.RESULT_CANCELED, - null, "no-history", false); + null, "resume-no-history", false); mLastNoHistoryActivity = null; } @@ -2255,7 +2255,8 @@ final class ActivityStack { } if (DEBUG_TASKS) Slog.w(TAG, "resetTaskIntendedTask: calling finishActivity on " + p); - if (finishActivityLocked(p, Activity.RESULT_CANCELED, null, "reset", false)) { + if (finishActivityLocked( + p, Activity.RESULT_CANCELED, null, "reset-task", false)) { end--; srcPos--; } @@ -2332,7 +2333,8 @@ final class ActivityStack { if (p.finishing) { continue; } - finishActivityLocked(p, Activity.RESULT_CANCELED, null, "reset", false); + finishActivityLocked( + p, Activity.RESULT_CANCELED, null, "move-affinity", false); } } else { if (taskInsertionPoint < 0) { @@ -2488,7 +2490,7 @@ final class ActivityStack { Slog.d(TAG, "no-history finish of " + r); } requestFinishActivityLocked(r.appToken, Activity.RESULT_CANCELED, null, - "no-history", false); + "stop-no-history", false); } else { if (DEBUG_STATES) Slog.d(TAG, "Not finishing noHistory " + r + " on stop because we're just sleeping"); @@ -2567,7 +2569,7 @@ final class ActivityStack { mService.updateOomAdjLocked(); } - final void finishTopRunningActivityLocked(ProcessRecord app) { + final void finishTopRunningActivityLocked(ProcessRecord app, String reason) { ActivityRecord r = topRunningActivityLocked(null); if (r != null && r.app == app) { // If the top running activity is from this crashing @@ -2576,7 +2578,7 @@ final class ActivityStack { + r.intent.getComponent().flattenToShortString()); int taskNdx = mTaskHistory.indexOf(r.task); int activityNdx = r.task.mActivities.indexOf(r); - finishActivityLocked(r, Activity.RESULT_CANCELED, null, "crashed", false); + finishActivityLocked(r, Activity.RESULT_CANCELED, null, reason, false); // Also terminate any activities below it that aren't yet // stopped, to avoid a situation where one will get // re-start our crashing activity once it gets resumed again. @@ -2598,7 +2600,7 @@ final class ActivityStack { if (!r.isHomeActivity() || mService.mHomeProcess != r.app) { Slog.w(TAG, " Force finishing activity " + r.intent.getComponent().flattenToShortString()); - finishActivityLocked(r, Activity.RESULT_CANCELED, null, "crashed", false); + finishActivityLocked(r, Activity.RESULT_CANCELED, null, reason, false); } } } @@ -2935,7 +2937,7 @@ final class ActivityStack { foundParentInTask = false; } requestFinishActivityLocked(parent.appToken, resultCode, - resultData, "navigate-up", true); + resultData, "navigate-top", true); } } Binder.restoreCallingIdentity(origId); diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index 262b4f1..466eede 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -2458,13 +2458,13 @@ public final class ActivityStackSupervisor implements DisplayListener { return result; } - void finishTopRunningActivityLocked(ProcessRecord app) { + void finishTopRunningActivityLocked(ProcessRecord app, String reason) { for (int displayNdx = mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) { final ArrayList<ActivityStack> stacks = mActivityDisplays.valueAt(displayNdx).mStacks; final int numStacks = stacks.size(); for (int stackNdx = 0; stackNdx < numStacks; ++stackNdx) { final ActivityStack stack = stacks.get(stackNdx); - stack.finishTopRunningActivityLocked(app); + stack.finishTopRunningActivityLocked(app, reason); } } } diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java index c3eda71..21302b2 100644 --- a/services/core/java/com/android/server/am/TaskRecord.java +++ b/services/core/java/com/android/server/am/TaskRecord.java @@ -610,8 +610,8 @@ final class TaskRecord { mActivities.remove(activityNdx); --activityNdx; --numActivities; - } else if (stack.finishActivityLocked(r, Activity.RESULT_CANCELED, null, "clear", - false)) { + } else if (stack.finishActivityLocked( + r, Activity.RESULT_CANCELED, null, "clear-task-index", false)) { --activityNdx; --numActivities; } @@ -658,8 +658,8 @@ final class TaskRecord { if (opts != null) { ret.updateOptionsLocked(opts); } - if (stack.finishActivityLocked(r, Activity.RESULT_CANCELED, null, "clear", - false)) { + if (stack.finishActivityLocked( + r, Activity.RESULT_CANCELED, null, "clear-task-stack", false)) { --activityNdx; --numActivities; } @@ -671,8 +671,8 @@ final class TaskRecord { if (ret.launchMode == ActivityInfo.LAUNCH_MULTIPLE && (launchFlags & Intent.FLAG_ACTIVITY_SINGLE_TOP) == 0) { if (!ret.finishing) { - stack.finishActivityLocked(ret, Activity.RESULT_CANCELED, null, - "clear", false); + stack.finishActivityLocked( + ret, Activity.RESULT_CANCELED, null, "clear-task-top", false); return null; } } |
