Converted more AMS Log calls to use ActivityManagerDebugConfig
Bug: 21276405
Change-Id: I90d47b1b28f716e650df7f4377ed7cdd30b46ec8
diff --git a/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java b/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java
index ec2bd67..16c959f 100644
--- a/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java
+++ b/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java
@@ -41,14 +41,21 @@
// Enable all debug log categories.
static final boolean DEBUG_ALL = false;
+ // Enable all debug log categories for activities.
+ static final boolean DEBUG_ALL_ACTIVITIES = DEBUG_ALL || false;
+
// Available log categories in the activity manager package.
+ static final boolean DEBUG_ADD_REMOVE = DEBUG_ALL_ACTIVITIES || false;
+ static final boolean DEBUG_APP = DEBUG_ALL_ACTIVITIES || false;
static final boolean DEBUG_BACKUP = DEBUG_ALL || false;
static final boolean DEBUG_BROADCAST = DEBUG_ALL || false;
static final boolean DEBUG_BROADCAST_BACKGROUND = DEBUG_BROADCAST || false;
static final boolean DEBUG_BROADCAST_LIGHT = DEBUG_BROADCAST || false;
static final boolean DEBUG_CLEANUP = DEBUG_ALL || false;
static final boolean DEBUG_CONFIGURATION = DEBUG_ALL || false;
+ static final boolean DEBUG_CONTAINERS = DEBUG_ALL_ACTIVITIES || false;
static final boolean DEBUG_FOCUS = false;
+ static final boolean DEBUG_IDLE = DEBUG_ALL_ACTIVITIES || false;
static final boolean DEBUG_IMMERSIVE = DEBUG_ALL || false;
static final boolean DEBUG_LOCKSCREEN = DEBUG_ALL || false;
static final boolean DEBUG_LOCKTASK = DEBUG_ALL || false;
@@ -63,10 +70,14 @@
static final boolean DEBUG_PROVIDER = DEBUG_ALL || false;
static final boolean DEBUG_PSS = DEBUG_ALL || false;
static final boolean DEBUG_RECENTS = DEBUG_ALL || false;
+ static final boolean DEBUG_RELEASE = DEBUG_ALL_ACTIVITIES || false;
static final boolean DEBUG_RESULTS = DEBUG_ALL || false;
+ static final boolean DEBUG_SAVED_STATE = DEBUG_ALL_ACTIVITIES || false;
+ static final boolean DEBUG_SCREENSHOTS = DEBUG_ALL_ACTIVITIES || false;
static final boolean DEBUG_SERVICE = DEBUG_ALL || false;
static final boolean DEBUG_SERVICE_EXECUTING = DEBUG_ALL || false;
static final boolean DEBUG_STACK = DEBUG_ALL || false;
+ static final boolean DEBUG_STATES = DEBUG_ALL_ACTIVITIES || false;
static final boolean DEBUG_SWITCH = DEBUG_ALL || false;
static final boolean DEBUG_TASKS = DEBUG_ALL || false;
static final boolean DEBUG_THUMBNAILS = DEBUG_ALL || false;
@@ -75,16 +86,21 @@
static final boolean DEBUG_URI_PERMISSION = DEBUG_ALL || false;
static final boolean DEBUG_USER_LEAVING = DEBUG_ALL || false;
static final boolean DEBUG_VISIBILITY = DEBUG_ALL || false;
+ static final boolean DEBUG_VISIBLE_BEHIND = DEBUG_ALL_ACTIVITIES || false;
static final boolean DEBUG_USAGE_STATS = DEBUG_ALL || false;
+ static final String POSTFIX_ADD_REMOVE = (APPEND_CATEGORY_NAME) ? "_AddRemove" : "";
+ static final String POSTFIX_APP = (APPEND_CATEGORY_NAME) ? "_App" : "";
static final String POSTFIX_BACKUP = (APPEND_CATEGORY_NAME) ? "_Backup" : "";
static final String POSTFIX_BROADCAST = (APPEND_CATEGORY_NAME) ? "_Broadcast" : "";
static final String POSTFIX_CLEANUP = (APPEND_CATEGORY_NAME) ? "_Cleanup" : "";
static final String POSTFIX_CONFIGURATION = (APPEND_CATEGORY_NAME) ? "_Configuration" : "";
+ static final String POSTFIX_CONTAINERS = (APPEND_CATEGORY_NAME) ? "_Containers" : "";
static final String POSTFIX_FOCUS = (APPEND_CATEGORY_NAME) ? "_Focus" : "";
+ static final String POSTFIX_IDLE = (APPEND_CATEGORY_NAME) ? "_Idle" : "";
static final String POSTFIX_IMMERSIVE = (APPEND_CATEGORY_NAME) ? "_Immersive" : "";
- static final String POSTFIX_LOCKSCREEN = (APPEND_CATEGORY_NAME) ? "_LOCKSCREEN" : "";
- static final String POSTFIX_LOCKTASK = (APPEND_CATEGORY_NAME) ? "_LOCKTASK" : "";
+ static final String POSTFIX_LOCKSCREEN = (APPEND_CATEGORY_NAME) ? "_LockScreen" : "";
+ static final String POSTFIX_LOCKTASK = (APPEND_CATEGORY_NAME) ? "_LockTask" : "";
static final String POSTFIX_LRU = (APPEND_CATEGORY_NAME) ? "_LRU" : "";
static final String POSTFIX_MU = "_MU";
static final String POSTFIX_OOM_ADJ = (APPEND_CATEGORY_NAME) ? "_OomAdj" : "";
@@ -95,12 +111,16 @@
static final String POSTFIX_PROCESSES = (APPEND_CATEGORY_NAME) ? "_Processes" : "";
static final String POSTFIX_PROVIDER = (APPEND_CATEGORY_NAME) ? "_Provider" : "";
static final String POSTFIX_PSS = (APPEND_CATEGORY_NAME) ? "_Pss" : "";
- static final String POSTFIX_RESULTS = (APPEND_CATEGORY_NAME) ? "_Results" : "";
static final String POSTFIX_RECENTS = (APPEND_CATEGORY_NAME) ? "_Recents" : "";
+ static final String POSTFIX_RELEASE = (APPEND_CATEGORY_NAME) ? "_Release" : "";
+ static final String POSTFIX_RESULTS = (APPEND_CATEGORY_NAME) ? "_Results" : "";
+ static final String POSTFIX_SAVED_STATE = (APPEND_CATEGORY_NAME) ? "_SavedState" : "";
+ static final String POSTFIX_SCREENSHOTS = (APPEND_CATEGORY_NAME) ? "_Screenshots" : "";
static final String POSTFIX_SERVICE = (APPEND_CATEGORY_NAME) ? "_Service" : "";
static final String POSTFIX_SERVICE_EXECUTING =
(APPEND_CATEGORY_NAME) ? "_ServiceExecuting" : "";
static final String POSTFIX_STACK = (APPEND_CATEGORY_NAME) ? "_Stack" : "";
+ static final String POSTFIX_STATES = (APPEND_CATEGORY_NAME) ? "_States" : "";
static final String POSTFIX_SWITCH = (APPEND_CATEGORY_NAME) ? "_Switch" : "";
static final String POSTFIX_TASKS = (APPEND_CATEGORY_NAME) ? "_Tasks" : "";
static final String POSTFIX_THUMBNAILS = (APPEND_CATEGORY_NAME) ? "_Thumbnails" : "";
@@ -110,5 +130,6 @@
static final String POSTFIX_URI_PERMISSION = (APPEND_CATEGORY_NAME) ? "_UriPermission" : "";
static final String POSTFIX_USER_LEAVING = (APPEND_CATEGORY_NAME) ? "_UserLeaving" : "";
static final String POSTFIX_VISIBILITY = (APPEND_CATEGORY_NAME) ? "_Visibility" : "";
+ static final String POSTFIX_VISIBLE_BEHIND = (APPEND_CATEGORY_NAME) ? "_VisibleBehind" : "";
}
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index b111b36..9e07544 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -281,6 +281,7 @@
private static final String TAG_UID_OBSERVERS = TAG + POSTFIX_UID_OBSERVERS;
private static final String TAG_URI_PERMISSION = TAG + POSTFIX_URI_PERMISSION;
private static final String TAG_VISIBILITY = TAG + POSTFIX_VISIBILITY;
+ private static final String TAG_VISIBLE_BEHIND = TAG + POSTFIX_VISIBLE_BEHIND;
/** Control over CPU and battery monitoring */
// write battery stats every 30 minutes.
@@ -10837,7 +10838,7 @@
synchronized (this) {
final ActivityStack stack = ActivityRecord.getStackLocked(token);
final boolean visible = stack == null ? false : stack.hasVisibleBehindActivity();
- if (ActivityStackSupervisor.DEBUG_VISIBLE_BEHIND) Slog.d(TAG,
+ if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG_VISIBLE_BEHIND,
"isBackgroundVisibleBehind: stack=" + stack + " visible=" + visible);
return visible;
}
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index 54dd491..3765a3c 100755
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -72,11 +72,11 @@
*/
final class ActivityRecord {
private static final String TAG = TAG_WITH_CLASS_NAME ? "ActivityRecord" : TAG_AM;
+ private static final String TAG_STATES = TAG + POSTFIX_STATES;
private static final String TAG_SWITCH = TAG + POSTFIX_SWITCH;
private static final String TAG_THUMBNAILS = TAG + POSTFIX_THUMBNAILS;
private static final boolean SHOW_ACTIVITY_START_TIME = true;
- static final boolean DEBUG_SAVED_STATE = ActivityStackSupervisor.DEBUG_SAVED_STATE;
final public static String RECENTS_PACKAGE_NAME = "com.android.systemui.recents";
private static final String ATTR_ID = "id";
@@ -1093,7 +1093,7 @@
static void activityResumedLocked(IBinder token) {
final ActivityRecord r = ActivityRecord.forTokenLocked(token);
- if (DEBUG_SAVED_STATE) Slog.i(TAG, "Resumed activity; dropping state of: " + r);
+ if (DEBUG_SAVED_STATE) Slog.i(TAG_STATES, "Resumed activity; dropping state of: " + r);
r.icicle = null;
r.haveState = false;
}
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index a4c557f..30ee214 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -23,13 +23,6 @@
import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE;
import static com.android.server.am.ActivityRecord.APPLICATION_ACTIVITY_TYPE;
-import static com.android.server.am.ActivityStackSupervisor.DEBUG_ADD_REMOVE;
-import static com.android.server.am.ActivityStackSupervisor.DEBUG_APP;
-import static com.android.server.am.ActivityStackSupervisor.DEBUG_CONTAINERS;
-import static com.android.server.am.ActivityStackSupervisor.DEBUG_RELEASE;
-import static com.android.server.am.ActivityStackSupervisor.DEBUG_SAVED_STATE;
-import static com.android.server.am.ActivityStackSupervisor.DEBUG_SCREENSHOTS;
-import static com.android.server.am.ActivityStackSupervisor.DEBUG_STATES;
import static com.android.server.am.ActivityStackSupervisor.HOME_STACK_ID;
import android.util.ArraySet;
@@ -89,11 +82,18 @@
final class ActivityStack {
private static final String TAG = TAG_WITH_CLASS_NAME ? "ActivityStack" : TAG_AM;
+ private static final String TAG_ADD_REMOVE = TAG + POSTFIX_ADD_REMOVE;
+ private static final String TAG_APP = TAG + POSTFIX_APP;
private static final String TAG_CLEANUP = TAG + POSTFIX_CLEANUP;
private static final String TAG_CONFIGURATION = TAG + POSTFIX_CONFIGURATION;
+ private static final String TAG_CONTAINERS = TAG + POSTFIX_CONTAINERS;
private static final String TAG_PAUSE = TAG + POSTFIX_PAUSE;
+ private static final String TAG_RELEASE = TAG + POSTFIX_RELEASE;
private static final String TAG_RESULTS = TAG + POSTFIX_RESULTS;
+ private static final String TAG_SAVED_STATE = TAG + POSTFIX_SAVED_STATE;
+ private static final String TAG_SCREENSHOTS = TAG + POSTFIX_SCREENSHOTS;
private static final String TAG_STACK = TAG + POSTFIX_STACK;
+ private static final String TAG_STATES = TAG + POSTFIX_STATES;
private static final String TAG_SWITCH = TAG + POSTFIX_SWITCH;
private static final String TAG_TASKS = TAG + POSTFIX_TASKS;
private static final String TAG_TRANSITION = TAG + POSTFIX_TRANSITION;
@@ -666,8 +666,8 @@
void minimalResumeActivityLocked(ActivityRecord r) {
r.state = ActivityState.RESUMED;
- if (DEBUG_STATES) Slog.v(TAG, "Moving to RESUMED: " + r
- + " (starting new instance)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES,
+ "Moving to RESUMED: " + r + " (starting new instance)");
r.stopped = false;
mResumedActivity = r;
r.task.touchActiveTime();
@@ -675,7 +675,8 @@
completeResumeLocked(r);
mStackSupervisor.checkReadyForSleepLocked();
setLaunchTime(r);
- if (DEBUG_SAVED_STATE) Slog.i(TAG, "Launch completed; removing icicle of " + r.icicle);
+ if (DEBUG_SAVED_STATE) Slog.i(TAG_SAVED_STATE,
+ "Launch completed; removing icicle of " + r.icicle);
}
private void startLaunchTraces() {
@@ -752,7 +753,8 @@
// Stop visible behind activity before going to sleep.
final ActivityRecord r = mActivityContainer.mActivityDisplay.mVisibleBehindActivity;
mStackSupervisor.mStoppingActivities.add(r);
- if (DEBUG_STATES) Slog.v(TAG, "Sleep still waiting to stop visible behind " + r);
+ if (DEBUG_STATES) Slog.v(TAG_STATES,
+ "Sleep still waiting to stop visible behind " + r);
return true;
}
@@ -776,23 +778,23 @@
}
public final Bitmap screenshotActivities(ActivityRecord who) {
- if (DEBUG_SCREENSHOTS) Slog.d(TAG, "screenshotActivities: " + who);
+ if (DEBUG_SCREENSHOTS) Slog.d(TAG_SCREENSHOTS, "screenshotActivities: " + who);
if (who.noDisplay) {
- if (DEBUG_SCREENSHOTS) Slog.d(TAG, "\tNo display");
+ if (DEBUG_SCREENSHOTS) Slog.d(TAG_SCREENSHOTS, "\tNo display");
return null;
}
if (isHomeStack()) {
// This is an optimization -- since we never show Home or Recents within Recents itself,
// we can just go ahead and skip taking the screenshot if this is the home stack.
- if (DEBUG_SCREENSHOTS) Slog.d(TAG, "\tHome stack");
+ if (DEBUG_SCREENSHOTS) Slog.d(TAG_SCREENSHOTS, "\tHome stack");
return null;
}
int w = mService.mThumbnailWidth;
int h = mService.mThumbnailHeight;
if (w > 0) {
- if (DEBUG_SCREENSHOTS) Slog.d(TAG, "\tTaking screenshot");
+ if (DEBUG_SCREENSHOTS) Slog.d(TAG_SCREENSHOTS, "\tTaking screenshot");
return mWindowManager.screenshotApplications(who.appToken, Display.DEFAULT_DISPLAY,
w, h);
}
@@ -840,7 +842,7 @@
mStackSupervisor.pauseChildStacks(prev, userLeaving, uiSleeping, resuming, dontWait);
}
- if (DEBUG_STATES) Slog.v(TAG, "Moving to PAUSING: " + prev);
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to PAUSING: " + prev);
else if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Start pausing: " + prev);
mResumedActivity = null;
mPausingActivity = prev;
@@ -934,7 +936,7 @@
if (r != null) {
mHandler.removeMessages(PAUSE_TIMEOUT_MSG, r);
if (mPausingActivity == r) {
- if (DEBUG_STATES) Slog.v(TAG, "Moving to PAUSED: " + r
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to PAUSED: " + r
+ (timeout ? " (due to timeout)" : " (pause complete)"));
completePauseLocked(true);
} else {
@@ -962,7 +964,7 @@
r.persistentState = persistentState;
mService.notifyTaskPersisterLocked(r.task, false);
}
- if (DEBUG_SAVED_STATE) Slog.i(TAG, "Saving icicle of " + r + ": " + icicle);
+ if (DEBUG_SAVED_STATE) Slog.i(TAG_SAVED_STATE, "Saving icicle of " + r + ": " + icicle);
if (icicle != null) {
// If icicle is null, this is happening due to a timeout, so we
// haven't really saved the state.
@@ -972,7 +974,7 @@
r.updateThumbnailLocked(null, description);
}
if (!r.stopped) {
- if (DEBUG_STATES) Slog.v(TAG, "Moving to STOPPED: " + r + " (stop complete)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to STOPPED: " + r + " (stop complete)");
mHandler.removeMessages(STOP_TIMEOUT_MSG, r);
r.stopped = true;
r.state = ActivityState.STOPPED;
@@ -1594,7 +1596,8 @@
}
// Let's just start up the Launcher...
ActivityOptions.abort(options);
- if (DEBUG_STATES) Slog.d(TAG, "resumeTopActivityLocked: No more activities go home");
+ if (DEBUG_STATES) Slog.d(TAG_STATES,
+ "resumeTopActivityLocked: No more activities go home");
if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked();
// Only resume home if on home display
final int returnTaskType = prevTask == null || !prevTask.isOverHomeStack() ?
@@ -1613,7 +1616,8 @@
mWindowManager.executeAppTransition();
mNoAnimActivities.clear();
ActivityOptions.abort(options);
- if (DEBUG_STATES) Slog.d(TAG, "resumeTopActivityLocked: Top activity resumed " + next);
+ if (DEBUG_STATES) Slog.d(TAG_STATES,
+ "resumeTopActivityLocked: Top activity resumed " + next);
if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked();
return false;
}
@@ -1632,7 +1636,7 @@
} else if (!isOnHomeDisplay()) {
return false;
} else if (!isHomeStack()){
- if (DEBUG_STATES) Slog.d(TAG,
+ if (DEBUG_STATES) Slog.d(TAG_STATES,
"resumeTopActivityLocked: Launching home next");
final int returnTaskType = prevTask == null || !prevTask.isOverHomeStack() ?
HOME_ACTIVITY_TYPE : prevTask.getTaskToReturnTo();
@@ -1651,7 +1655,8 @@
mWindowManager.executeAppTransition();
mNoAnimActivities.clear();
ActivityOptions.abort(options);
- if (DEBUG_STATES) Slog.d(TAG, "resumeTopActivityLocked: Going to sleep and all paused");
+ if (DEBUG_STATES) Slog.d(TAG_STATES,
+ "resumeTopActivityLocked: Going to sleep and all paused");
if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked();
return false;
}
@@ -1720,11 +1725,12 @@
boolean dontWaitForPause = (next.info.flags&ActivityInfo.FLAG_RESUME_WHILE_PAUSING) != 0;
boolean pausing = mStackSupervisor.pauseBackStacks(userLeaving, true, dontWaitForPause);
if (mResumedActivity != null) {
- if (DEBUG_STATES) Slog.d(TAG, "resumeTopActivityLocked: Pausing " + mResumedActivity);
+ if (DEBUG_STATES) Slog.d(TAG_STATES,
+ "resumeTopActivityLocked: Pausing " + mResumedActivity);
pausing |= startPausingLocked(userLeaving, false, true, dontWaitForPause);
}
if (pausing) {
- if (DEBUG_SWITCH || DEBUG_STATES) Slog.v(TAG,
+ if (DEBUG_SWITCH || DEBUG_STATES) Slog.v(TAG_STATES,
"resumeTopActivityLocked: Skip resume: need to start pausing");
// At this point we want to put the upcoming activity's process
// at the top of the LRU list, since we know we will be needing it
@@ -1742,8 +1748,8 @@
// sure to finish it as we're making a new activity topmost.
if (mService.isSleeping() && mLastNoHistoryActivity != null &&
!mLastNoHistoryActivity.finishing) {
- if (DEBUG_STATES) Slog.d(TAG, "no-history finish of " + mLastNoHistoryActivity +
- " on new resume");
+ if (DEBUG_STATES) Slog.d(TAG_STATES,
+ "no-history finish of " + mLastNoHistoryActivity + " on new resume");
requestFinishActivityLocked(mLastNoHistoryActivity.appToken, Activity.RESULT_CANCELED,
null, "resume-no-history", false);
mLastNoHistoryActivity = null;
@@ -1864,7 +1870,7 @@
mService.updateCpuStats();
- if (DEBUG_STATES) Slog.v(TAG, "Moving to RESUMED: " + next + " (in existing)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to RESUMED: " + next + " (in existing)");
next.state = ActivityState.RESUMED;
mResumedActivity = next;
next.task.touchActiveTime();
@@ -1893,7 +1899,7 @@
// is still at the top and schedule another run if something
// weird happened.
ActivityRecord nextNext = topRunningActivityLocked(null);
- if (DEBUG_SWITCH || DEBUG_STATES) Slog.i(TAG,
+ if (DEBUG_SWITCH || DEBUG_STATES) Slog.i(TAG_STATES,
"Activity config changed during resume: " + next
+ ", new next: " + nextNext);
if (nextNext != next) {
@@ -1938,10 +1944,10 @@
mStackSupervisor.checkReadyForSleepLocked();
- if (DEBUG_STATES) Slog.d(TAG, "resumeTopActivityLocked: Resumed " + next);
+ if (DEBUG_STATES) Slog.d(TAG_STATES, "resumeTopActivityLocked: Resumed " + next);
} catch (Exception e) {
// Whoops, need to restart this activity!
- if (DEBUG_STATES) Slog.v(TAG, "Resume failed; resetting state to "
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Resume failed; resetting state to "
+ lastState + ": " + next);
next.state = lastState;
if (lastStack != null) {
@@ -1995,7 +2001,7 @@
}
if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Restarting: " + next);
}
- if (DEBUG_STATES) Slog.d(TAG, "resumeTopActivityLocked: Restarting " + next);
+ if (DEBUG_STATES) Slog.d(TAG_STATES, "resumeTopActivityLocked: Restarting " + next);
mStackSupervisor.startSpecificActivityLocked(next, true, true);
}
@@ -2345,9 +2351,9 @@
noOptions = false;
}
}
- if (DEBUG_ADD_REMOVE) Slog.i(TAG, "Removing activity " + p + " from task="
- + task + " adding to task=" + targetTask
- + " Callers=" + Debug.getCallers(4));
+ if (DEBUG_ADD_REMOVE) Slog.i(TAG_ADD_REMOVE,
+ "Removing activity " + p + " from task=" + task + " adding to task="
+ + targetTask + " Callers=" + Debug.getCallers(4));
if (DEBUG_TASKS) Slog.v(TAG_TASKS,
"Pushing next activity " + p + " out to target's task " + target.task);
p.setTask(targetTask, null);
@@ -2490,9 +2496,9 @@
p.setTask(task, null);
task.addActivityAtIndex(taskInsertionPoint, p);
- if (DEBUG_ADD_REMOVE) Slog.i(TAG, "Removing and adding activity " + p
- + " to stack at " + task,
- new RuntimeException("here").fillInStackTrace());
+ if (DEBUG_ADD_REMOVE) Slog.i(TAG_ADD_REMOVE,
+ "Removing and adding activity " + p + " to stack at " + task
+ + " callers=" + Debug.getCallers(3));
if (DEBUG_TASKS) Slog.v(TAG_TASKS, "Pulling activity " + p
+ " from " + srcPos + " in to resetting task " + task);
mWindowManager.setAppTask(p.appToken, taskId);
@@ -2657,13 +2663,11 @@
|| (r.info.flags&ActivityInfo.FLAG_NO_HISTORY) != 0) {
if (!r.finishing) {
if (!mService.isSleeping()) {
- if (DEBUG_STATES) {
- Slog.d(TAG, "no-history finish of " + r);
- }
+ if (DEBUG_STATES) Slog.d(TAG_STATES, "no-history finish of " + r);
requestFinishActivityLocked(r.appToken, Activity.RESULT_CANCELED, null,
"stop-no-history", false);
} else {
- if (DEBUG_STATES) Slog.d(TAG, "Not finishing noHistory " + r
+ if (DEBUG_STATES) Slog.d(TAG_STATES, "Not finishing noHistory " + r
+ " on stop because we're just sleeping");
}
}
@@ -2674,8 +2678,8 @@
r.resumeKeyDispatchingLocked();
try {
r.stopped = false;
- if (DEBUG_STATES) Slog.v(TAG, "Moving to STOPPING: " + r
- + " (stop requested)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES,
+ "Moving to STOPPING: " + r + " (stop requested)");
r.state = ActivityState.STOPPING;
if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY,
"Stopping visible=" + r.visible + " for " + r);
@@ -2695,7 +2699,7 @@
Slog.w(TAG, "Exception thrown during pause", e);
// Just in case, assume it to be stopped.
r.stopped = true;
- if (DEBUG_STATES) Slog.v(TAG, "Stop failed; moving to STOPPED: " + r);
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Stop failed; moving to STOPPED: " + r);
r.state = ActivityState.STOPPED;
if (r.configDestroy) {
destroyActivityLocked(r, true, "stop-except");
@@ -2711,8 +2715,8 @@
final boolean requestFinishActivityLocked(IBinder token, int resultCode,
Intent resultData, String reason, boolean oomAdj) {
ActivityRecord r = isInStackLocked(token);
- if (DEBUG_RESULTS || DEBUG_STATES) Slog.v(
- TAG, "Finishing activity token=" + token + " r="
+ if (DEBUG_RESULTS || DEBUG_STATES) Slog.v(TAG_STATES,
+ "Finishing activity token=" + token + " r="
+ ", result=" + resultCode + ", data=" + resultData
+ ", reason=" + reason);
if (r == null) {
@@ -2933,8 +2937,8 @@
mStackSupervisor.checkReadyForSleepLocked();
}
}
- if (DEBUG_STATES) Slog.v(TAG, "Moving to STOPPING: " + r
- + " (finish requested)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES,
+ "Moving to STOPPING: "+ r + " (finish requested)");
r.state = ActivityState.STOPPING;
if (oomAdj) {
mService.updateOomAdjLocked();
@@ -2950,7 +2954,7 @@
mResumedActivity = null;
}
final ActivityState prevState = r.state;
- if (DEBUG_STATES) Slog.v(TAG, "Moving to FINISHING: " + r);
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to FINISHING: " + r);
r.state = ActivityState.FINISHING;
if (mode == FINISH_IMMEDIATELY
@@ -2963,7 +2967,7 @@
if (activityRemoved) {
mStackSupervisor.resumeTopActivitiesLocked();
}
- if (DEBUG_CONTAINERS) Slog.d(TAG,
+ if (DEBUG_CONTAINERS) Slog.d(TAG_CONTAINERS,
"destroyActivityLocked: finishCurrentActivityLocked r=" + r +
" destroy returned removed=" + activityRemoved);
return activityRemoved ? null : r;
@@ -3137,9 +3141,9 @@
r.frozenBeforeDestroy = false;
if (setState) {
- if (DEBUG_STATES) Slog.v(TAG, "Moving to DESTROYED: " + r + " (cleaning up)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to DESTROYED: " + r + " (cleaning up)");
r.state = ActivityState.DESTROYED;
- if (DEBUG_APP) Slog.v(TAG, "Clearing app during cleanUp for activity " + r);
+ if (DEBUG_APP) Slog.v(TAG_APP, "Clearing app during cleanUp for activity " + r);
r.app = null;
}
@@ -3183,16 +3187,15 @@
mStackSupervisor.removeChildActivityContainers(r);
finishActivityResultsLocked(r, Activity.RESULT_CANCELED, null);
r.makeFinishingLocked();
- if (DEBUG_ADD_REMOVE) {
- RuntimeException here = new RuntimeException("here");
- here.fillInStackTrace();
- Slog.i(TAG, "Removing activity " + r + " from stack");
- }
+ if (DEBUG_ADD_REMOVE) Slog.i(TAG_ADD_REMOVE,
+ "Removing activity " + r + " from stack callers=" + Debug.getCallers(5));
+
r.takeFromHistory();
removeTimeoutsForActivityLocked(r);
- if (DEBUG_STATES) Slog.v(TAG, "Moving to DESTROYED: " + r + " (removed from history)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES,
+ "Moving to DESTROYED: " + r + " (removed from history)");
r.state = ActivityState.DESTROYED;
- if (DEBUG_APP) Slog.v(TAG, "Clearing app during remove for activity " + r);
+ if (DEBUG_APP) Slog.v(TAG_APP, "Clearing app during remove for activity " + r);
r.app = null;
mWindowManager.removeAppToken(r.appToken);
if (VALIDATE_TOKENS) {
@@ -3280,7 +3283,7 @@
final int releaseSomeActivitiesLocked(ProcessRecord app, ArraySet<TaskRecord> tasks,
String reason) {
// Iterate over tasks starting at the back (oldest) first.
- if (DEBUG_RELEASE) Slog.d(TAG, "Trying to release some activities in " + app);
+ if (DEBUG_RELEASE) Slog.d(TAG_RELEASE, "Trying to release some activities in " + app);
int maxTasks = tasks.size() / 4;
if (maxTasks < 1) {
maxTasks = 1;
@@ -3291,13 +3294,13 @@
if (!tasks.contains(task)) {
continue;
}
- if (DEBUG_RELEASE) Slog.d(TAG, "Looking for activities to release in " + task);
+ if (DEBUG_RELEASE) Slog.d(TAG_RELEASE, "Looking for activities to release in " + task);
int curNum = 0;
final ArrayList<ActivityRecord> activities = task.mActivities;
for (int actNdx = 0; actNdx < activities.size(); actNdx++) {
final ActivityRecord activity = activities.get(actNdx);
if (activity.app == app && activity.isDestroyable()) {
- if (DEBUG_RELEASE) Slog.v(TAG, "Destroying " + activity
+ if (DEBUG_RELEASE) Slog.v(TAG_RELEASE, "Destroying " + activity
+ " in state " + activity.state + " resumed=" + mResumedActivity
+ " pausing=" + mPausingActivity + " for reason " + reason);
destroyActivityLocked(activity, true, reason);
@@ -3317,7 +3320,8 @@
}
}
}
- if (DEBUG_RELEASE) Slog.d(TAG, "Done releasing: did " + numReleased + " activities");
+ if (DEBUG_RELEASE) Slog.d(TAG_RELEASE,
+ "Done releasing: did " + numReleased + " activities");
return numReleased;
}
@@ -3387,15 +3391,16 @@
// it in the destroyed state since we are not removing it from the
// list.
if (r.finishing && !skipDestroy) {
- if (DEBUG_STATES) Slog.v(TAG, "Moving to DESTROYING: " + r
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to DESTROYING: " + r
+ " (destroy requested)");
r.state = ActivityState.DESTROYING;
Message msg = mHandler.obtainMessage(DESTROY_TIMEOUT_MSG, r);
mHandler.sendMessageDelayed(msg, DESTROY_TIMEOUT);
} else {
- if (DEBUG_STATES) Slog.v(TAG, "Moving to DESTROYED: " + r + " (destroy skipped)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES,
+ "Moving to DESTROYED: " + r + " (destroy skipped)");
r.state = ActivityState.DESTROYED;
- if (DEBUG_APP) Slog.v(TAG, "Clearing app during destroy for activity " + r);
+ if (DEBUG_APP) Slog.v(TAG_APP, "Clearing app during destroy for activity " + r);
r.app = null;
}
} else {
@@ -3404,9 +3409,9 @@
removeActivityFromHistoryLocked(r, reason + " hadNoApp");
removedFromHistory = true;
} else {
- if (DEBUG_STATES) Slog.v(TAG, "Moving to DESTROYED: " + r + " (no app)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES, "Moving to DESTROYED: " + r + " (no app)");
r.state = ActivityState.DESTROYED;
- if (DEBUG_APP) Slog.v(TAG, "Clearing app during destroy for activity " + r);
+ if (DEBUG_APP) Slog.v(TAG_APP, "Clearing app during destroy for activity " + r);
r.app = null;
}
}
@@ -3427,7 +3432,7 @@
if (r != null) {
mHandler.removeMessages(DESTROY_TIMEOUT_MSG, r);
}
- if (DEBUG_CONTAINERS) Slog.d(TAG, "activityDestroyedLocked: r=" + r);
+ if (DEBUG_CONTAINERS) Slog.d(TAG_CONTAINERS, "activityDestroyedLocked: r=" + r);
if (isInStackLocked(r) != null) {
if (r.state == ActivityState.DESTROYING) {
@@ -3449,7 +3454,7 @@
// activity.
return;
}
- if (DEBUG_STATES) Slog.d(TAG, "releaseBackgroundResources activtyDisplay=" +
+ if (DEBUG_STATES) Slog.d(TAG_STATES, "releaseBackgroundResources activtyDisplay=" +
mActivityContainer.mActivityDisplay + " visibleBehind=" + r + " app=" + r.app +
" thread=" + r.app.thread);
if (r != null && r.app != null && r.app.thread != null) {
@@ -3550,15 +3555,12 @@
remove = false;
}
if (remove) {
- if (DEBUG_ADD_REMOVE || DEBUG_CLEANUP) {
- RuntimeException here = new RuntimeException("here");
- here.fillInStackTrace();
- Slog.i(TAG, "Removing activity " + r + " from stack at " + i
- + ": haveState=" + r.haveState
- + " stateNotNeeded=" + r.stateNotNeeded
- + " finishing=" + r.finishing
- + " state=" + r.state, here);
- }
+ if (DEBUG_ADD_REMOVE || DEBUG_CLEANUP) Slog.i(TAG_ADD_REMOVE,
+ "Removing activity " + r + " from stack at " + i
+ + ": haveState=" + r.haveState
+ + " stateNotNeeded=" + r.stateNotNeeded
+ + " finishing=" + r.finishing
+ + " state=" + r.state + " callers=" + Debug.getCallers(5));
if (!r.finishing) {
Slog.w(TAG, "Force removing " + r + ": app died, no saved state");
EventLog.writeEvent(EventLogTags.AM_FINISH_ACTIVITY,
@@ -3572,14 +3574,13 @@
} else {
// We have the current state for this activity, so
// it can be restarted later when needed.
- if (DEBUG_ALL) Slog.v(
- TAG, "Keeping entry, setting app to null");
- if (DEBUG_APP) Slog.v(TAG, "Clearing app during removeHistory for activity "
- + r);
+ if (DEBUG_ALL) Slog.v(TAG, "Keeping entry, setting app to null");
+ if (DEBUG_APP) Slog.v(TAG_APP,
+ "Clearing app during removeHistory for activity " + r);
r.app = null;
r.nowVisible = false;
if (!r.haveState) {
- if (DEBUG_SAVED_STATE) Slog.i(TAG,
+ if (DEBUG_SAVED_STATE) Slog.i(TAG_SAVED_STATE,
"App died, clearing saved state of " + r);
r.icicle = null;
}
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 01a3fe3..23e62e2 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -124,37 +124,31 @@
public final class ActivityStackSupervisor implements DisplayListener {
private static final String TAG = TAG_WITH_CLASS_NAME ? "ActivityStackSupervisor" : TAG_AM;
private static final String TAG_CONFIGURATION = TAG + POSTFIX_CONFIGURATION;
+ private static final String TAG_CONTAINERS = TAG + POSTFIX_CONTAINERS;
private static final String TAG_FOCUS = TAG + POSTFIX_FOCUS;
+ private static final String TAG_IDLE = TAG + POSTFIX_IDLE;
private static final String TAG_LOCKTASK = TAG + POSTFIX_LOCKTASK;
private static final String TAG_PAUSE = TAG + POSTFIX_PAUSE;
- private static final String TAG_RESULTS = TAG + POSTFIX_RESULTS;
private static final String TAG_RECENTS = TAG + POSTFIX_RECENTS;
+ private static final String TAG_RELEASE = TAG + POSTFIX_RELEASE;
+ private static final String TAG_RESULTS = TAG + POSTFIX_RESULTS;
private static final String TAG_STACK = TAG + POSTFIX_STACK;
+ private static final String TAG_STATES = TAG + POSTFIX_STATES;
private static final String TAG_SWITCH = TAG + POSTFIX_SWITCH;
private static final String TAG_TASKS = TAG + POSTFIX_TASKS;
+ private static final String TAG_VISIBLE_BEHIND = TAG + POSTFIX_VISIBLE_BEHIND;
private static final String TAG_USER_LEAVING = TAG + POSTFIX_USER_LEAVING;
- static final boolean DEBUG = DEBUG_ALL || false;
- static final boolean DEBUG_ADD_REMOVE = DEBUG || false;
- static final boolean DEBUG_APP = DEBUG || false;
- static final boolean DEBUG_CONTAINERS = DEBUG || false;
- static final boolean DEBUG_IDLE = DEBUG || false;
- static final boolean DEBUG_RELEASE = DEBUG || false;
- static final boolean DEBUG_SAVED_STATE = DEBUG || false;
- static final boolean DEBUG_SCREENSHOTS = DEBUG || false;
- static final boolean DEBUG_STATES = DEBUG || false;
- static final boolean DEBUG_VISIBLE_BEHIND = DEBUG || false;
-
public static final int HOME_STACK_ID = 0;
/** How long we wait until giving up on the last activity telling us it is idle. */
- static final int IDLE_TIMEOUT = 10*1000;
+ static final int IDLE_TIMEOUT = 10 * 1000;
/** How long we can hold the sleep wake lock before giving up. */
- static final int SLEEP_TIMEOUT = 5*1000;
+ static final int SLEEP_TIMEOUT = 5 * 1000;
// How long we can hold the launch wake lock before giving up.
- static final int LAUNCH_TIMEOUT = 10*1000;
+ static final int LAUNCH_TIMEOUT = 10 * 1000;
static final int IDLE_TIMEOUT_MSG = FIRST_SUPERVISOR_STACK_MSG;
static final int IDLE_NOW_MSG = FIRST_SUPERVISOR_STACK_MSG + 1;
@@ -631,7 +625,7 @@
}
final ActivityRecord resumedActivity = stack.mResumedActivity;
if (resumedActivity == null || !resumedActivity.idle) {
- if (DEBUG_STATES) Slog.d(TAG, "allResumedActivitiesIdle: stack="
+ if (DEBUG_STATES) Slog.d(TAG_STATES, "allResumedActivitiesIdle: stack="
+ stack.mStackId + " " + resumedActivity + " not idle");
return false;
}
@@ -691,7 +685,7 @@
for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
final ActivityStack stack = stacks.get(stackNdx);
if (!isFrontStack(stack) && stack.mResumedActivity != null) {
- if (DEBUG_STATES) Slog.d(TAG, "pauseBackStacks: stack=" + stack +
+ if (DEBUG_STATES) Slog.d(TAG_STATES, "pauseBackStacks: stack=" + stack +
" mResumedActivity=" + stack.mResumedActivity);
someActivityPaused |= stack.startPausingLocked(userLeaving, false, resuming,
dontWait);
@@ -710,7 +704,8 @@
final ActivityRecord r = stack.mPausingActivity;
if (r != null && r.state != PAUSED && r.state != STOPPED && r.state != STOPPING) {
if (DEBUG_STATES) {
- Slog.d(TAG, "allPausedActivitiesComplete: r=" + r + " state=" + r.state);
+ Slog.d(TAG_STATES,
+ "allPausedActivitiesComplete: r=" + r + " state=" + r.state);
pausing = false;
} else {
return false;
@@ -1308,8 +1303,8 @@
// should look like we asked it to pause+stop (but remain visible),
// and it has done so and reported back the current icicle and
// other state.
- if (DEBUG_STATES) Slog.v(TAG, "Moving to STOPPED: " + r
- + " (starting in stopped state)");
+ if (DEBUG_STATES) Slog.v(TAG_STATES,
+ "Moving to STOPPED: " + r + " (starting in stopped state)");
r.state = STOPPED;
r.stopped = true;
}
@@ -2382,8 +2377,8 @@
ActivityRecord r = ActivityRecord.forTokenLocked(token);
if (r != null) {
- if (DEBUG_IDLE) Slog.d(TAG, "activityIdleInternalLocked: Callers=" +
- Debug.getCallers(4));
+ if (DEBUG_IDLE) Slog.d(TAG_IDLE, "activityIdleInternalLocked: Callers="
+ + Debug.getCallers(4));
mHandler.removeMessages(IDLE_TIMEOUT_MSG, r);
r.finishLaunchTickingLocked();
if (fromTimeout) {
@@ -2693,7 +2688,8 @@
ActivityContainer activityContainer =
new VirtualActivityContainer(parentActivity, callback);
mActivityContainers.put(activityContainer.mStackId, activityContainer);
- if (DEBUG_CONTAINERS) Slog.d(TAG, "createActivityContainer: " + activityContainer);
+ if (DEBUG_CONTAINERS) Slog.d(TAG_CONTAINERS,
+ "createActivityContainer: " + activityContainer);
parentActivity.mChildContainers.add(activityContainer);
return activityContainer;
}
@@ -2702,8 +2698,8 @@
final ArrayList<ActivityContainer> childStacks = parentActivity.mChildContainers;
for (int containerNdx = childStacks.size() - 1; containerNdx >= 0; --containerNdx) {
ActivityContainer container = childStacks.remove(containerNdx);
- if (DEBUG_CONTAINERS) Slog.d(TAG, "removeChildActivityContainers: removing " +
- container);
+ if (DEBUG_CONTAINERS) Slog.d(TAG_CONTAINERS, "removeChildActivityContainers: removing "
+ + container);
container.release();
}
}
@@ -2711,8 +2707,8 @@
void deleteActivityContainer(IActivityContainer container) {
ActivityContainer activityContainer = (ActivityContainer)container;
if (activityContainer != null) {
- if (DEBUG_CONTAINERS) Slog.d(TAG, "deleteActivityContainer: ",
- new RuntimeException("here").fillInStackTrace());
+ if (DEBUG_CONTAINERS) Slog.d(TAG_CONTAINERS,
+ "deleteActivityContainer: callers=" + Debug.getCallers(4));
final int stackId = activityContainer.mStackId;
mActivityContainers.remove(stackId);
mWindowManager.removeStack(stackId);
@@ -3077,17 +3073,17 @@
boolean requestVisibleBehindLocked(ActivityRecord r, boolean visible) {
final ActivityStack stack = r.task.stack;
if (stack == null) {
- if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG, "requestVisibleBehind: r=" + r + " visible=" +
- visible + " stack is null");
+ if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG_VISIBLE_BEHIND,
+ "requestVisibleBehind: r=" + r + " visible=" + visible + " stack is null");
return false;
}
final boolean isVisible = stack.hasVisibleBehindActivity();
- if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG, "requestVisibleBehind r=" + r + " visible=" +
- visible + " isVisible=" + isVisible);
+ if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG_VISIBLE_BEHIND,
+ "requestVisibleBehind r=" + r + " visible=" + visible + " isVisible=" + isVisible);
final ActivityRecord top = topRunningActivityLocked();
if (top == null || top == r || (visible == isVisible)) {
- if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG, "requestVisibleBehind: quick return");
+ if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG_VISIBLE_BEHIND, "requestVisibleBehind: quick return");
stack.setVisibleBehindActivity(visible ? r : null);
return true;
}
@@ -3095,16 +3091,18 @@
// A non-top activity is reporting a visibility change.
if (visible && top.fullscreen) {
// Let the caller know that it can't be seen.
- if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG, "requestVisibleBehind: returning top.fullscreen="
- + top.fullscreen + " top.state=" + top.state + " top.app=" + top.app +
- " top.app.thread=" + top.app.thread);
+ if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG_VISIBLE_BEHIND,
+ "requestVisibleBehind: returning top.fullscreen=" + top.fullscreen
+ + " top.state=" + top.state + " top.app=" + top.app + " top.app.thread="
+ + top.app.thread);
return false;
} else if (!visible && stack.getVisibleBehindActivity() != r) {
// Only the activity set as currently visible behind should actively reset its
// visible behind state.
- if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG, "requestVisibleBehind: returning visible="
- + visible + " stack.getVisibleBehindActivity()=" +
- stack.getVisibleBehindActivity() + " r=" + r);
+ if (DEBUG_VISIBLE_BEHIND) Slog.d(TAG_VISIBLE_BEHIND,
+ "requestVisibleBehind: returning visible=" + visible
+ + " stack.getVisibleBehindActivity()=" + stack.getVisibleBehindActivity()
+ + " r=" + r);
return false;
}
@@ -3179,25 +3177,25 @@
TaskRecord firstTask = null;
// Tasks is non-null only if two or more tasks are found.
ArraySet<TaskRecord> tasks = null;
- if (DEBUG_RELEASE) Slog.d(TAG, "Trying to release some activities in " + app);
- for (int i=0; i<app.activities.size(); i++) {
+ if (DEBUG_RELEASE) Slog.d(TAG_RELEASE, "Trying to release some activities in " + app);
+ for (int i = 0; i < app.activities.size(); i++) {
ActivityRecord r = app.activities.get(i);
// First, if we find an activity that is in the process of being destroyed,
// then we just aren't going to do anything for now; we want things to settle
// down before we try to prune more activities.
if (r.finishing || r.state == DESTROYING || r.state == DESTROYED) {
- if (DEBUG_RELEASE) Slog.d(TAG, "Abort release; already destroying: " + r);
+ if (DEBUG_RELEASE) Slog.d(TAG_RELEASE, "Abort release; already destroying: " + r);
return;
}
// Don't consider any activies that are currently not in a state where they
// can be destroyed.
if (r.visible || !r.stopped || !r.haveState || r.state == RESUMED || r.state == PAUSING
|| r.state == PAUSED || r.state == STOPPING) {
- if (DEBUG_RELEASE) Slog.d(TAG, "Not releasing in-use activity: " + r);
+ if (DEBUG_RELEASE) Slog.d(TAG_RELEASE, "Not releasing in-use activity: " + r);
continue;
}
if (r.task != null) {
- if (DEBUG_RELEASE) Slog.d(TAG, "Collecting release task " + r.task
+ if (DEBUG_RELEASE) Slog.d(TAG_RELEASE, "Collecting release task " + r.task
+ " from " + r);
if (firstTask == null) {
firstTask = r.task;
@@ -3211,7 +3209,7 @@
}
}
if (tasks == null) {
- if (DEBUG_RELEASE) Slog.d(TAG, "Didn't find two or more tasks to release");
+ if (DEBUG_RELEASE) Slog.d(TAG_RELEASE, "Didn't find two or more tasks to release");
return;
}
// If we have activities in multiple tasks that are in a position to be destroyed,
@@ -3546,7 +3544,8 @@
}
void scheduleIdleTimeoutLocked(ActivityRecord next) {
- if (DEBUG_IDLE) Slog.d(TAG, "scheduleIdleTimeoutLocked: Callers=" + Debug.getCallers(4));
+ if (DEBUG_IDLE) Slog.d(TAG_IDLE,
+ "scheduleIdleTimeoutLocked: Callers=" + Debug.getCallers(4));
Message msg = mHandler.obtainMessage(IDLE_TIMEOUT_MSG, next);
mHandler.sendMessageDelayed(msg, IDLE_TIMEOUT);
}
@@ -3556,7 +3555,8 @@
}
void removeTimeoutsForActivityLocked(ActivityRecord r) {
- if (DEBUG_IDLE) Slog.d(TAG, "removeTimeoutsForActivity: Callers=" + Debug.getCallers(4));
+ if (DEBUG_IDLE) Slog.d(TAG_IDLE, "removeTimeoutsForActivity: Callers="
+ + Debug.getCallers(4));
mHandler.removeMessages(IDLE_TIMEOUT_MSG, r);
}
@@ -3858,7 +3858,8 @@
public void handleMessage(Message msg) {
switch (msg.what) {
case IDLE_TIMEOUT_MSG: {
- if (DEBUG_IDLE) Slog.d(TAG, "handleMessage: IDLE_TIMEOUT_MSG: r=" + msg.obj);
+ if (DEBUG_IDLE) Slog.d(TAG_IDLE,
+ "handleMessage: IDLE_TIMEOUT_MSG: r=" + msg.obj);
if (mService.mDidDexOpt) {
mService.mDidDexOpt = false;
Message nmsg = mHandler.obtainMessage(IDLE_TIMEOUT_MSG);
@@ -3871,7 +3872,7 @@
activityIdleInternal((ActivityRecord)msg.obj);
} break;
case IDLE_NOW_MSG: {
- if (DEBUG_IDLE) Slog.d(TAG, "handleMessage: IDLE_NOW_MSG: r=" + msg.obj);
+ if (DEBUG_IDLE) Slog.d(TAG_IDLE, "handleMessage: IDLE_NOW_MSG: r=" + msg.obj);
activityIdleInternal((ActivityRecord)msg.obj);
} break;
case RESUME_TOP_ACTIVITY_MSG: {
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index d56a024..f966bcf 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -27,7 +27,6 @@
import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE;
import static com.android.server.am.ActivityRecord.APPLICATION_ACTIVITY_TYPE;
import static com.android.server.am.ActivityRecord.RECENTS_ACTIVITY_TYPE;
-import static com.android.server.am.ActivityStackSupervisor.DEBUG_ADD_REMOVE;
import android.app.Activity;
import android.app.ActivityManager;
@@ -42,6 +41,7 @@
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
+import android.os.Debug;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.os.UserHandle;
@@ -60,6 +60,7 @@
final class TaskRecord {
private static final String TAG = TAG_WITH_CLASS_NAME ? "TaskRecord" : TAG_AM;
+ private static final String TAG_ADD_REMOVE = TAG + POSTFIX_ADD_REMOVE;
private static final String TAG_RECENTS = TAG + POSTFIX_RECENTS;
private static final String TAG_LOCKTASK = TAG + POSTFIX_LOCKTASK;
private static final String TAG_TASKS = TAG + POSTFIX_TASKS;
@@ -561,8 +562,9 @@
* Reorder the history stack so that the passed activity is brought to the front.
*/
final void moveActivityToFrontLocked(ActivityRecord newTop) {
- if (DEBUG_ADD_REMOVE) Slog.i(TAG, "Removing and adding activity " + newTop
- + " to stack at top", new RuntimeException("here").fillInStackTrace());
+ if (DEBUG_ADD_REMOVE) Slog.i(TAG_ADD_REMOVE,
+ "Removing and adding activity " + newTop
+ + " to stack at top callers=" + Debug.getCallers(4));
mActivities.remove(newTop);
mActivities.add(newTop);