Loading services/core/java/com/android/server/am/ActivityManagerService.java +20 −19 Original line number Diff line number Diff line Loading @@ -2358,7 +2358,7 @@ public final class ActivityManagerService extends ActivityManagerNative return mAppBindArgs; } final void setFocusedActivityLocked(ActivityRecord r) { final void setFocusedActivityLocked(ActivityRecord r, String reason) { if (mFocusedActivity != r) { if (DEBUG_FOCUS) Slog.d(TAG, "setFocusedActivityLocked: r=" + r); mFocusedActivity = r; Loading @@ -2367,7 +2367,7 @@ public final class ActivityManagerService extends ActivityManagerNative } else { finishRunningVoiceLocked(); } mStackSupervisor.setFocusedStack(r); mStackSupervisor.setFocusedStack(r, reason + " setFocusedActivity"); if (r != null) { mWindowManager.setFocusedApp(r.appToken, true); } Loading @@ -2391,7 +2391,7 @@ public final class ActivityManagerService extends ActivityManagerNative if (stack != null) { ActivityRecord r = stack.topRunningActivityLocked(null); if (r != null) { setFocusedActivityLocked(r); setFocusedActivityLocked(r, "setFocusedStack"); } } } Loading Loading @@ -2435,7 +2435,7 @@ public final class ActivityManagerService extends ActivityManagerNative mHandler.sendMessage(msg); } private final int updateLruProcessInternalLocked(ProcessRecord app, long now, int index, private int updateLruProcessInternalLocked(ProcessRecord app, long now, int index, String what, Object obj, ProcessRecord srcApp) { app.lastActivityTime = now; Loading Loading @@ -3109,7 +3109,7 @@ public final class ActivityManagerService extends ActivityManagerNative return intent; } boolean startHomeActivityLocked(int userId) { boolean startHomeActivityLocked(int userId, String reason) { if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL && mTopAction == null) { // We are running in factory test mode, but unable to find Loading @@ -3131,7 +3131,7 @@ public final class ActivityManagerService extends ActivityManagerNative aInfo.applicationInfo.uid, true); if (app == null || app.instrumentationClass == null) { intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK); mStackSupervisor.startHomeActivity(intent, aInfo); mStackSupervisor.startHomeActivity(intent, aInfo, reason); } } Loading Loading @@ -6343,7 +6343,7 @@ public final class ActivityManagerService extends ActivityManagerNative synchronized (this) { ActivityStack stack = ActivityRecord.getStackLocked(token); if (stack != null) { stack.activityDestroyedLocked(token); stack.activityDestroyedLocked(token, "activityDestroyed"); } } } Loading Loading @@ -8536,7 +8536,7 @@ public final class ActivityManagerService extends ActivityManagerNative if (prev != null && prev.isRecentsActivity()) { task.setTaskToReturnTo(ActivityRecord.RECENTS_ACTIVITY_TYPE); } mStackSupervisor.findTaskToMoveToFrontLocked(task, flags, options); mStackSupervisor.findTaskToMoveToFrontLocked(task, flags, options, "moveTaskToFront"); } finally { Binder.restoreCallingIdentity(origId); } Loading Loading @@ -8565,7 +8565,7 @@ public final class ActivityManagerService extends ActivityManagerNative } final long origId = Binder.clearCallingIdentity(); try { stack.moveTaskToBackLocked(taskId, null); stack.moveTaskToBackLocked(taskId); } finally { Binder.restoreCallingIdentity(origId); } Loading Loading @@ -8595,7 +8595,7 @@ public final class ActivityManagerService extends ActivityManagerNative mStackSupervisor.showLockTaskToast(); return false; } return ActivityRecord.getStackLocked(token).moveTaskToBackLocked(taskId, null); return ActivityRecord.getStackLocked(token).moveTaskToBackLocked(taskId); } } finally { Binder.restoreCallingIdentity(origId); Loading Loading @@ -8687,7 +8687,7 @@ public final class ActivityManagerService extends ActivityManagerNative try { if (DEBUG_STACK) Slog.d(TAG, "moveTaskToStack: moving task=" + taskId + " to stackId=" + stackId + " toTop=" + toTop); mStackSupervisor.moveTaskToStack(taskId, stackId, toTop); mStackSupervisor.moveTaskToStackLocked(taskId, stackId, toTop); } finally { Binder.restoreCallingIdentity(ident); } Loading Loading @@ -8793,7 +8793,8 @@ public final class ActivityManagerService extends ActivityManagerNative || (task != mStackSupervisor.getFocusedStack().topTask()))) { throw new IllegalArgumentException("Invalid task, not in foreground"); } mStackSupervisor.setLockTaskModeLocked(task, !isSystemInitiated); mStackSupervisor.setLockTaskModeLocked(task, !isSystemInitiated, "startLockTask"); } } } finally { Loading Loading @@ -8878,7 +8879,7 @@ public final class ActivityManagerService extends ActivityManagerNative Log.d(TAG, "stopLockTaskMode"); // Stop lock task synchronized (this) { mStackSupervisor.setLockTaskModeLocked(null, false); mStackSupervisor.setLockTaskModeLocked(null, false, "stopLockTask"); } } finally { Binder.restoreCallingIdentity(ident); Loading Loading @@ -11338,7 +11339,7 @@ public final class ActivityManagerService extends ActivityManagerNative // Start up initial activity. mBooting = true; startHomeActivityLocked(mCurrentUserId); startHomeActivityLocked(mCurrentUserId, "systemReady"); try { if (AppGlobals.getPackageManager().hasSystemUidErrors()) { Loading Loading @@ -18885,7 +18886,7 @@ public final class ActivityManagerService extends ActivityManagerNative return true; } mStackSupervisor.setLockTaskModeLocked(null, false); mStackSupervisor.setLockTaskModeLocked(null, false, "startUser"); final UserInfo userInfo = getUserManagerLocked().getUserInfo(userId); if (userInfo == null) { Loading Loading @@ -19142,7 +19143,7 @@ public final class ActivityManagerService extends ActivityManagerNative void moveUserToForeground(UserStartedState uss, int oldUserId, int newUserId) { boolean homeInFront = mStackSupervisor.switchUserLocked(newUserId, uss); if (homeInFront) { startHomeActivityLocked(newUserId); startHomeActivityLocked(newUserId, "moveUserToFroreground"); } else { mStackSupervisor.resumeTopActivitiesLocked(); } services/core/java/com/android/server/am/ActivityRecord.java +1 −1 Original line number Diff line number Diff line Loading @@ -516,7 +516,7 @@ final class ActivityRecord { void setTask(TaskRecord newTask, TaskRecord taskToAffiliateWith) { if (task != null && task.removeActivity(this)) { if (task != newTask) { task.stack.removeTask(task); task.stack.removeTask(task, "setTask"); } else { Slog.d(TAG, "!!! REMOVE THIS LOG !!! setTask: nearly removed stack=" + (newTask == null ? null : newTask.stack)); Loading services/core/java/com/android/server/am/ActivityStack.java +33 −43 Original line number Diff line number Diff line Loading @@ -291,7 +291,7 @@ final class ActivityStack { // so we need to be conservative and assume it isn't. Slog.w(TAG, "Activity destroy timeout for " + r); synchronized (mService) { activityDestroyedLocked(r != null ? r.appToken : null); activityDestroyedLocked(r != null ? r.appToken : null, "destroyTimeout"); } } break; case STOP_TIMEOUT_MSG: { Loading Loading @@ -473,10 +473,10 @@ final class ActivityStack { mActivityContainer.mActivityDisplay.mDisplayId == Display.DEFAULT_DISPLAY; } final void moveToFront() { final void moveToFront(String reason) { if (isAttached()) { if (isOnHomeDisplay()) { mStackSupervisor.moveHomeStack(isHomeStack()); mStackSupervisor.moveHomeStack(isHomeStack(), reason); } mStacks.remove(this); mStacks.add(this); Loading Loading @@ -1496,7 +1496,7 @@ final class ActivityStack { final int returnTaskType = prevTask == null || !prevTask.isOverHomeStack() ? HOME_ACTIVITY_TYPE : prevTask.getTaskToReturnTo(); return isOnHomeDisplay() && mStackSupervisor.resumeHomeStackTask(returnTaskType, prev); mStackSupervisor.resumeHomeStackTask(returnTaskType, prev, "noMoreActivities"); } next.delayedResume = false; Loading Loading @@ -1532,7 +1532,7 @@ final class ActivityStack { "resumeTopActivityLocked: Launching home next"); final int returnTaskType = prevTask == null || !prevTask.isOverHomeStack() ? HOME_ACTIVITY_TYPE : prevTask.getTaskToReturnTo(); return mStackSupervisor.resumeHomeStackTask(returnTaskType, prev); return mStackSupervisor.resumeHomeStackTask(returnTaskType, prev, "prevFinished"); } } Loading Loading @@ -1817,11 +1817,8 @@ final class ActivityStack { next.app.thread.scheduleNewIntent(next.newIntents, next.appToken); } EventLog.writeEvent(EventLogTags.AM_RESUME_ACTIVITY, next.userId, System.identityHashCode(next), next.task.taskId, next.shortComponentName + " top=" + mStacks.get(mStacks.size() - 1).mStackId + " Callers=" + Debug.getCallers(6)); EventLog.writeEvent(EventLogTags.AM_RESUME_ACTIVITY, next.userId, System.identityHashCode(next), next.task.taskId, next.shortComponentName); next.sleeping = false; mService.showAskCompatModeDialogLocked(next); Loading Loading @@ -2468,18 +2465,19 @@ final class ActivityStack { r.addResultLocked(null, resultWho, requestCode, resultCode, data); } private void adjustFocusedActivityLocked(ActivityRecord r) { private void adjustFocusedActivityLocked(ActivityRecord r, String reason) { if (mStackSupervisor.isFrontStack(this) && mService.mFocusedActivity == r) { ActivityRecord next = topRunningActivityLocked(null); if (next != r) { final TaskRecord task = r.task; if (r.frontOfTask && task == topTask() && task.isOverHomeStack()) { mStackSupervisor.moveHomeStackTaskToTop(task.getTaskToReturnTo()); mStackSupervisor.moveHomeStackTaskToTop(task.getTaskToReturnTo(), reason + " adjustFocus"); } } ActivityRecord top = mStackSupervisor.topRunningActivityLocked(); if (top != null) { mService.setFocusedActivityLocked(top); mService.setFocusedActivityLocked(top, reason + " adjustTopFocus"); } } } Loading @@ -2503,7 +2501,7 @@ final class ActivityStack { } if (r.app != null && r.app.thread != null) { adjustFocusedActivityLocked(r); adjustFocusedActivityLocked(r, "stopActivity"); r.resumeKeyDispatchingLocked(); try { r.stopped = false; Loading Loading @@ -2707,7 +2705,7 @@ final class ActivityStack { r.pauseKeyDispatchingLocked(); adjustFocusedActivityLocked(r); adjustFocusedActivityLocked(r, "finishActivity"); finishActivityResultsLocked(r, resultCode, resultData); Loading Loading @@ -3010,7 +3008,7 @@ final class ActivityStack { r.finishLaunchTickingLocked(); } private void removeActivityFromHistoryLocked(ActivityRecord r) { private void removeActivityFromHistoryLocked(ActivityRecord r, String reason) { mStackSupervisor.removeChildActivityContainers(r); finishActivityResultsLocked(r, Activity.RESULT_CANCELED, null); r.makeFinishing(); Loading @@ -3035,9 +3033,9 @@ final class ActivityStack { "removeActivityFromHistoryLocked: last activity removed from " + this); if (mStackSupervisor.isFrontStack(this) && task == topTask() && task.isOverHomeStack()) { mStackSupervisor.moveHomeStackTaskToTop(task.getTaskToReturnTo()); mStackSupervisor.moveHomeStackTaskToTop(task.getTaskToReturnTo(), reason); } removeTask(task); removeTask(task, reason); } cleanUpActivityServicesLocked(r); r.removeUriPermissionsLocked(); Loading Loading @@ -3202,7 +3200,7 @@ final class ActivityStack { // up. //Slog.w(TAG, "Exception thrown during finish", e); if (r.finishing) { removeActivityFromHistoryLocked(r); removeActivityFromHistoryLocked(r, reason + " exceptionInScheduleDestroy"); removedFromHistory = true; skipDestroy = true; } Loading Loading @@ -3232,7 +3230,7 @@ final class ActivityStack { } else { // remove this record from the history. if (r.finishing) { removeActivityFromHistoryLocked(r); removeActivityFromHistoryLocked(r, reason + " hadNoApp"); removedFromHistory = true; } else { if (DEBUG_STATES) Slog.v(TAG, "Moving to DESTROYED: " + r + " (no app)"); Loading @@ -3251,7 +3249,7 @@ final class ActivityStack { return removedFromHistory; } final void activityDestroyedLocked(IBinder token) { final void activityDestroyedLocked(IBinder token, String reason) { final long origId = Binder.clearCallingIdentity(); try { ActivityRecord r = ActivityRecord.forToken(token); Loading @@ -3263,7 +3261,7 @@ final class ActivityStack { if (isInStackLocked(token) != null) { if (r.state == ActivityState.DESTROYING) { cleanUpActivityLocked(r, true, false); removeActivityFromHistoryLocked(r); removeActivityFromHistoryLocked(r, reason); } } mStackSupervisor.resumeTopActivitiesLocked(); Loading Loading @@ -3399,7 +3397,7 @@ final class ActivityStack { mService.updateUsageStats(r, false); } } removeActivityFromHistoryLocked(r); removeActivityFromHistoryLocked(r, "appDied"); } else { // We have the current state for this activity, so Loading Loading @@ -3468,15 +3466,16 @@ final class ActivityStack { } } final void moveTaskToFrontLocked(TaskRecord tr, ActivityRecord reason, Bundle options) { final void moveTaskToFrontLocked(TaskRecord tr, ActivityRecord source, Bundle options, String reason) { if (DEBUG_SWITCH) Slog.v(TAG, "moveTaskToFront: " + tr); final int numTasks = mTaskHistory.size(); final int index = mTaskHistory.indexOf(tr); if (numTasks == 0 || index < 0) { // nothing to do! if (reason != null && (reason.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) { if (source != null && (source.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) { ActivityOptions.abort(options); } else { updateTransitLocked(AppTransition.TRANSIT_TASK_TO_FRONT, options); Loading @@ -3487,11 +3486,11 @@ final class ActivityStack { // Shift all activities with this task up to the top // of the stack, keeping them in the same internal order. insertTaskAtTop(tr); moveToFront(); moveToFront(reason); if (DEBUG_TRANSITION) Slog.v(TAG, "Prepare to front transition: task=" + tr); if (reason != null && (reason.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) { if (source != null && (source.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) { mWindowManager.prepareAppTransition(AppTransition.TRANSIT_NONE, false); ActivityRecord r = topRunningActivityLocked(null); if (r != null) { Loading Loading @@ -3521,7 +3520,7 @@ final class ActivityStack { * @param taskId The taskId to collect and move to the bottom. * @return Returns true if the move completed, false if not. */ final boolean moveTaskToBackLocked(int taskId, ActivityRecord reason) { final boolean moveTaskToBackLocked(int taskId) { final TaskRecord tr = taskForIdLocked(taskId); if (tr == null) { Slog.i(TAG, "moveTaskToBack: bad taskId=" + taskId); Loading Loading @@ -3576,16 +3575,7 @@ final class ActivityStack { } } if (reason != null && (reason.intent.getFlags() & Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) { mWindowManager.prepareAppTransition(AppTransition.TRANSIT_NONE, false); ActivityRecord r = topRunningActivityLocked(null); if (r != null) { mNoAnimActivities.add(r); } } else { mWindowManager.prepareAppTransition(AppTransition.TRANSIT_TASK_TO_BACK, false); } mWindowManager.moveTaskToBottom(taskId); if (VALIDATE_TOKENS) { Loading @@ -3600,7 +3590,7 @@ final class ActivityStack { } final int taskToReturnTo = tr.getTaskToReturnTo(); tr.setTaskToReturnTo(APPLICATION_ACTIVITY_TYPE); return mStackSupervisor.resumeHomeStackTask(taskToReturnTo, null); return mStackSupervisor.resumeHomeStackTask(taskToReturnTo, null, "moveTaskToBack"); } mStackSupervisor.resumeTopActivitiesLocked(); Loading Loading @@ -4042,7 +4032,7 @@ final class ActivityStack { return starting; } void removeTask(TaskRecord task) { void removeTask(TaskRecord task, String reason) { mStackSupervisor.endLockTaskModeIfTaskEnding(task); mWindowManager.removeTask(task.taskId); final ActivityRecord r = mResumedActivity; Loading Loading @@ -4080,7 +4070,7 @@ final class ActivityStack { if (mTaskHistory.isEmpty()) { if (DEBUG_STACK) Slog.i(TAG, "removeTask: moving to back stack=" + this); if (isOnHomeDisplay()) { mStackSupervisor.moveHomeStack(!isHomeStack()); mStackSupervisor.moveHomeStack(!isHomeStack(), reason + " leftTaskHistoryEmpty"); } if (mStacks != null) { mStacks.remove(this); Loading services/core/java/com/android/server/am/ActivityStackSupervisor.java +30 −29 File changed.Preview size limit exceeded, changes collapsed. Show changes services/core/java/com/android/server/am/EventLogTags.logtags +1 −1 Original line number Diff line number Diff line Loading @@ -94,4 +94,4 @@ option java_package com.android.server.am 30043 am_focused_activity (User|1|5),(Component Name|3) # Home Stack brought to front or rear 30044 am_home_stack_moved (User|1|5),(To Front|1|5),(Top Stack Id|1|5),(Focused Stack Id|1|5) 30044 am_home_stack_moved (User|1|5),(To Front|1|5),(Top Stack Id|1|5),(Focused Stack Id|1|5),(Reason|3) Loading
services/core/java/com/android/server/am/ActivityManagerService.java +20 −19 Original line number Diff line number Diff line Loading @@ -2358,7 +2358,7 @@ public final class ActivityManagerService extends ActivityManagerNative return mAppBindArgs; } final void setFocusedActivityLocked(ActivityRecord r) { final void setFocusedActivityLocked(ActivityRecord r, String reason) { if (mFocusedActivity != r) { if (DEBUG_FOCUS) Slog.d(TAG, "setFocusedActivityLocked: r=" + r); mFocusedActivity = r; Loading @@ -2367,7 +2367,7 @@ public final class ActivityManagerService extends ActivityManagerNative } else { finishRunningVoiceLocked(); } mStackSupervisor.setFocusedStack(r); mStackSupervisor.setFocusedStack(r, reason + " setFocusedActivity"); if (r != null) { mWindowManager.setFocusedApp(r.appToken, true); } Loading @@ -2391,7 +2391,7 @@ public final class ActivityManagerService extends ActivityManagerNative if (stack != null) { ActivityRecord r = stack.topRunningActivityLocked(null); if (r != null) { setFocusedActivityLocked(r); setFocusedActivityLocked(r, "setFocusedStack"); } } } Loading Loading @@ -2435,7 +2435,7 @@ public final class ActivityManagerService extends ActivityManagerNative mHandler.sendMessage(msg); } private final int updateLruProcessInternalLocked(ProcessRecord app, long now, int index, private int updateLruProcessInternalLocked(ProcessRecord app, long now, int index, String what, Object obj, ProcessRecord srcApp) { app.lastActivityTime = now; Loading Loading @@ -3109,7 +3109,7 @@ public final class ActivityManagerService extends ActivityManagerNative return intent; } boolean startHomeActivityLocked(int userId) { boolean startHomeActivityLocked(int userId, String reason) { if (mFactoryTest == FactoryTest.FACTORY_TEST_LOW_LEVEL && mTopAction == null) { // We are running in factory test mode, but unable to find Loading @@ -3131,7 +3131,7 @@ public final class ActivityManagerService extends ActivityManagerNative aInfo.applicationInfo.uid, true); if (app == null || app.instrumentationClass == null) { intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK); mStackSupervisor.startHomeActivity(intent, aInfo); mStackSupervisor.startHomeActivity(intent, aInfo, reason); } } Loading Loading @@ -6343,7 +6343,7 @@ public final class ActivityManagerService extends ActivityManagerNative synchronized (this) { ActivityStack stack = ActivityRecord.getStackLocked(token); if (stack != null) { stack.activityDestroyedLocked(token); stack.activityDestroyedLocked(token, "activityDestroyed"); } } } Loading Loading @@ -8536,7 +8536,7 @@ public final class ActivityManagerService extends ActivityManagerNative if (prev != null && prev.isRecentsActivity()) { task.setTaskToReturnTo(ActivityRecord.RECENTS_ACTIVITY_TYPE); } mStackSupervisor.findTaskToMoveToFrontLocked(task, flags, options); mStackSupervisor.findTaskToMoveToFrontLocked(task, flags, options, "moveTaskToFront"); } finally { Binder.restoreCallingIdentity(origId); } Loading Loading @@ -8565,7 +8565,7 @@ public final class ActivityManagerService extends ActivityManagerNative } final long origId = Binder.clearCallingIdentity(); try { stack.moveTaskToBackLocked(taskId, null); stack.moveTaskToBackLocked(taskId); } finally { Binder.restoreCallingIdentity(origId); } Loading Loading @@ -8595,7 +8595,7 @@ public final class ActivityManagerService extends ActivityManagerNative mStackSupervisor.showLockTaskToast(); return false; } return ActivityRecord.getStackLocked(token).moveTaskToBackLocked(taskId, null); return ActivityRecord.getStackLocked(token).moveTaskToBackLocked(taskId); } } finally { Binder.restoreCallingIdentity(origId); Loading Loading @@ -8687,7 +8687,7 @@ public final class ActivityManagerService extends ActivityManagerNative try { if (DEBUG_STACK) Slog.d(TAG, "moveTaskToStack: moving task=" + taskId + " to stackId=" + stackId + " toTop=" + toTop); mStackSupervisor.moveTaskToStack(taskId, stackId, toTop); mStackSupervisor.moveTaskToStackLocked(taskId, stackId, toTop); } finally { Binder.restoreCallingIdentity(ident); } Loading Loading @@ -8793,7 +8793,8 @@ public final class ActivityManagerService extends ActivityManagerNative || (task != mStackSupervisor.getFocusedStack().topTask()))) { throw new IllegalArgumentException("Invalid task, not in foreground"); } mStackSupervisor.setLockTaskModeLocked(task, !isSystemInitiated); mStackSupervisor.setLockTaskModeLocked(task, !isSystemInitiated, "startLockTask"); } } } finally { Loading Loading @@ -8878,7 +8879,7 @@ public final class ActivityManagerService extends ActivityManagerNative Log.d(TAG, "stopLockTaskMode"); // Stop lock task synchronized (this) { mStackSupervisor.setLockTaskModeLocked(null, false); mStackSupervisor.setLockTaskModeLocked(null, false, "stopLockTask"); } } finally { Binder.restoreCallingIdentity(ident); Loading Loading @@ -11338,7 +11339,7 @@ public final class ActivityManagerService extends ActivityManagerNative // Start up initial activity. mBooting = true; startHomeActivityLocked(mCurrentUserId); startHomeActivityLocked(mCurrentUserId, "systemReady"); try { if (AppGlobals.getPackageManager().hasSystemUidErrors()) { Loading Loading @@ -18885,7 +18886,7 @@ public final class ActivityManagerService extends ActivityManagerNative return true; } mStackSupervisor.setLockTaskModeLocked(null, false); mStackSupervisor.setLockTaskModeLocked(null, false, "startUser"); final UserInfo userInfo = getUserManagerLocked().getUserInfo(userId); if (userInfo == null) { Loading Loading @@ -19142,7 +19143,7 @@ public final class ActivityManagerService extends ActivityManagerNative void moveUserToForeground(UserStartedState uss, int oldUserId, int newUserId) { boolean homeInFront = mStackSupervisor.switchUserLocked(newUserId, uss); if (homeInFront) { startHomeActivityLocked(newUserId); startHomeActivityLocked(newUserId, "moveUserToFroreground"); } else { mStackSupervisor.resumeTopActivitiesLocked(); }
services/core/java/com/android/server/am/ActivityRecord.java +1 −1 Original line number Diff line number Diff line Loading @@ -516,7 +516,7 @@ final class ActivityRecord { void setTask(TaskRecord newTask, TaskRecord taskToAffiliateWith) { if (task != null && task.removeActivity(this)) { if (task != newTask) { task.stack.removeTask(task); task.stack.removeTask(task, "setTask"); } else { Slog.d(TAG, "!!! REMOVE THIS LOG !!! setTask: nearly removed stack=" + (newTask == null ? null : newTask.stack)); Loading
services/core/java/com/android/server/am/ActivityStack.java +33 −43 Original line number Diff line number Diff line Loading @@ -291,7 +291,7 @@ final class ActivityStack { // so we need to be conservative and assume it isn't. Slog.w(TAG, "Activity destroy timeout for " + r); synchronized (mService) { activityDestroyedLocked(r != null ? r.appToken : null); activityDestroyedLocked(r != null ? r.appToken : null, "destroyTimeout"); } } break; case STOP_TIMEOUT_MSG: { Loading Loading @@ -473,10 +473,10 @@ final class ActivityStack { mActivityContainer.mActivityDisplay.mDisplayId == Display.DEFAULT_DISPLAY; } final void moveToFront() { final void moveToFront(String reason) { if (isAttached()) { if (isOnHomeDisplay()) { mStackSupervisor.moveHomeStack(isHomeStack()); mStackSupervisor.moveHomeStack(isHomeStack(), reason); } mStacks.remove(this); mStacks.add(this); Loading Loading @@ -1496,7 +1496,7 @@ final class ActivityStack { final int returnTaskType = prevTask == null || !prevTask.isOverHomeStack() ? HOME_ACTIVITY_TYPE : prevTask.getTaskToReturnTo(); return isOnHomeDisplay() && mStackSupervisor.resumeHomeStackTask(returnTaskType, prev); mStackSupervisor.resumeHomeStackTask(returnTaskType, prev, "noMoreActivities"); } next.delayedResume = false; Loading Loading @@ -1532,7 +1532,7 @@ final class ActivityStack { "resumeTopActivityLocked: Launching home next"); final int returnTaskType = prevTask == null || !prevTask.isOverHomeStack() ? HOME_ACTIVITY_TYPE : prevTask.getTaskToReturnTo(); return mStackSupervisor.resumeHomeStackTask(returnTaskType, prev); return mStackSupervisor.resumeHomeStackTask(returnTaskType, prev, "prevFinished"); } } Loading Loading @@ -1817,11 +1817,8 @@ final class ActivityStack { next.app.thread.scheduleNewIntent(next.newIntents, next.appToken); } EventLog.writeEvent(EventLogTags.AM_RESUME_ACTIVITY, next.userId, System.identityHashCode(next), next.task.taskId, next.shortComponentName + " top=" + mStacks.get(mStacks.size() - 1).mStackId + " Callers=" + Debug.getCallers(6)); EventLog.writeEvent(EventLogTags.AM_RESUME_ACTIVITY, next.userId, System.identityHashCode(next), next.task.taskId, next.shortComponentName); next.sleeping = false; mService.showAskCompatModeDialogLocked(next); Loading Loading @@ -2468,18 +2465,19 @@ final class ActivityStack { r.addResultLocked(null, resultWho, requestCode, resultCode, data); } private void adjustFocusedActivityLocked(ActivityRecord r) { private void adjustFocusedActivityLocked(ActivityRecord r, String reason) { if (mStackSupervisor.isFrontStack(this) && mService.mFocusedActivity == r) { ActivityRecord next = topRunningActivityLocked(null); if (next != r) { final TaskRecord task = r.task; if (r.frontOfTask && task == topTask() && task.isOverHomeStack()) { mStackSupervisor.moveHomeStackTaskToTop(task.getTaskToReturnTo()); mStackSupervisor.moveHomeStackTaskToTop(task.getTaskToReturnTo(), reason + " adjustFocus"); } } ActivityRecord top = mStackSupervisor.topRunningActivityLocked(); if (top != null) { mService.setFocusedActivityLocked(top); mService.setFocusedActivityLocked(top, reason + " adjustTopFocus"); } } } Loading @@ -2503,7 +2501,7 @@ final class ActivityStack { } if (r.app != null && r.app.thread != null) { adjustFocusedActivityLocked(r); adjustFocusedActivityLocked(r, "stopActivity"); r.resumeKeyDispatchingLocked(); try { r.stopped = false; Loading Loading @@ -2707,7 +2705,7 @@ final class ActivityStack { r.pauseKeyDispatchingLocked(); adjustFocusedActivityLocked(r); adjustFocusedActivityLocked(r, "finishActivity"); finishActivityResultsLocked(r, resultCode, resultData); Loading Loading @@ -3010,7 +3008,7 @@ final class ActivityStack { r.finishLaunchTickingLocked(); } private void removeActivityFromHistoryLocked(ActivityRecord r) { private void removeActivityFromHistoryLocked(ActivityRecord r, String reason) { mStackSupervisor.removeChildActivityContainers(r); finishActivityResultsLocked(r, Activity.RESULT_CANCELED, null); r.makeFinishing(); Loading @@ -3035,9 +3033,9 @@ final class ActivityStack { "removeActivityFromHistoryLocked: last activity removed from " + this); if (mStackSupervisor.isFrontStack(this) && task == topTask() && task.isOverHomeStack()) { mStackSupervisor.moveHomeStackTaskToTop(task.getTaskToReturnTo()); mStackSupervisor.moveHomeStackTaskToTop(task.getTaskToReturnTo(), reason); } removeTask(task); removeTask(task, reason); } cleanUpActivityServicesLocked(r); r.removeUriPermissionsLocked(); Loading Loading @@ -3202,7 +3200,7 @@ final class ActivityStack { // up. //Slog.w(TAG, "Exception thrown during finish", e); if (r.finishing) { removeActivityFromHistoryLocked(r); removeActivityFromHistoryLocked(r, reason + " exceptionInScheduleDestroy"); removedFromHistory = true; skipDestroy = true; } Loading Loading @@ -3232,7 +3230,7 @@ final class ActivityStack { } else { // remove this record from the history. if (r.finishing) { removeActivityFromHistoryLocked(r); removeActivityFromHistoryLocked(r, reason + " hadNoApp"); removedFromHistory = true; } else { if (DEBUG_STATES) Slog.v(TAG, "Moving to DESTROYED: " + r + " (no app)"); Loading @@ -3251,7 +3249,7 @@ final class ActivityStack { return removedFromHistory; } final void activityDestroyedLocked(IBinder token) { final void activityDestroyedLocked(IBinder token, String reason) { final long origId = Binder.clearCallingIdentity(); try { ActivityRecord r = ActivityRecord.forToken(token); Loading @@ -3263,7 +3261,7 @@ final class ActivityStack { if (isInStackLocked(token) != null) { if (r.state == ActivityState.DESTROYING) { cleanUpActivityLocked(r, true, false); removeActivityFromHistoryLocked(r); removeActivityFromHistoryLocked(r, reason); } } mStackSupervisor.resumeTopActivitiesLocked(); Loading Loading @@ -3399,7 +3397,7 @@ final class ActivityStack { mService.updateUsageStats(r, false); } } removeActivityFromHistoryLocked(r); removeActivityFromHistoryLocked(r, "appDied"); } else { // We have the current state for this activity, so Loading Loading @@ -3468,15 +3466,16 @@ final class ActivityStack { } } final void moveTaskToFrontLocked(TaskRecord tr, ActivityRecord reason, Bundle options) { final void moveTaskToFrontLocked(TaskRecord tr, ActivityRecord source, Bundle options, String reason) { if (DEBUG_SWITCH) Slog.v(TAG, "moveTaskToFront: " + tr); final int numTasks = mTaskHistory.size(); final int index = mTaskHistory.indexOf(tr); if (numTasks == 0 || index < 0) { // nothing to do! if (reason != null && (reason.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) { if (source != null && (source.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) { ActivityOptions.abort(options); } else { updateTransitLocked(AppTransition.TRANSIT_TASK_TO_FRONT, options); Loading @@ -3487,11 +3486,11 @@ final class ActivityStack { // Shift all activities with this task up to the top // of the stack, keeping them in the same internal order. insertTaskAtTop(tr); moveToFront(); moveToFront(reason); if (DEBUG_TRANSITION) Slog.v(TAG, "Prepare to front transition: task=" + tr); if (reason != null && (reason.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) { if (source != null && (source.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) { mWindowManager.prepareAppTransition(AppTransition.TRANSIT_NONE, false); ActivityRecord r = topRunningActivityLocked(null); if (r != null) { Loading Loading @@ -3521,7 +3520,7 @@ final class ActivityStack { * @param taskId The taskId to collect and move to the bottom. * @return Returns true if the move completed, false if not. */ final boolean moveTaskToBackLocked(int taskId, ActivityRecord reason) { final boolean moveTaskToBackLocked(int taskId) { final TaskRecord tr = taskForIdLocked(taskId); if (tr == null) { Slog.i(TAG, "moveTaskToBack: bad taskId=" + taskId); Loading Loading @@ -3576,16 +3575,7 @@ final class ActivityStack { } } if (reason != null && (reason.intent.getFlags() & Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) { mWindowManager.prepareAppTransition(AppTransition.TRANSIT_NONE, false); ActivityRecord r = topRunningActivityLocked(null); if (r != null) { mNoAnimActivities.add(r); } } else { mWindowManager.prepareAppTransition(AppTransition.TRANSIT_TASK_TO_BACK, false); } mWindowManager.moveTaskToBottom(taskId); if (VALIDATE_TOKENS) { Loading @@ -3600,7 +3590,7 @@ final class ActivityStack { } final int taskToReturnTo = tr.getTaskToReturnTo(); tr.setTaskToReturnTo(APPLICATION_ACTIVITY_TYPE); return mStackSupervisor.resumeHomeStackTask(taskToReturnTo, null); return mStackSupervisor.resumeHomeStackTask(taskToReturnTo, null, "moveTaskToBack"); } mStackSupervisor.resumeTopActivitiesLocked(); Loading Loading @@ -4042,7 +4032,7 @@ final class ActivityStack { return starting; } void removeTask(TaskRecord task) { void removeTask(TaskRecord task, String reason) { mStackSupervisor.endLockTaskModeIfTaskEnding(task); mWindowManager.removeTask(task.taskId); final ActivityRecord r = mResumedActivity; Loading Loading @@ -4080,7 +4070,7 @@ final class ActivityStack { if (mTaskHistory.isEmpty()) { if (DEBUG_STACK) Slog.i(TAG, "removeTask: moving to back stack=" + this); if (isOnHomeDisplay()) { mStackSupervisor.moveHomeStack(!isHomeStack()); mStackSupervisor.moveHomeStack(!isHomeStack(), reason + " leftTaskHistoryEmpty"); } if (mStacks != null) { mStacks.remove(this); Loading
services/core/java/com/android/server/am/ActivityStackSupervisor.java +30 −29 File changed.Preview size limit exceeded, changes collapsed. Show changes
services/core/java/com/android/server/am/EventLogTags.logtags +1 −1 Original line number Diff line number Diff line Loading @@ -94,4 +94,4 @@ option java_package com.android.server.am 30043 am_focused_activity (User|1|5),(Component Name|3) # Home Stack brought to front or rear 30044 am_home_stack_moved (User|1|5),(To Front|1|5),(Top Stack Id|1|5),(Focused Stack Id|1|5) 30044 am_home_stack_moved (User|1|5),(To Front|1|5),(Top Stack Id|1|5),(Focused Stack Id|1|5),(Reason|3)