Loading services/java/com/android/server/am/ActivityRecord.java +1 −1 Original line number Diff line number Diff line Loading @@ -949,7 +949,7 @@ final class ActivityRecord { @Override public String toString() { if (stringName != null) { return stringName + " t" + task.taskId + "}"; return stringName + " t" + task.taskId + (finishing ? " f}" : "}"); } StringBuilder sb = new StringBuilder(128); sb.append("ActivityRecord{"); Loading services/java/com/android/server/am/ActivityStack.java +45 −46 Original line number Diff line number Diff line Loading @@ -537,20 +537,6 @@ final class ActivityStack { } final ActivityRecord isInStackLocked(IBinder token) { ActivityRecord newAr = newIsInStackLocked(token); ActivityRecord r = ActivityRecord.forToken(token); if (mHistory.contains(r)) { if (VALIDATE_TASK_REPLACE && newAr != r) Slog.w(TAG, "isInStackLocked: mismatch: newAr=" + newAr + " r=" + r); return r; } if (VALIDATE_TASK_REPLACE && newAr != null) Slog.w(TAG, "isInStackLocked: mismatch: newAr!=null"); return null; } final ActivityRecord newIsInStackLocked(IBinder token) { final ActivityRecord r = ActivityRecord.forToken(token); if (r != null) { final TaskRecord task = r.task; Loading Loading @@ -1910,9 +1896,6 @@ final class ActivityStack { boolean startIt = true; for (int i = NH-1; i >= 0; i--) { ActivityRecord p = mHistory.get(i); if (p.finishing) { continue; } if (p.task == r.task) { // Here it is! Now, if this is not yet visible to the // user, then just add it without starting; it will Loading Loading @@ -2318,14 +2301,11 @@ final class ActivityStack { if (DEBUG_TASKS) Slog.v(TAG, "Reparenting task at index " + i + " to " + end); for (int srcPos = i; srcPos <= end; ++srcPos) { final ActivityRecord p = activities.get(srcPos); if (p.finishing) { continue; } p.setTask(task, null, false); task.addActivityToTop(p); mHistory.remove(p); mHistory.add(taskTopI--, p); mHistory.add(taskTopI, p); if (DEBUG_ADD_REMOVE) Slog.i(TAG, "Removing and adding activity " + p + " to stack at " + task, Loading @@ -2335,12 +2315,12 @@ final class ActivityStack { mService.mWindowManager.setAppGroupId(p.appToken, taskId); } mService.mWindowManager.moveTaskToTop(taskId); if (VALIDATE_TOKENS) { validateAppTokensLocked(); } if (VALIDATE_TASK_REPLACE) { verifyActivityRecords(false); } if (VALIDATE_TOKENS) { validateAppTokensLocked(); } // Now we've moved it in to place... but what if this is // a singleTop activity and we have put it on top of another Loading Loading @@ -3087,9 +3067,16 @@ final class ActivityStack { // This not being started from an existing activity, and not part // of a new task... just put it in the top task, though these days // this case should never happen. final int N = mHistory.size(); ActivityRecord prev = N > 0 ? mHistory.get(N-1) : null; ActivityRecord prev = null; // Iterate to find the first non-empty task stack. Note that this code can // go away once we stop storing tasks with empty mActivities lists. for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) { ArrayList<ActivityRecord> activities = mTaskHistory.get(taskNdx).mActivities; for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) { prev = activities.get(activityNdx); break; } } r.setTask(prev != null ? prev.task : createTaskRecord(mService.mCurTask, r.info, intent, true), null, true); Loading Loading @@ -3742,14 +3729,16 @@ final class ActivityStack { return; } int i; for (i=mHistory.size()-1; i>=0; i--) { ActivityRecord r = mHistory.get(i); for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) { ArrayList<ActivityRecord> activities = mTaskHistory.get(taskNdx).mActivities; for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) { ActivityRecord r = activities.get(activityNdx); if (r.resultTo == self && r.requestCode == requestCode) { if ((r.resultWho == null && resultWho == null) || (r.resultWho != null && r.resultWho.equals(resultWho))) { finishActivityLocked(r, Activity.RESULT_CANCELED, null, "request-sub", false); finishActivityLocked(r, Activity.RESULT_CANCELED, null, "request-sub", false); } } } } Loading @@ -3763,15 +3752,25 @@ final class ActivityStack { // process, then terminate it to avoid getting in a loop. Slog.w(TAG, " Force finishing activity " + r.intent.getComponent().flattenToShortString()); int index = mHistory.indexOf(r); int taskNdx = mTaskHistory.indexOf(r.task); int activityNdx = r.task.mActivities.indexOf(r); r.stack.finishActivityLocked(r, Activity.RESULT_CANCELED, null, "crashed", 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. index--; if (index >= 0) { r = mHistory.get(index); --activityNdx; if (activityNdx < 0) { do { --taskNdx; if (taskNdx < 0) { break; } activityNdx = mTaskHistory.get(taskNdx).mActivities.size() - 1; } while (activityNdx < 0); } if (activityNdx >= 0) { r = mTaskHistory.get(taskNdx).mActivities.get(activityNdx); if (r.state == ActivityState.RESUMED || r.state == ActivityState.PAUSING || r.state == ActivityState.PAUSED) { Loading services/java/com/android/server/am/TaskRecord.java +1 −15 Original line number Diff line number Diff line Loading @@ -134,22 +134,8 @@ class TaskRecord extends ThumbnailHolder { // Was not previously in list. numFullscreen++; } // TODO: This only matters to achieve identical results as mHistory. Later we won't need // to skip over finishing activities. int i; for (i = mActivities.size() - 1; i >= 0; --i) { if (!mActivities.get(i).finishing) { break; } } if (i >= 0) { // Add below finishing activities. mActivities.add(i + 1, r); } else { // All activities are finishing, add to top. mActivities.add(r); } } /** @return true if this was the last activity in the task */ boolean removeActivity(ActivityRecord r) { Loading Loading
services/java/com/android/server/am/ActivityRecord.java +1 −1 Original line number Diff line number Diff line Loading @@ -949,7 +949,7 @@ final class ActivityRecord { @Override public String toString() { if (stringName != null) { return stringName + " t" + task.taskId + "}"; return stringName + " t" + task.taskId + (finishing ? " f}" : "}"); } StringBuilder sb = new StringBuilder(128); sb.append("ActivityRecord{"); Loading
services/java/com/android/server/am/ActivityStack.java +45 −46 Original line number Diff line number Diff line Loading @@ -537,20 +537,6 @@ final class ActivityStack { } final ActivityRecord isInStackLocked(IBinder token) { ActivityRecord newAr = newIsInStackLocked(token); ActivityRecord r = ActivityRecord.forToken(token); if (mHistory.contains(r)) { if (VALIDATE_TASK_REPLACE && newAr != r) Slog.w(TAG, "isInStackLocked: mismatch: newAr=" + newAr + " r=" + r); return r; } if (VALIDATE_TASK_REPLACE && newAr != null) Slog.w(TAG, "isInStackLocked: mismatch: newAr!=null"); return null; } final ActivityRecord newIsInStackLocked(IBinder token) { final ActivityRecord r = ActivityRecord.forToken(token); if (r != null) { final TaskRecord task = r.task; Loading Loading @@ -1910,9 +1896,6 @@ final class ActivityStack { boolean startIt = true; for (int i = NH-1; i >= 0; i--) { ActivityRecord p = mHistory.get(i); if (p.finishing) { continue; } if (p.task == r.task) { // Here it is! Now, if this is not yet visible to the // user, then just add it without starting; it will Loading Loading @@ -2318,14 +2301,11 @@ final class ActivityStack { if (DEBUG_TASKS) Slog.v(TAG, "Reparenting task at index " + i + " to " + end); for (int srcPos = i; srcPos <= end; ++srcPos) { final ActivityRecord p = activities.get(srcPos); if (p.finishing) { continue; } p.setTask(task, null, false); task.addActivityToTop(p); mHistory.remove(p); mHistory.add(taskTopI--, p); mHistory.add(taskTopI, p); if (DEBUG_ADD_REMOVE) Slog.i(TAG, "Removing and adding activity " + p + " to stack at " + task, Loading @@ -2335,12 +2315,12 @@ final class ActivityStack { mService.mWindowManager.setAppGroupId(p.appToken, taskId); } mService.mWindowManager.moveTaskToTop(taskId); if (VALIDATE_TOKENS) { validateAppTokensLocked(); } if (VALIDATE_TASK_REPLACE) { verifyActivityRecords(false); } if (VALIDATE_TOKENS) { validateAppTokensLocked(); } // Now we've moved it in to place... but what if this is // a singleTop activity and we have put it on top of another Loading Loading @@ -3087,9 +3067,16 @@ final class ActivityStack { // This not being started from an existing activity, and not part // of a new task... just put it in the top task, though these days // this case should never happen. final int N = mHistory.size(); ActivityRecord prev = N > 0 ? mHistory.get(N-1) : null; ActivityRecord prev = null; // Iterate to find the first non-empty task stack. Note that this code can // go away once we stop storing tasks with empty mActivities lists. for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) { ArrayList<ActivityRecord> activities = mTaskHistory.get(taskNdx).mActivities; for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) { prev = activities.get(activityNdx); break; } } r.setTask(prev != null ? prev.task : createTaskRecord(mService.mCurTask, r.info, intent, true), null, true); Loading Loading @@ -3742,14 +3729,16 @@ final class ActivityStack { return; } int i; for (i=mHistory.size()-1; i>=0; i--) { ActivityRecord r = mHistory.get(i); for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) { ArrayList<ActivityRecord> activities = mTaskHistory.get(taskNdx).mActivities; for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) { ActivityRecord r = activities.get(activityNdx); if (r.resultTo == self && r.requestCode == requestCode) { if ((r.resultWho == null && resultWho == null) || (r.resultWho != null && r.resultWho.equals(resultWho))) { finishActivityLocked(r, Activity.RESULT_CANCELED, null, "request-sub", false); finishActivityLocked(r, Activity.RESULT_CANCELED, null, "request-sub", false); } } } } Loading @@ -3763,15 +3752,25 @@ final class ActivityStack { // process, then terminate it to avoid getting in a loop. Slog.w(TAG, " Force finishing activity " + r.intent.getComponent().flattenToShortString()); int index = mHistory.indexOf(r); int taskNdx = mTaskHistory.indexOf(r.task); int activityNdx = r.task.mActivities.indexOf(r); r.stack.finishActivityLocked(r, Activity.RESULT_CANCELED, null, "crashed", 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. index--; if (index >= 0) { r = mHistory.get(index); --activityNdx; if (activityNdx < 0) { do { --taskNdx; if (taskNdx < 0) { break; } activityNdx = mTaskHistory.get(taskNdx).mActivities.size() - 1; } while (activityNdx < 0); } if (activityNdx >= 0) { r = mTaskHistory.get(taskNdx).mActivities.get(activityNdx); if (r.state == ActivityState.RESUMED || r.state == ActivityState.PAUSING || r.state == ActivityState.PAUSED) { Loading
services/java/com/android/server/am/TaskRecord.java +1 −15 Original line number Diff line number Diff line Loading @@ -134,22 +134,8 @@ class TaskRecord extends ThumbnailHolder { // Was not previously in list. numFullscreen++; } // TODO: This only matters to achieve identical results as mHistory. Later we won't need // to skip over finishing activities. int i; for (i = mActivities.size() - 1; i >= 0; --i) { if (!mActivities.get(i).finishing) { break; } } if (i >= 0) { // Add below finishing activities. mActivities.add(i + 1, r); } else { // All activities are finishing, add to top. mActivities.add(r); } } /** @return true if this was the last activity in the task */ boolean removeActivity(ActivityRecord r) { Loading