summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorWale Ogunwale <ogunwale@google.com>2015-03-30 14:49:25 -0700
committerWale Ogunwale <ogunwale@google.com>2015-04-01 08:28:14 -0700
commitee006da858459e91666ae53432659e934c8a8dbd (patch)
tree06e3b4771ae5fa062623e338e4c808ad1c42d59b /services
parent066be66d6060c3dd23a84690a396d1df12c6404d (diff)
downloadframeworks_base-ee006da858459e91666ae53432659e934c8a8dbd.zip
frameworks_base-ee006da858459e91666ae53432659e934c8a8dbd.tar.gz
frameworks_base-ee006da858459e91666ae53432659e934c8a8dbd.tar.bz2
Converted more log points in AMS to use ActivityManagerDebugConfig.
Change-Id: I59e777de30e2e9a3c7d086dc634129cd19135fab
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerDebugConfig.java20
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java267
-rwxr-xr-xservices/core/java/com/android/server/am/ActivityRecord.java12
-rw-r--r--services/core/java/com/android/server/am/ActivityStack.java259
-rw-r--r--services/core/java/com/android/server/am/ActivityStackSupervisor.java177
-rw-r--r--services/core/java/com/android/server/am/RecentTasks.java52
-rw-r--r--services/core/java/com/android/server/am/TaskRecord.java14
7 files changed, 405 insertions, 396 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java b/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java
index fd4974e..7a74e45 100644
--- a/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java
+++ b/services/core/java/com/android/server/am/ActivityManagerDebugConfig.java
@@ -72,7 +72,7 @@ class ActivityManagerDebugConfig {
static final boolean DEBUG_TRANSITION = DEBUG_ALL || false;
static final boolean DEBUG_URI_PERMISSION = DEBUG_ALL || false;
static final boolean DEBUG_USER_LEAVING = DEBUG_ALL || false;
- static final boolean DEBUG_VISBILITY = DEBUG_ALL || false;
+ static final boolean DEBUG_VISIBILITY = DEBUG_ALL || false;
static final String POSTFIX_BACKUP = (APPEND_CATEGORY_NAME) ? "_Backup" : "";
static final String POSTFIX_BROADCAST = (APPEND_CATEGORY_NAME) ? "_Broadcast" : "";
@@ -80,11 +80,29 @@ class ActivityManagerDebugConfig {
static final String POSTFIX_CONFIGURATION = (APPEND_CATEGORY_NAME) ? "_Configuration" : "";
static final String POSTFIX_FOCUS = (APPEND_CATEGORY_NAME) ? "_Focus" : "";
static final String POSTFIX_IMMERSIVE = (APPEND_CATEGORY_NAME) ? "_Immersive" : "";
+ static final String POSTFIX_LOCKSCREEN = (APPEND_CATEGORY_NAME) ? "_LOCKSCREEN" : "";
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" : "";
+ static final String POSTFIX_PAUSE = (APPEND_CATEGORY_NAME) ? "_Pause" : "";
+ static final String POSTFIX_POWER = (APPEND_CATEGORY_NAME) ? "_Power" : "";
+ static final String POSTFIX_PROCESS_OBSERVERS = (APPEND_CATEGORY_NAME)
+ ? "_ProcessObservers" : "";
+ 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_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_SWITCH = (APPEND_CATEGORY_NAME) ? "_Switch" : "";
+ static final String POSTFIX_TASKS = (APPEND_CATEGORY_NAME) ? "_Tasks" : "";
+ static final String POSTFIX_THUMBNAILS = (APPEND_CATEGORY_NAME) ? "_Thumbnails" : "";
+ static final String POSTFIX_TRANSITION = (APPEND_CATEGORY_NAME) ? "_Transition" : "";
+ 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" : "";
}
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index c318370..5858477 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -26,12 +26,12 @@ import static com.android.internal.util.XmlUtils.readLongAttribute;
import static com.android.internal.util.XmlUtils.writeBooleanAttribute;
import static com.android.internal.util.XmlUtils.writeIntAttribute;
import static com.android.internal.util.XmlUtils.writeLongAttribute;
-import static com.android.server.Watchdog.NATIVE_STACKS_OF_INTEREST;
-import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
-import static org.xmlpull.v1.XmlPullParser.START_TAG;
import static com.android.server.am.ActivityStackSupervisor.HOME_STACK_ID;
import static com.android.server.am.ActivityManagerDebugConfig.*;
import static com.android.server.am.TaskRecord.INVALID_TASK_ID;
+import static com.android.server.Watchdog.NATIVE_STACKS_OF_INTEREST;
+import static org.xmlpull.v1.XmlPullParser.END_DOCUMENT;
+import static org.xmlpull.v1.XmlPullParser.START_TAG;
import android.Manifest;
import android.app.AppOpsManager;
@@ -259,37 +259,30 @@ public final class ActivityManagerService extends ActivityManagerNative
private static final String TAG_CONFIGURATION = TAG + POSTFIX_CONFIGURATION;
private static final String TAG_FOCUS = TAG + POSTFIX_FOCUS;
private static final String TAG_IMMERSIVE = TAG + POSTFIX_IMMERSIVE;
+ private static final String TAG_LOCKSCREEN = TAG + POSTFIX_LOCKSCREEN;
private static final String TAG_LRU = TAG + POSTFIX_LRU;
private static final String TAG_MU = TAG + POSTFIX_MU;
private static final String TAG_OOM_ADJ = TAG + POSTFIX_OOM_ADJ;
-
- // TODO(ogunwale): Migrate all the constants below to use ActivityManagerDebugConfig class.
- static final boolean DEBUG_PAUSE = DEBUG_ALL || false;
- static final boolean DEBUG_POWER = DEBUG_ALL || false;
- static final boolean DEBUG_POWER_QUICK = DEBUG_POWER || false;
- static final boolean DEBUG_PROCESS_OBSERVERS = DEBUG_ALL || false;
- static final boolean DEBUG_PROCESSES = DEBUG_ALL || false;
- static final boolean DEBUG_PROVIDER = DEBUG_ALL || false;
- static final boolean DEBUG_RESULTS = DEBUG_ALL || 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_SWITCH = DEBUG_ALL || false;
- static final boolean DEBUG_TASKS = DEBUG_ALL || false;
- static final boolean DEBUG_THUMBNAILS = DEBUG_ALL || false;
- static final boolean DEBUG_TRANSITION = DEBUG_ALL || false;
- static final boolean DEBUG_URI_PERMISSION = DEBUG_ALL || false;
- static final boolean DEBUG_USER_LEAVING = DEBUG_ALL || false;
- static final boolean DEBUG_VISBILITY = DEBUG_ALL || false;
- static final boolean DEBUG_PSS = DEBUG_ALL || false;
- static final boolean DEBUG_LOCKSCREEN = DEBUG_ALL || false;
- static final boolean DEBUG_RECENTS = DEBUG_ALL || false;
-
- // Control over CPU and battery monitoring.
- static final long BATTERY_STATS_TIME = 30*60*1000; // write battery stats every 30 minutes.
+ private static final String TAG_POWER = TAG + POSTFIX_POWER;
+ private static final String TAG_PROCESS_OBSERVERS = TAG + POSTFIX_PROCESS_OBSERVERS;
+ private static final String TAG_PROCESSES = TAG + POSTFIX_PROCESSES;
+ private static final String TAG_PROVIDER = TAG + POSTFIX_PROVIDER;
+ private static final String TAG_PSS = TAG + POSTFIX_PSS;
+ private static final String TAG_RECENTS = TAG + POSTFIX_RECENTS;
+ private static final String TAG_SERVICE = TAG + POSTFIX_SERVICE;
+ private static final String TAG_STACK = TAG + POSTFIX_STACK;
+ private static final String TAG_SWITCH = TAG + POSTFIX_SWITCH;
+ private static final String TAG_URI_PERMISSION = TAG + POSTFIX_URI_PERMISSION;
+ private static final String TAG_VISIBILITY = TAG + POSTFIX_VISIBILITY;
+
+ /** Control over CPU and battery monitoring */
+ // write battery stats every 30 minutes.
+ static final long BATTERY_STATS_TIME = 30 * 60 * 1000;
static final boolean MONITOR_CPU_USAGE = true;
- static final long MONITOR_CPU_MIN_TIME = 5*1000; // don't sample cpu less than every 5 seconds.
- static final long MONITOR_CPU_MAX_TIME = 0x0fffffff; // wait possibly forever for next cpu sample.
+ // don't sample cpu less than every 5 seconds.
+ static final long MONITOR_CPU_MIN_TIME = 5 * 1000;
+ // wait possibly forever for next cpu sample.
+ static final long MONITOR_CPU_MAX_TIME = 0x0fffffff;
static final boolean MONITOR_THREAD_CPU_USAGE = false;
// The flags that are set for all calls we make to the package manager.
@@ -1847,8 +1840,8 @@ public final class ActivityManagerService extends ActivityManagerNative
return;
}
- if (DEBUG_PSS) Slog.d(TAG, "Showing dump heap notification from "
- + procName + "/" + uid);
+ if (DEBUG_PSS) Slog.d(TAG_PSS,
+ "Showing dump heap notification from " + procName + "/" + uid);
INotificationManager inm = NotificationManager.getService();
if (inm == null) {
@@ -1946,7 +1939,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
memInfo.readMemInfo();
synchronized (ActivityManagerService.this) {
- if (DEBUG_PSS) Slog.d(TAG, "Collected native and kernel memory in "
+ if (DEBUG_PSS) Slog.d(TAG_PSS, "Collected native and kernel memory in "
+ (SystemClock.uptimeMillis()-start) + "ms");
final long cachedKb = memInfo.getCachedSizeKb();
final long freeKb = memInfo.getFreeSizeKb();
@@ -1968,8 +1961,9 @@ public final class ActivityManagerService extends ActivityManagerNative
long lastPssTime;
synchronized (ActivityManagerService.this) {
if (mPendingPssProcesses.size() <= 0) {
- if (mTestPssMode || DEBUG_PSS) Slog.d(TAG, "Collected PSS of " + num
- + " processes in " + (SystemClock.uptimeMillis()-start) + "ms");
+ if (mTestPssMode || DEBUG_PSS) Slog.d(TAG_PSS,
+ "Collected PSS of " + num + " processes in "
+ + (SystemClock.uptimeMillis() - start) + "ms");
mPendingPssProcesses.clear();
return;
}
@@ -2528,7 +2522,7 @@ public final class ActivityManagerService extends ActivityManagerNative
@Override
public void notifyActivityDrawn(IBinder token) {
- if (DEBUG_VISBILITY) Slog.d(TAG, "notifyActivityDrawn: token=" + token);
+ if (DEBUG_VISIBILITY) Slog.d(TAG_VISIBILITY, "notifyActivityDrawn: token=" + token);
synchronized (this) {
ActivityRecord r = mStackSupervisor.isInAnyStackLocked(token);
if (r != null) {
@@ -2828,7 +2822,7 @@ public final class ActivityManagerService extends ActivityManagerNative
} else if (proc != null && !keepIfLarge
&& mLastMemoryLevel > ProcessStats.ADJ_MEM_FACTOR_NORMAL
&& proc.setProcState >= ActivityManager.PROCESS_STATE_CACHED_EMPTY) {
- if (DEBUG_PSS) Slog.d(TAG, "May not keep " + proc + ": pss=" + proc.lastCachedPss);
+ if (DEBUG_PSS) Slog.d(TAG_PSS, "May not keep " + proc + ": pss=" + proc.lastCachedPss);
if (proc.lastCachedPss >= mProcessList.getCachedRestoreThresholdKb()) {
if (proc.baseProcessTracker != null) {
proc.baseProcessTracker.reportCachedKill(proc.pkgList, proc.lastCachedPss);
@@ -2910,7 +2904,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// object attached to it so we know it couldn't have crashed; and
// (3) There is a pid assigned to it, so it is either starting or
// already running.
- if (DEBUG_PROCESSES) Slog.v(TAG, "startProcess: name=" + processName
+ if (DEBUG_PROCESSES) Slog.v(TAG_PROCESSES, "startProcess: name=" + processName
+ " app=" + app + " knownToBeDead=" + knownToBeDead
+ " thread=" + (app != null ? app.thread : null)
+ " pid=" + (app != null ? app.pid : -1));
@@ -2918,7 +2912,7 @@ public final class ActivityManagerService extends ActivityManagerNative
if (!knownToBeDead || app.thread == null) {
// We already have the app running, or are waiting for it to
// come up (we have a pid but not yet its thread), so keep it.
- if (DEBUG_PROCESSES) Slog.v(TAG, "App already running: " + app);
+ if (DEBUG_PROCESSES) Slog.v(TAG_PROCESSES, "App already running: " + app);
// If this is a new package in the process, add the package to the list
app.addPackage(info.packageName, info.versionCode, mProcessStats);
checkTime(startTime, "startProcess: done, added package to proc");
@@ -2927,7 +2921,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// An application record is attached to a previous process,
// clean it up now.
- if (DEBUG_PROCESSES || DEBUG_CLEANUP) Slog.v(TAG, "App died: " + app);
+ if (DEBUG_PROCESSES || DEBUG_CLEANUP) Slog.v(TAG_PROCESSES, "App died: " + app);
checkTime(startTime, "startProcess: bad proc running, killing");
Process.killProcessGroup(app.info.uid, app.pid);
handleAppDiedLocked(app, true, true);
@@ -2942,7 +2936,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// If we are in the background, then check to see if this process
// is bad. If so, we will just silently fail.
if (mBadProcesses.get(info.processName, info.uid) != null) {
- if (DEBUG_PROCESSES) Slog.v(TAG, "Bad process: " + info.uid
+ if (DEBUG_PROCESSES) Slog.v(TAG_PROCESSES, "Bad process: " + info.uid
+ "/" + info.processName);
return null;
}
@@ -2951,7 +2945,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// crash count so that we won't make it bad until they see at
// least one crash dialog again, and make the process good again
// if it had been bad.
- if (DEBUG_PROCESSES) Slog.v(TAG, "Clearing bad process: " + info.uid
+ if (DEBUG_PROCESSES) Slog.v(TAG_PROCESSES, "Clearing bad process: " + info.uid
+ "/" + info.processName);
mProcessCrashTimes.remove(info.processName, info.uid);
if (mBadProcesses.get(info.processName, info.uid) != null) {
@@ -2994,7 +2988,8 @@ public final class ActivityManagerService extends ActivityManagerNative
if (!mProcessesOnHold.contains(app)) {
mProcessesOnHold.add(app);
}
- if (DEBUG_PROCESSES) Slog.v(TAG, "System not ready, putting on hold: " + app);
+ if (DEBUG_PROCESSES) Slog.v(TAG_PROCESSES,
+ "System not ready, putting on hold: " + app);
checkTime(startTime, "startProcess: returning with proc on hold");
return app;
}
@@ -3029,7 +3024,7 @@ public final class ActivityManagerService extends ActivityManagerNative
app.setPid(0);
}
- if (DEBUG_PROCESSES && mProcessesOnHold.contains(app)) Slog.v(TAG,
+ if (DEBUG_PROCESSES && mProcessesOnHold.contains(app)) Slog.v(TAG_PROCESSES,
"startProcessLocked removing on hold: " + app);
mProcessesOnHold.remove(app);
@@ -3198,7 +3193,8 @@ public final class ActivityManagerService extends ActivityManagerNative
}
void updateUsageStats(ActivityRecord component, boolean resumed) {
- if (DEBUG_SWITCH) Slog.d(TAG, "updateUsageStats: comp=" + component + "res=" + resumed);
+ if (DEBUG_SWITCH) Slog.d(TAG_SWITCH,
+ "updateUsageStats: comp=" + component + "res=" + resumed);
final BatteryStatsImpl stats = mBatteryStatsService.getActiveStatistics();
if (resumed) {
if (mUsageStatsService != null) {
@@ -3416,7 +3412,8 @@ public final class ActivityManagerService extends ActivityManagerNative
mPendingProcessChanges.toArray(mActiveProcessChanges);
mAvailProcessChanges.addAll(mPendingProcessChanges);
mPendingProcessChanges.clear();
- if (DEBUG_PROCESS_OBSERVERS) Slog.i(TAG, "*** Delivering " + N + " process changes");
+ if (DEBUG_PROCESS_OBSERVERS) Slog.i(TAG_PROCESS_OBSERVERS,
+ "*** Delivering " + N + " process changes");
}
int i = mProcessObservers.beginBroadcast();
@@ -3428,15 +3425,16 @@ public final class ActivityManagerService extends ActivityManagerNative
for (int j=0; j<N; j++) {
ProcessChangeItem item = mActiveProcessChanges[j];
if ((item.changes&ProcessChangeItem.CHANGE_ACTIVITIES) != 0) {
- if (DEBUG_PROCESS_OBSERVERS) Slog.i(TAG, "ACTIVITIES CHANGED pid="
- + item.pid + " uid=" + item.uid + ": "
- + item.foregroundActivities);
+ if (DEBUG_PROCESS_OBSERVERS) Slog.i(TAG_PROCESS_OBSERVERS,
+ "ACTIVITIES CHANGED pid=" + item.pid + " uid="
+ + item.uid + ": " + item.foregroundActivities);
observer.onForegroundActivitiesChanged(item.pid, item.uid,
item.foregroundActivities);
}
if ((item.changes&ProcessChangeItem.CHANGE_PROCESS_STATE) != 0) {
- if (DEBUG_PROCESS_OBSERVERS) Slog.i(TAG, "PROCSTATE CHANGED pid="
- + item.pid + " uid=" + item.uid + ": " + item.processState);
+ if (DEBUG_PROCESS_OBSERVERS) Slog.i(TAG_PROCESS_OBSERVERS,
+ "PROCSTATE CHANGED pid=" + item.pid + " uid=" + item.uid
+ + ": " + item.processState);
observer.onProcessStateChanged(item.pid, item.uid, item.processState);
}
}
@@ -4352,7 +4350,7 @@ public final class ActivityManagerService extends ActivityManagerNative
+ ") has died and restarted (pid " + app.pid + ").");
EventLog.writeEvent(EventLogTags.AM_PROC_DIED, app.userId, app.pid, app.processName);
} else if (DEBUG_PROCESSES) {
- Slog.d(TAG, "Received spurious death notification for thread "
+ Slog.d(TAG_PROCESSES, "Received spurious death notification for thread "
+ thread.asBinder());
}
}
@@ -5387,9 +5385,8 @@ public final class ActivityManagerService extends ActivityManagerNative
boolean callerWillRestart, boolean allowRestart, String reason) {
final String name = app.processName;
final int uid = app.uid;
- if (DEBUG_PROCESSES) Slog.d(
- TAG, "Force removing proc " + app.toShortString() + " (" + name
- + "/" + uid + ")");
+ if (DEBUG_PROCESSES) Slog.d(TAG_PROCESSES,
+ "Force removing proc " + app.toShortString() + " (" + name + "/" + uid + ")");
mProcessNames.remove(name, uid);
mIsolatedProcesses.remove(app.uid);
@@ -5633,7 +5630,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// Remove this record from the list of starting applications.
mPersistentStartingProcesses.remove(app);
- if (DEBUG_PROCESSES && mProcessesOnHold.contains(app)) Slog.v(TAG,
+ if (DEBUG_PROCESSES && mProcessesOnHold.contains(app)) Slog.v(TAG_PROCESSES,
"Attach application locked removing on hold: " + app);
mProcessesOnHold.remove(app);
@@ -5841,7 +5838,7 @@ public final class ActivityManagerService extends ActivityManagerNative
ArrayList<ProcessRecord> procs =
new ArrayList<ProcessRecord>(mProcessesOnHold);
for (int ip=0; ip<NP; ip++) {
- if (DEBUG_PROCESSES) Slog.v(TAG, "Starting process on hold: "
+ if (DEBUG_PROCESSES) Slog.v(TAG_PROCESSES, "Starting process on hold: "
+ procs.get(ip));
startProcessLocked(procs.get(ip), "on-hold", null);
}
@@ -5982,7 +5979,7 @@ public final class ActivityManagerService extends ActivityManagerNative
@Override
public final void activityDestroyed(IBinder token) {
- if (DEBUG_SWITCH) Slog.v(TAG, "ACTIVITY DESTROYED: " + token);
+ if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "ACTIVITY DESTROYED: " + token);
synchronized (this) {
ActivityStack stack = ActivityRecord.getStackLocked(token);
if (stack != null) {
@@ -6587,7 +6584,7 @@ public final class ActivityManagerService extends ActivityManagerNative
*/
private final boolean checkHoldingPermissionsLocked(
IPackageManager pm, ProviderInfo pi, GrantUri grantUri, int uid, final int modeFlags) {
- if (DEBUG_URI_PERMISSION) Slog.v(TAG,
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION,
"checkHoldingPermissionsLocked: uri=" + grantUri + " uid=" + uid);
if (UserHandle.getUserId(uid) != grantUri.sourceUserId) {
if (ActivityManager.checkComponentPermission(INTERACT_ACROSS_USERS, uid, -1, true)
@@ -6635,8 +6632,8 @@ public final class ActivityManagerService extends ActivityManagerNative
if (pp.match(path)) {
if (!readMet) {
final String pprperm = pp.getReadPermission();
- if (DEBUG_URI_PERMISSION) Slog.v(TAG, "Checking read perm for "
- + pprperm + " for " + pp.getPath()
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION,
+ "Checking read perm for " + pprperm + " for " + pp.getPath()
+ ": match=" + pp.match(path)
+ " check=" + pm.checkUidPermission(pprperm, uid));
if (pprperm != null) {
@@ -6650,8 +6647,8 @@ public final class ActivityManagerService extends ActivityManagerNative
}
if (!writeMet) {
final String ppwperm = pp.getWritePermission();
- if (DEBUG_URI_PERMISSION) Slog.v(TAG, "Checking write perm "
- + ppwperm + " for " + pp.getPath()
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION,
+ "Checking write perm " + ppwperm + " for " + pp.getPath()
+ ": match=" + pp.match(path)
+ " check=" + pm.checkUidPermission(ppwperm, uid));
if (ppwperm != null) {
@@ -6796,7 +6793,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
if (targetPkg != null) {
- if (DEBUG_URI_PERMISSION) Slog.v(TAG,
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION,
"Checking grant " + targetPkg + " permission to " + grantUri);
}
@@ -6804,7 +6801,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// If this is not a content: uri, we can't do anything with it.
if (!ContentResolver.SCHEME_CONTENT.equals(grantUri.uri.getScheme())) {
- if (DEBUG_URI_PERMISSION) Slog.v(TAG,
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION,
"Can't grant URI permission for non-content URI: " + grantUri);
return -1;
}
@@ -6822,7 +6819,7 @@ public final class ActivityManagerService extends ActivityManagerNative
try {
targetUid = pm.getPackageUid(targetPkg, UserHandle.getUserId(callingUid));
if (targetUid < 0) {
- if (DEBUG_URI_PERMISSION) Slog.v(TAG,
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION,
"Can't grant URI permission no uid for: " + targetPkg);
return -1;
}
@@ -6835,7 +6832,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// First... does the target actually need this permission?
if (checkHoldingPermissionsLocked(pm, pi, grantUri, targetUid, modeFlags)) {
// No need to grant the target this permission.
- if (DEBUG_URI_PERMISSION) Slog.v(TAG,
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION,
"Target " + targetPkg + " already has full permission to " + grantUri);
return -1;
}
@@ -6932,7 +6929,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// to the uri, and the target doesn't. Let's now give this to
// the target.
- if (DEBUG_URI_PERMISSION) Slog.v(TAG,
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION,
"Granting " + targetPkg + "/" + targetUid + " permission to " + grantUri);
final String authority = grantUri.uri.getAuthority();
@@ -6990,7 +6987,7 @@ public final class ActivityManagerService extends ActivityManagerNative
*/
NeededUriGrants checkGrantUriPermissionFromIntentLocked(int callingUid,
String targetPkg, Intent intent, int mode, NeededUriGrants needed, int targetUserId) {
- if (DEBUG_URI_PERMISSION) Slog.v(TAG,
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION,
"Checking URI perm to data=" + (intent != null ? intent.getData() : null)
+ " clip=" + (intent != null ? intent.getClipData() : null)
+ " from " + intent + "; flags=0x"
@@ -7024,10 +7021,9 @@ public final class ActivityManagerService extends ActivityManagerNative
return null;
}
if (targetUid < 0) {
- if (DEBUG_URI_PERMISSION) {
- Slog.v(TAG, "Can't grant URI permission no uid for: " + targetPkg
- + " on user " + targetUserId);
- }
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION,
+ "Can't grant URI permission no uid for: " + targetPkg
+ + " on user " + targetUserId);
return null;
}
}
@@ -7134,7 +7130,7 @@ public final class ActivityManagerService extends ActivityManagerNative
final ArrayMap<GrantUri, UriPermission> perms = mGrantedUriPermissions.get(
perm.targetUid);
if (perms != null) {
- if (DEBUG_URI_PERMISSION) Slog.v(TAG,
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION,
"Removing " + perm.targetUid + " permission to " + perm.uri);
perms.remove(perm.uri);
@@ -7146,7 +7142,8 @@ public final class ActivityManagerService extends ActivityManagerNative
}
private void revokeUriPermissionLocked(int callingUid, GrantUri grantUri, final int modeFlags) {
- if (DEBUG_URI_PERMISSION) Slog.v(TAG, "Revoking all granted permissions to " + grantUri);
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION,
+ "Revoking all granted permissions to " + grantUri);
final IPackageManager pm = AppGlobals.getPackageManager();
final String authority = grantUri.uri.getAuthority();
@@ -7168,9 +7165,9 @@ public final class ActivityManagerService extends ActivityManagerNative
final UriPermission perm = it.next();
if (perm.uri.sourceUserId == grantUri.sourceUserId
&& perm.uri.uri.isPathPrefixMatch(grantUri.uri)) {
- if (DEBUG_URI_PERMISSION)
- Slog.v(TAG, "Revoking non-owned " + perm.targetUid +
- " permission to " + perm.uri);
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION,
+ "Revoking non-owned " + perm.targetUid
+ + " permission to " + perm.uri);
persistChanged |= perm.revokeModes(
modeFlags | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION, false);
if (perm.modeFlags == 0) {
@@ -7200,8 +7197,7 @@ public final class ActivityManagerService extends ActivityManagerNative
final UriPermission perm = it.next();
if (perm.uri.sourceUserId == grantUri.sourceUserId
&& perm.uri.uri.isPathPrefixMatch(grantUri.uri)) {
- if (DEBUG_URI_PERMISSION)
- Slog.v(TAG,
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION,
"Revoking " + perm.targetUid + " permission to " + perm.uri);
persistChanged |= perm.revokeModes(
modeFlags | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION, true);
@@ -7386,7 +7382,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
private void writeGrantedUriPermissions() {
- if (DEBUG_URI_PERMISSION) Slog.v(TAG, "writeGrantedUriPermissions()");
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION, "writeGrantedUriPermissions()");
// Snapshot permissions so we can persist without lock
ArrayList<UriPermission.Snapshot> persist = Lists.newArrayList();
@@ -7434,7 +7430,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
private void readGrantedUriPermissionsLocked() {
- if (DEBUG_URI_PERMISSION) Slog.v(TAG, "readGrantedUriPermissions()");
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION, "readGrantedUriPermissions()");
final long now = System.currentTimeMillis();
@@ -7612,9 +7608,8 @@ public final class ActivityManagerService extends ActivityManagerNative
for (int i = 0; i < trimCount; i++) {
final UriPermission perm = persisted.get(i);
- if (DEBUG_URI_PERMISSION) {
- Slog.v(TAG, "Trimming grant created at " + perm.persistedCreateTime);
- }
+ if (DEBUG_URI_PERMISSION) Slog.v(TAG_URI_PERMISSION,
+ "Trimming grant created at " + perm.persistedCreateTime);
perm.releasePersistableModes(~0);
removeUriPermissionIfNeededLocked(perm);
@@ -7844,7 +7839,7 @@ public final class ActivityManagerService extends ActivityManagerNative
TaskRecord tr = mRecentTasks.get(i);
// Only add calling user or related users recent tasks
if (!includedUsers.contains(Integer.valueOf(tr.userId))) {
- if (DEBUG_RECENTS) Slog.d(TAG, "Skipping, not user: " + tr);
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS, "Skipping, not user: " + tr);
continue;
}
@@ -7863,25 +7858,27 @@ public final class ActivityManagerService extends ActivityManagerNative
// If the caller doesn't have the GET_TASKS permission, then only
// allow them to see a small subset of tasks -- their own and home.
if (!tr.isHomeTask() && tr.effectiveUid != callingUid) {
- if (DEBUG_RECENTS) Slog.d(TAG, "Skipping, not allowed: " + tr);
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS, "Skipping, not allowed: " + tr);
continue;
}
}
if ((flags & ActivityManager.RECENT_IGNORE_HOME_STACK_TASKS) != 0) {
if (tr.stack != null && tr.stack.isHomeStack()) {
- if (DEBUG_RECENTS) Slog.d(TAG, "Skipping, home stack task: " + tr);
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS,
+ "Skipping, home stack task: " + tr);
continue;
}
}
if (tr.autoRemoveRecents && tr.getTopActivity() == null) {
// Don't include auto remove tasks that are finished or finishing.
- if (DEBUG_RECENTS) Slog.d(TAG, "Skipping, auto-remove without activity: "
- + tr);
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS,
+ "Skipping, auto-remove without activity: " + tr);
continue;
}
if ((flags&ActivityManager.RECENT_IGNORE_UNAVAILABLE) != 0
&& !tr.isAvailable) {
- if (DEBUG_RECENTS) Slog.d(TAG, "Skipping, unavail real act: " + tr);
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS,
+ "Skipping, unavail real act: " + tr);
continue;
}
@@ -8215,10 +8212,9 @@ public final class ActivityManagerService extends ActivityManagerNative
*/
@Override
public void moveTaskToFront(int taskId, int flags, Bundle options) {
- enforceCallingPermission(android.Manifest.permission.REORDER_TASKS,
- "moveTaskToFront()");
+ enforceCallingPermission(android.Manifest.permission.REORDER_TASKS, "moveTaskToFront()");
- if (DEBUG_STACK) Slog.d(TAG, "moveTaskToFront: moving taskId=" + taskId);
+ if (DEBUG_STACK) Slog.d(TAG_STACK, "moveTaskToFront: moving taskId=" + taskId);
synchronized(this) {
moveTaskToFrontLocked(taskId, flags, options);
}
@@ -8378,8 +8374,8 @@ public final class ActivityManagerService extends ActivityManagerNative
synchronized (this) {
long ident = Binder.clearCallingIdentity();
try {
- if (DEBUG_STACK) Slog.d(TAG, "moveTaskToStack: moving task=" + taskId + " to stackId="
- + stackId + " toTop=" + toTop);
+ if (DEBUG_STACK) Slog.d(TAG_STACK, "moveTaskToStack: moving task=" + taskId
+ + " to stackId=" + stackId + " toTop=" + toTop);
mStackSupervisor.moveTaskToStackLocked(taskId, stackId, toTop);
} finally {
Binder.restoreCallingIdentity(ident);
@@ -8790,7 +8786,7 @@ public final class ActivityManagerService extends ActivityManagerNative
for (int i=0; i<r.conProviders.size(); i++) {
ContentProviderConnection conn = r.conProviders.get(i);
if (conn.provider == cpr) {
- if (DEBUG_PROVIDER) Slog.v(TAG,
+ if (DEBUG_PROVIDER) Slog.v(TAG_PROVIDER,
"Adding provider requested by "
+ r.processName + " from process "
+ cpr.info.processName + ": " + cpr.name.flattenToShortString()
@@ -8826,7 +8822,7 @@ public final class ActivityManagerService extends ActivityManagerNative
ContentProviderRecord cpr, IBinder externalProcessToken, boolean stable) {
if (conn != null) {
cpr = conn.provider;
- if (DEBUG_PROVIDER) Slog.v(TAG,
+ if (DEBUG_PROVIDER) Slog.v(TAG_PROVIDER,
"Removing provider requested by "
+ conn.client.processName + " from process "
+ cpr.info.processName + ": " + cpr.name.flattenToShortString()
@@ -8954,7 +8950,7 @@ public final class ActivityManagerService extends ActivityManagerNative
checkTime(startTime, "getContentProviderImpl: before updateOomAdj");
boolean success = updateOomAdjLocked(cpr.proc);
checkTime(startTime, "getContentProviderImpl: after updateOomAdj");
- if (DEBUG_PROVIDER) Slog.i(TAG, "Adjust success: " + success);
+ if (DEBUG_PROVIDER) Slog.i(TAG_PROVIDER, "Adjust success: " + success);
// NOTE: there is still a race here where a signal could be
// pending on the process even though we managed to update its
// adj level. Not sure what to do about this, but at least
@@ -8964,8 +8960,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// has been killed on us. We need to wait for a new
// process to be started, and make sure its death
// doesn't kill our process.
- Slog.i(TAG,
- "Existing provider " + cpr.name.flattenToShortString()
+ Slog.i(TAG, "Existing provider " + cpr.name.flattenToShortString()
+ " is crashing; detaching " + r);
boolean lastRef = decProviderCountLocked(conn, cpr, token, stable);
checkTime(startTime, "getContentProviderImpl: before appDied");
@@ -9076,18 +9071,16 @@ public final class ActivityManagerService extends ActivityManagerNative
return cpr.newHolder(null);
}
- if (DEBUG_PROVIDER) {
- RuntimeException e = new RuntimeException("here");
- Slog.w(TAG, "LAUNCHING REMOTE PROVIDER (myuid " + (r != null ? r.uid : null)
- + " pruid " + cpr.appInfo.uid + "): " + cpr.info.name, e);
- }
+ if (DEBUG_PROVIDER) Slog.w(TAG_PROVIDER, "LAUNCHING REMOTE PROVIDER (myuid "
+ + (r != null ? r.uid : null) + " pruid " + cpr.appInfo.uid + "): "
+ + cpr.info.name + " callers=" + Debug.getCallers(6));
// This is single process, and our app is now connecting to it.
// See if we are already in the process of launching this
// provider.
final int N = mLaunchingProviders.size();
int i;
- for (i=0; i<N; i++) {
+ for (i = 0; i < N; i++) {
if (mLaunchingProviders.get(i) == cpr) {
break;
}
@@ -9116,9 +9109,8 @@ public final class ActivityManagerService extends ActivityManagerNative
ProcessRecord proc = getProcessRecordLocked(
cpi.processName, cpr.appInfo.uid, false);
if (proc != null && proc.thread != null) {
- if (DEBUG_PROVIDER) {
- Slog.d(TAG, "Installing in existing process " + proc);
- }
+ if (DEBUG_PROVIDER) Slog.d(TAG_PROVIDER,
+ "Installing in existing process " + proc);
if (!proc.pubProviders.containsKey(cpi.name)) {
checkTime(startTime, "getContentProviderImpl: scheduling install");
proc.pubProviders.put(cpi.name, cpr);
@@ -9833,7 +9825,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
void logLockScreen(String msg) {
- if (DEBUG_LOCKSCREEN) Slog.d(TAG, Debug.getCallers(2) + ":" + msg
+ if (DEBUG_LOCKSCREEN) Slog.d(TAG_LOCKSCREEN, Debug.getCallers(2) + ":" + msg
+ " mLockScreenShown=" + lockScreenShownToString() + " mWakefulness="
+ PowerManagerInternal.wakefulnessToString(mWakefulness)
+ " mSleeping=" + mSleeping);
@@ -14905,8 +14897,8 @@ public final class ActivityManagerService extends ActivityManagerNative
throw new IllegalArgumentException("File descriptors passed in Intent");
}
- if (DEBUG_SERVICE)
- Slog.v(TAG, "startService: " + service + " type=" + resolvedType);
+ if (DEBUG_SERVICE) Slog.v(TAG_SERVICE,
+ "startService: " + service + " type=" + resolvedType);
synchronized(this) {
final int callingPid = Binder.getCallingPid();
final int callingUid = Binder.getCallingUid();
@@ -14921,8 +14913,8 @@ public final class ActivityManagerService extends ActivityManagerNative
ComponentName startServiceInPackage(int uid, Intent service, String resolvedType, int userId)
throws TransactionTooLargeException {
synchronized(this) {
- if (DEBUG_SERVICE)
- Slog.v(TAG, "startServiceInPackage: " + service + " type=" + resolvedType);
+ if (DEBUG_SERVICE) Slog.v(TAG_SERVICE,
+ "startServiceInPackage: " + service + " type=" + resolvedType);
final long origId = Binder.clearCallingIdentity();
ComponentName res = mServices.startServiceLocked(null, service,
resolvedType, -1, uid, userId);
@@ -17388,11 +17380,11 @@ public final class ActivityManagerService extends ActivityManagerNative
* Record new PSS sample for a process.
*/
void recordPssSampleLocked(ProcessRecord proc, int procState, long pss, long uss, long now) {
- EventLogTags.writeAmPss(proc.pid, proc.uid, proc.processName, pss*1024, uss*1024);
+ EventLogTags.writeAmPss(proc.pid, proc.uid, proc.processName, pss * 1024, uss * 1024);
proc.lastPssTime = now;
proc.baseProcessTracker.addPss(pss, uss, true, proc.pkgList);
- if (DEBUG_PSS) Slog.d(TAG, "PSS of " + proc.toShortString()
- + ": " + pss + " lastPss=" + proc.lastPss
+ if (DEBUG_PSS) Slog.d(TAG_PSS,
+ "PSS of " + proc.toShortString() + ": " + pss + " lastPss=" + proc.lastPss
+ " state=" + ProcessList.makeProcStateString(procState));
if (proc.initialIdlePss == 0) {
proc.initialIdlePss = pss;
@@ -17404,7 +17396,7 @@ public final class ActivityManagerService extends ActivityManagerNative
Long check = mMemWatchProcesses.get(proc.processName);
if (check != null) {
- if ((pss*1024) >= check && proc.thread != null && mMemWatchDumpProcName == null) {
+ if ((pss * 1024) >= check && proc.thread != null && mMemWatchDumpProcName == null) {
boolean isDebuggable = "1".equals(SystemProperties.get(SYSTEM_DEBUGGABLE, "0"));
if (!isDebuggable) {
if ((proc.info.flags&ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
@@ -17438,7 +17430,7 @@ public final class ActivityManagerService extends ActivityManagerNative
IApplicationThread thread = myProc.thread;
if (thread != null) {
try {
- if (DEBUG_PSS) Slog.d(TAG, "Requesting dump heap from "
+ if (DEBUG_PSS) Slog.d(TAG_PSS, "Requesting dump heap from "
+ myProc + " to " + heapdumpFile);
thread.dumpHeap(true, heapdumpFile.toString(), fd);
} catch (RemoteException e) {
@@ -17474,7 +17466,7 @@ public final class ActivityManagerService extends ActivityManagerNative
if (mPendingPssProcesses.size() == 0) {
mBgHandler.sendEmptyMessage(COLLECT_PSS_BG_MSG);
}
- if (DEBUG_PSS) Slog.d(TAG, "Requesting PSS of: " + proc);
+ if (DEBUG_PSS) Slog.d(TAG_PSS, "Requesting PSS of: " + proc);
proc.pssProcState = procState;
mPendingPssProcesses.add(proc);
}
@@ -17489,7 +17481,7 @@ public final class ActivityManagerService extends ActivityManagerNative
return;
}
}
- if (DEBUG_PSS) Slog.d(TAG, "Requesting PSS of all procs! memLowered=" + memLowered);
+ if (DEBUG_PSS) Slog.d(TAG_PSS, "Requesting PSS of all procs! memLowered=" + memLowered);
mLastFullPssTime = now;
mFullPssPending = true;
mPendingPssProcesses.ensureCapacity(mLruProcesses.size());
@@ -17705,7 +17697,7 @@ public final class ActivityManagerService extends ActivityManagerNative
sb.append(" (");
sb.append((wtimeUsed*100)/realtimeSince);
sb.append("%)");
- Slog.i(TAG, sb.toString());
+ Slog.i(TAG_POWER, sb.toString());
sb.setLength(0);
sb.append("CPU for ");
app.toShortString(sb);
@@ -17716,7 +17708,7 @@ public final class ActivityManagerService extends ActivityManagerNative
sb.append(" (");
sb.append((cputimeUsed*100)/uptimeSince);
sb.append("%)");
- Slog.i(TAG, sb.toString());
+ Slog.i(TAG_POWER, sb.toString());
}
// If a process has held a wake lock for more
// than 50% of the time during this period,
@@ -17833,7 +17825,7 @@ public final class ActivityManagerService extends ActivityManagerNative
app.lastStateTime = now;
app.nextPssTime = ProcessList.computeNextPssTime(app.curProcState, true,
mTestPssMode, isSleeping(), now);
- if (DEBUG_PSS) Slog.d(TAG, "Process state change from "
+ if (DEBUG_PSS) Slog.d(TAG_PSS, "Process state change from "
+ ProcessList.makeProcStateString(app.setProcState) + " to "
+ ProcessList.makeProcStateString(app.curProcState) + " next pss in "
+ (app.nextPssTime-now) + ": " + app);
@@ -17844,9 +17836,8 @@ public final class ActivityManagerService extends ActivityManagerNative
requestPssLocked(app, app.setProcState);
app.nextPssTime = ProcessList.computeNextPssTime(app.curProcState, false,
mTestPssMode, isSleeping(), now);
- } else if (false && DEBUG_PSS) {
- Slog.d(TAG, "Not requesting PSS of " + app + ": next=" + (app.nextPssTime-now));
- }
+ } else if (false && DEBUG_PSS) Slog.d(TAG_PSS,
+ "Not requesting PSS of " + app + ": next=" + (app.nextPssTime-now));
}
if (app.setProcState != app.curProcState) {
if (DEBUG_SWITCH || DEBUG_OOM_ADJ) Slog.v(TAG_OOM_ADJ,
@@ -17879,13 +17870,15 @@ public final class ActivityManagerService extends ActivityManagerNative
}
if (changes != 0) {
- if (DEBUG_PROCESS_OBSERVERS) Slog.i(TAG, "Changes in " + app + ": " + changes);
+ if (DEBUG_PROCESS_OBSERVERS) Slog.i(TAG_PROCESS_OBSERVERS,
+ "Changes in " + app + ": " + changes);
int i = mPendingProcessChanges.size()-1;
ProcessChangeItem item = null;
while (i >= 0) {
item = mPendingProcessChanges.get(i);
if (item.pid == app.pid) {
- if (DEBUG_PROCESS_OBSERVERS) Slog.i(TAG, "Re-using existing item: " + item);
+ if (DEBUG_PROCESS_OBSERVERS) Slog.i(TAG_PROCESS_OBSERVERS,
+ "Re-using existing item: " + item);
break;
}
i--;
@@ -17895,16 +17888,18 @@ public final class ActivityManagerService extends ActivityManagerNative
final int NA = mAvailProcessChanges.size();
if (NA > 0) {
item = mAvailProcessChanges.remove(NA-1);
- if (DEBUG_PROCESS_OBSERVERS) Slog.i(TAG, "Retreiving available item: " + item);
+ if (DEBUG_PROCESS_OBSERVERS) Slog.i(TAG_PROCESS_OBSERVERS,
+ "Retreiving available item: " + item);
} else {
item = new ProcessChangeItem();
- if (DEBUG_PROCESS_OBSERVERS) Slog.i(TAG, "Allocating new item: " + item);
+ if (DEBUG_PROCESS_OBSERVERS) Slog.i(TAG_PROCESS_OBSERVERS,
+ "Allocating new item: " + item);
}
item.changes = 0;
item.pid = app.pid;
item.uid = app.info.uid;
if (mPendingProcessChanges.size() == 0) {
- if (DEBUG_PROCESS_OBSERVERS) Slog.i(TAG,
+ if (DEBUG_PROCESS_OBSERVERS) Slog.i(TAG_PROCESS_OBSERVERS,
"*** Enqueueing dispatch processes changed!");
mHandler.obtainMessage(DISPATCH_PROCESSES_CHANGED).sendToTarget();
}
@@ -17913,8 +17908,8 @@ public final class ActivityManagerService extends ActivityManagerNative
item.changes |= changes;
item.processState = app.repProcState;
item.foregroundActivities = app.repForegroundActivities;
- if (DEBUG_PROCESS_OBSERVERS) Slog.i(TAG, "Item "
- + Integer.toHexString(System.identityHashCode(item))
+ if (DEBUG_PROCESS_OBSERVERS) Slog.i(TAG_PROCESS_OBSERVERS,
+ "Item " + Integer.toHexString(System.identityHashCode(item))
+ " " + app.toShortString() + ": changes=" + item.changes
+ " procState=" + item.processState
+ " foreground=" + item.foregroundActivities
@@ -18670,7 +18665,7 @@ public final class ActivityManagerService extends ActivityManagerNative
+ " does not match last path " + mMemWatchDumpFile);
return;
}
- if (DEBUG_PSS) Slog.d(TAG, "Dump heap finished for " + path);
+ if (DEBUG_PSS) Slog.d(TAG_PSS, "Dump heap finished for " + path);
mHandler.sendEmptyMessage(POST_DUMP_HEAP_NOTIFICATION_MSG);
}
}
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index d34b33b..24ce190 100755
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -17,8 +17,6 @@
package com.android.server.am;
import static com.android.server.am.ActivityManagerDebugConfig.*;
-import static com.android.server.am.ActivityManagerService.DEBUG_SWITCH;
-import static com.android.server.am.ActivityManagerService.DEBUG_THUMBNAILS;
import static com.android.server.am.TaskPersister.DEBUG_PERSISTER;
import static com.android.server.am.TaskPersister.DEBUG_RESTORER;
import static com.android.server.am.TaskRecord.INVALID_TASK_ID;
@@ -75,6 +73,8 @@ import java.util.Objects;
*/
final class ActivityRecord {
private static final String TAG = TAG_WITH_CLASS_NAME ? "ActivityRecord" : TAG_AM;
+ 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;
@@ -354,7 +354,7 @@ final class ActivityRecord {
synchronized (mService) {
ActivityRecord r = tokenToActivityRecordLocked(this);
if (r != null) {
- if (DEBUG_SWITCH) Log.v(TAG, "windowsGone(): " + r);
+ if (DEBUG_SWITCH) Log.v(TAG_SWITCH, "windowsGone(): " + r);
r.nowVisible = false;
return;
}
@@ -863,7 +863,7 @@ final class ActivityRecord {
void updateThumbnailLocked(Bitmap newThumbnail, CharSequence description) {
if (newThumbnail != null) {
- if (DEBUG_THUMBNAILS) Slog.i(TAG,
+ if (DEBUG_THUMBNAILS) Slog.i(TAG_THUMBNAILS,
"Setting thumbnail of " + this + " to " + newThumbnail);
boolean thumbnailUpdated = task.setLastThumbnail(newThumbnail);
if (thumbnailUpdated && isPersistable()) {
@@ -1014,7 +1014,7 @@ final class ActivityRecord {
void windowsVisibleLocked() {
mStackSupervisor.reportActivityVisibleLocked(this);
- if (DEBUG_SWITCH) Log.v(TAG, "windowsVisibleLocked(): " + this);
+ if (DEBUG_SWITCH) Log.v(TAG_SWITCH, "windowsVisibleLocked(): " + this);
if (!nowVisible) {
nowVisible = true;
lastVisibleTime = SystemClock.uptimeMillis();
@@ -1030,7 +1030,7 @@ final class ActivityRecord {
if (size > 0) {
for (int i = 0; i < size; i++) {
ActivityRecord r = mStackSupervisor.mWaitingVisibleActivities.get(i);
- if (DEBUG_SWITCH) Log.v(TAG, "Was waiting for visible: " + r);
+ if (DEBUG_SWITCH) Log.v(TAG_SWITCH, "Was waiting for visible: " + r);
}
mStackSupervisor.mWaitingVisibleActivities.clear();
mStackSupervisor.scheduleIdleLocked();
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 8ba34e2..a8deea3 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -17,14 +17,6 @@
package com.android.server.am;
import static com.android.server.am.ActivityManagerDebugConfig.*;
-import static com.android.server.am.ActivityManagerService.DEBUG_PAUSE;
-import static com.android.server.am.ActivityManagerService.DEBUG_RESULTS;
-import static com.android.server.am.ActivityManagerService.DEBUG_STACK;
-import static com.android.server.am.ActivityManagerService.DEBUG_SWITCH;
-import static com.android.server.am.ActivityManagerService.DEBUG_TASKS;
-import static com.android.server.am.ActivityManagerService.DEBUG_TRANSITION;
-import static com.android.server.am.ActivityManagerService.DEBUG_USER_LEAVING;
-import static com.android.server.am.ActivityManagerService.DEBUG_VISBILITY;
import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE;
import static com.android.server.am.ActivityRecord.APPLICATION_ACTIVITY_TYPE;
@@ -96,6 +88,14 @@ final class ActivityStack {
private static final String TAG = TAG_WITH_CLASS_NAME ? "ActivityStack" : TAG_AM;
private static final String TAG_CLEANUP = TAG + POSTFIX_CLEANUP;
private static final String TAG_CONFIGURATION = TAG + POSTFIX_CONFIGURATION;
+ private static final String TAG_PAUSE = TAG + POSTFIX_PAUSE;
+ private static final String TAG_RESULTS = TAG + POSTFIX_RESULTS;
+ private static final String TAG_STACK = TAG + POSTFIX_STACK;
+ 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;
+ private static final String TAG_USER_LEAVING = TAG + POSTFIX_USER_LEAVING;
+ private static final String TAG_VISIBILITY = TAG + POSTFIX_VISIBILITY;
private static final boolean VALIDATE_TOKENS = false;
@@ -538,23 +538,23 @@ final class ActivityStack {
// If documentData is non-null then it must match the existing task data.
Uri documentData = isDocument ? intent.getData() : null;
- if (DEBUG_TASKS) Slog.d(TAG, "Looking for task of " + target + " in " + this);
+ if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Looking for task of " + target + " in " + this);
for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
final TaskRecord task = mTaskHistory.get(taskNdx);
if (task.voiceSession != null) {
// We never match voice sessions; those always run independently.
- if (DEBUG_TASKS) Slog.d(TAG, "Skipping " + task + ": voice session");
+ if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Skipping " + task + ": voice session");
continue;
}
if (task.userId != userId) {
// Looking for a different task.
- if (DEBUG_TASKS) Slog.d(TAG, "Skipping " + task + ": different user");
+ if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Skipping " + task + ": different user");
continue;
}
final ActivityRecord r = task.getTopActivity();
if (r == null || r.finishing || r.userId != userId ||
r.launchMode == ActivityInfo.LAUNCH_SINGLE_INSTANCE) {
- if (DEBUG_TASKS) Slog.d(TAG, "Skipping " + task + ": mismatch root " + r);
+ if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Skipping " + task + ": mismatch root " + r);
continue;
}
@@ -573,34 +573,32 @@ final class ActivityStack {
taskDocumentData = null;
}
- if (DEBUG_TASKS) Slog.d(TAG, "Comparing existing cls="
+ if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Comparing existing cls="
+ taskIntent.getComponent().flattenToShortString()
+ "/aff=" + r.task.rootAffinity + " to new cls="
+ intent.getComponent().flattenToShortString() + "/aff=" + info.taskAffinity);
if (!isDocument && !taskIsDocument && task.rootAffinity != null) {
if (task.rootAffinity.equals(target.taskAffinity)) {
- if (DEBUG_TASKS) Slog.d(TAG, "Found matching affinity!");
+ if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Found matching affinity!");
return r;
}
} else if (taskIntent != null && taskIntent.getComponent() != null &&
taskIntent.getComponent().compareTo(cls) == 0 &&
Objects.equals(documentData, taskDocumentData)) {
- if (DEBUG_TASKS) Slog.d(TAG, "Found matching class!");
+ if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Found matching class!");
//dump();
- if (DEBUG_TASKS) Slog.d(TAG, "For Intent " + intent + " bringing to top: "
- + r.intent);
+ if (DEBUG_TASKS) Slog.d(TAG_TASKS,
+ "For Intent " + intent + " bringing to top: " + r.intent);
return r;
} else if (affinityIntent != null && affinityIntent.getComponent() != null &&
affinityIntent.getComponent().compareTo(cls) == 0 &&
Objects.equals(documentData, taskDocumentData)) {
- if (DEBUG_TASKS) Slog.d(TAG, "Found matching class!");
+ if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Found matching class!");
//dump();
- if (DEBUG_TASKS) Slog.d(TAG, "For Intent " + intent + " bringing to top: "
- + r.intent);
+ if (DEBUG_TASKS) Slog.d(TAG_TASKS,
+ "For Intent " + intent + " bringing to top: " + r.intent);
return r;
- } else if (DEBUG_TASKS) {
- Slog.d(TAG, "Not a match: " + task);
- }
+ } else if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Not a match: " + task);
}
return null;
@@ -652,7 +650,7 @@ final class ActivityStack {
for (int i = 0; i < index; ) {
TaskRecord task = mTaskHistory.get(i);
if (isCurrentProfileLocked(task.userId)) {
- if (DEBUG_TASKS) Slog.d(TAG, "switchUserLocked: stack=" + getStackId() +
+ if (DEBUG_TASKS) Slog.d(TAG_TASKS, "switchUserLocked: stack=" + getStackId() +
" moving " + task + " to top");
mTaskHistory.remove(i);
mTaskHistory.add(task);
@@ -739,14 +737,15 @@ final class ActivityStack {
boolean checkReadyForSleepLocked() {
if (mResumedActivity != null) {
// Still have something resumed; can't sleep until it is paused.
- if (DEBUG_PAUSE) Slog.v(TAG, "Sleep needs to pause " + mResumedActivity);
- if (DEBUG_USER_LEAVING) Slog.v(TAG, "Sleep => pause with userLeaving=false");
+ if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Sleep needs to pause " + mResumedActivity);
+ if (DEBUG_USER_LEAVING) Slog.v(TAG_USER_LEAVING,
+ "Sleep => pause with userLeaving=false");
startPausingLocked(false, true, false, false);
return true;
}
if (mPausingActivity != null) {
// Still waiting for something to pause; can't sleep yet.
- if (DEBUG_PAUSE) Slog.v(TAG, "Sleep still waiting to pause " + mPausingActivity);
+ if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Sleep still waiting to pause " + mPausingActivity);
return true;
}
@@ -829,7 +828,7 @@ final class ActivityStack {
}
if (DEBUG_STATES) Slog.v(TAG, "Moving to PAUSING: " + prev);
- else if (DEBUG_PAUSE) Slog.v(TAG, "Start pausing: " + prev);
+ else if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Start pausing: " + prev);
mResumedActivity = null;
mPausingActivity = prev;
mLastPausedActivity = prev;
@@ -847,7 +846,7 @@ final class ActivityStack {
mService.updateCpuStats();
if (prev.app != null && prev.app.thread != null) {
- if (DEBUG_PAUSE) Slog.v(TAG, "Enqueueing pending pause: " + prev);
+ if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Enqueueing pending pause: " + prev);
try {
EventLog.writeEvent(EventLogTags.AM_PAUSE_ACTIVITY,
prev.userId, System.identityHashCode(prev),
@@ -881,8 +880,8 @@ final class ActivityStack {
// key dispatch; the same activity will pick it up again on wakeup.
if (!uiSleeping) {
prev.pauseKeyDispatchingLocked();
- } else {
- if (DEBUG_PAUSE) Slog.v(TAG, "Key dispatch not paused for screen off");
+ } else if (DEBUG_PAUSE) {
+ Slog.v(TAG_PAUSE, "Key dispatch not paused for screen off");
}
if (dontWait) {
@@ -899,14 +898,14 @@ final class ActivityStack {
msg.obj = prev;
prev.pauseTime = SystemClock.uptimeMillis();
mHandler.sendMessageDelayed(msg, PAUSE_TIMEOUT);
- if (DEBUG_PAUSE) Slog.v(TAG, "Waiting for pause to complete...");
+ if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Waiting for pause to complete...");
return true;
}
} else {
// This activity failed to schedule the
// pause, so just treat it as being paused now.
- if (DEBUG_PAUSE) Slog.v(TAG, "Activity not running, resuming next.");
+ if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Activity not running, resuming next.");
if (!resuming) {
mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null);
}
@@ -915,8 +914,8 @@ final class ActivityStack {
}
final void activityPausedLocked(IBinder token, boolean timeout) {
- if (DEBUG_PAUSE) Slog.v(
- TAG, "Activity paused: token=" + token + ", timeout=" + timeout);
+ if (DEBUG_PAUSE) Slog.v(TAG_PAUSE,
+ "Activity paused: token=" + token + ", timeout=" + timeout);
final ActivityRecord r = isInStackLocked(token);
if (r != null) {
@@ -977,18 +976,18 @@ final class ActivityStack {
private void completePauseLocked(boolean resumeNext) {
ActivityRecord prev = mPausingActivity;
- if (DEBUG_PAUSE) Slog.v(TAG, "Complete pause: " + prev);
+ if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Complete pause: " + prev);
if (prev != null) {
prev.state = ActivityState.PAUSED;
if (prev.finishing) {
- if (DEBUG_PAUSE) Slog.v(TAG, "Executing finish of activity: " + prev);
+ if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Executing finish of activity: " + prev);
prev = finishCurrentActivityLocked(prev, FINISH_AFTER_VISIBLE, false);
} else if (prev.app != null) {
- if (DEBUG_PAUSE) Slog.v(TAG, "Enqueueing pending stop: " + prev);
+ if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Enqueueing pending stop: " + prev);
if (mStackSupervisor.mWaitingVisibleActivities.remove(prev)) {
- if (DEBUG_SWITCH || DEBUG_PAUSE) Slog.v(
- TAG, "Complete pause, no longer waiting: " + prev);
+ if (DEBUG_SWITCH || DEBUG_PAUSE) Slog.v(TAG_PAUSE,
+ "Complete pause, no longer waiting: " + prev);
}
if (prev.configDestroy) {
// The previous is being paused because the configuration
@@ -996,7 +995,7 @@ final class ActivityStack {
// To juggle the fact that we are also starting a new
// instance right now, we need to first completely stop
// the current instance before starting the new one.
- if (DEBUG_PAUSE) Slog.v(TAG, "Destroying after pause: " + prev);
+ if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Destroying after pause: " + prev);
destroyActivityLocked(prev, true, "pause-config");
} else if (!hasVisibleBehindActivity()) {
// If we were visible then resumeTopActivities will release resources before
@@ -1008,14 +1007,14 @@ final class ActivityStack {
// then give up on things going idle and start clearing
// them out. Or if r is the last of activity of the last task the stack
// will be empty and must be cleared immediately.
- if (DEBUG_PAUSE) Slog.v(TAG, "To many pending stops, forcing idle");
+ if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "To many pending stops, forcing idle");
mStackSupervisor.scheduleIdleLocked();
} else {
mStackSupervisor.checkReadyForSleepLocked();
}
}
} else {
- if (DEBUG_PAUSE) Slog.v(TAG, "App died during pause, not stopping: " + prev);
+ if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "App died during pause, not stopping: " + prev);
prev = null;
}
// It is possible the activity was freezing the screen before it was paused.
@@ -1246,8 +1245,8 @@ final class ActivityStack {
if (top == null) {
return;
}
- if (DEBUG_VISBILITY) Slog.v(
- TAG, "ensureActivitiesVisible behind " + top
+ if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY,
+ "ensureActivitiesVisible behind " + top
+ " configChanges=0x" + Integer.toHexString(configChanges));
if (DEBUG_STATES && starting != null && starting.task.stack == this) {
@@ -1285,8 +1284,8 @@ final class ActivityStack {
// mLaunchingBehind: Activities launching behind are at the back of the task stack
// but must be drawn initially for the animation as though they were visible.
if (!behindFullscreen || r.mLaunchTaskBehind) {
- if (DEBUG_VISBILITY) Slog.v(
- TAG, "Make visible? " + r + " finishing=" + r.finishing
+ if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY,
+ "Make visible? " + r + " finishing=" + r.finishing
+ " state=" + r.state);
// First: if this is not the current activity being started, make
@@ -1299,13 +1298,14 @@ final class ActivityStack {
// This activity needs to be visible, but isn't even
// running... get it started, but don't resume it
// at this point.
- if (DEBUG_VISBILITY) Slog.v(TAG, "Start and freeze screen for " + r);
+ if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY,
+ "Start and freeze screen for " + r);
if (r != starting) {
r.startFreezingScreenLocked(r.app, configChanges);
}
if (!r.visible || r.mLaunchTaskBehind) {
- if (DEBUG_VISBILITY) Slog.v(
- TAG, "Starting and making visible: " + r);
+ if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY,
+ "Starting and making visible: " + r);
setVisible(r, true);
}
if (r != starting) {
@@ -1315,7 +1315,8 @@ final class ActivityStack {
} else if (r.visible) {
// If this activity is already visible, then there is nothing
// else to do here.
- if (DEBUG_VISBILITY) Slog.v(TAG, "Skipping: already visible at " + r);
+ if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY,
+ "Skipping: already visible at " + r);
r.stopFreezingScreenLocked(false);
try {
if (r.returningOptions != null) {
@@ -1331,8 +1332,8 @@ final class ActivityStack {
if (r.state != ActivityState.RESUMED && r != starting) {
// If this activity is paused, tell it
// to now show its window.
- if (DEBUG_VISBILITY) Slog.v(
- TAG, "Making visible and scheduling visibility: " + r);
+ if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY,
+ "Making visible and scheduling visibility: " + r);
try {
if (mTranslucentActivityWaiting != null) {
r.updateOptionsLocked(r.returningOptions);
@@ -1357,29 +1358,28 @@ final class ActivityStack {
if (r.fullscreen) {
// At this point, nothing else needs to be shown
- if (DEBUG_VISBILITY) Slog.v(TAG, "Fullscreen: at " + r);
+ if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Fullscreen: at " + r);
behindFullscreen = true;
} else if (!isHomeStack() && r.frontOfTask && task.isOverHomeStack()) {
- if (DEBUG_VISBILITY) Slog.v(TAG, "Showing home: at " + r);
+ if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Showing home: at " + r);
behindFullscreen = true;
}
} else {
- if (DEBUG_VISBILITY) Slog.v(
- TAG, "Make invisible? " + r + " finishing=" + r.finishing
- + " state=" + r.state
- + " behindFullscreen=" + behindFullscreen);
+ if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY,
+ "Make invisible? " + r + " finishing=" + r.finishing
+ + " state=" + r.state + " behindFullscreen=" + behindFullscreen);
// Now for any activities that aren't visible to the user, make
// sure they no longer are keeping the screen frozen.
if (r.visible) {
- if (DEBUG_VISBILITY) Slog.v(TAG, "Making invisible: " + r);
+ if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Making invisible: " + r);
try {
setVisible(r, false);
switch (r.state) {
case STOPPING:
case STOPPED:
if (r.app != null && r.app.thread != null) {
- if (DEBUG_VISBILITY) Slog.v(
- TAG, "Scheduling invisibility: " + r);
+ if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY,
+ "Scheduling invisibility: " + r);
r.app.thread.scheduleWindowVisibility(r.appToken, false);
}
break;
@@ -1410,7 +1410,7 @@ final class ActivityStack {
+ r.intent.getComponent(), e);
}
} else {
- if (DEBUG_VISBILITY) Slog.v(TAG, "Already invisible: " + r);
+ if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Already invisible: " + r);
}
}
}
@@ -1480,7 +1480,8 @@ final class ActivityStack {
}
if (r.state == ActivityState.INITIALIZING && r.mStartingWindowShown) {
- if (DEBUG_VISBILITY) Slog.w(TAG, "Found orphaned starting window " + r);
+ if (DEBUG_VISIBILITY) Slog.w(TAG_VISIBILITY,
+ "Found orphaned starting window " + r);
r.mStartingWindowShown = false;
mWindowManager.removeAppStartingWindow(r.appToken);
}
@@ -1523,7 +1524,7 @@ final class ActivityStack {
}
private boolean resumeTopActivityInnerLocked(ActivityRecord prev, Bundle options) {
- if (ActivityManagerService.DEBUG_LOCKSCREEN) mService.logLockScreen("");
+ if (DEBUG_LOCKSCREEN) mService.logLockScreen("");
if (!mService.mBooting && !mService.mBooted) {
// Not ready yet!
@@ -1641,12 +1642,12 @@ final class ActivityStack {
next.sleeping = false;
mStackSupervisor.mWaitingVisibleActivities.remove(next);
- if (DEBUG_SWITCH) Slog.v(TAG, "Resuming " + next);
+ if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Resuming " + next);
// If we are currently pausing an activity, then don't do anything
// until that is done.
if (!mStackSupervisor.allPausedActivitiesComplete()) {
- if (DEBUG_SWITCH || DEBUG_PAUSE || DEBUG_STATES) Slog.v(TAG,
+ if (DEBUG_SWITCH || DEBUG_PAUSE || DEBUG_STATES) Slog.v(TAG_PAUSE,
"resumeTopActivityLocked: Skip resume: some activity pausing.");
if (DEBUG_STACK) mStackSupervisor.validateTopActivitiesLocked();
return false;
@@ -1721,8 +1722,8 @@ final class ActivityStack {
if (!mStackSupervisor.mWaitingVisibleActivities.contains(prev)
&& next != null && !next.nowVisible) {
mStackSupervisor.mWaitingVisibleActivities.add(prev);
- if (DEBUG_SWITCH) Slog.v(
- TAG, "Resuming top, waiting visible to hide: " + prev);
+ if (DEBUG_SWITCH) Slog.v(TAG_SWITCH,
+ "Resuming top, waiting visible to hide: " + prev);
} else {
// The next activity is already visible, so hide the previous
// activity's windows right now so we can show the new one ASAP.
@@ -1734,16 +1735,16 @@ final class ActivityStack {
// new one is found to be full-screen or not.
if (prev.finishing) {
mWindowManager.setAppVisibility(prev.appToken, false);
- if (DEBUG_SWITCH) Slog.v(TAG, "Not waiting for visible to hide: "
- + prev + ", waitingVisible="
+ if (DEBUG_SWITCH) Slog.v(TAG_SWITCH,
+ "Not waiting for visible to hide: " + prev + ", waitingVisible="
+ mStackSupervisor.mWaitingVisibleActivities.contains(prev)
+ ", nowVisible=" + next.nowVisible);
} else {
- if (DEBUG_SWITCH) Slog.v(TAG,
+ if (DEBUG_SWITCH) Slog.v(TAG_SWITCH,
"Previous already visible but still waiting to hide: " + prev
- + ", waitingVisible="
- + mStackSupervisor.mWaitingVisibleActivities.contains(prev)
- + ", nowVisible=" + next.nowVisible);
+ + ", waitingVisible="
+ + mStackSupervisor.mWaitingVisibleActivities.contains(prev)
+ + ", nowVisible=" + next.nowVisible);
}
}
}
@@ -1765,7 +1766,7 @@ final class ActivityStack {
boolean anim = true;
if (prev != null) {
if (prev.finishing) {
- if (DEBUG_TRANSITION) Slog.v(TAG,
+ if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION,
"Prepare close transition: prev=" + prev);
if (mNoAnimActivities.contains(prev)) {
anim = false;
@@ -1778,7 +1779,8 @@ final class ActivityStack {
mWindowManager.setAppWillBeHidden(prev.appToken);
mWindowManager.setAppVisibility(prev.appToken, false);
} else {
- if (DEBUG_TRANSITION) Slog.v(TAG, "Prepare open transition: prev=" + prev);
+ if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION,
+ "Prepare open transition: prev=" + prev);
if (mNoAnimActivities.contains(next)) {
anim = false;
mWindowManager.prepareAppTransition(AppTransition.TRANSIT_NONE, false);
@@ -1795,7 +1797,7 @@ final class ActivityStack {
mWindowManager.setAppVisibility(prev.appToken, false);
}
} else {
- if (DEBUG_TRANSITION) Slog.v(TAG, "Prepare open transition: no previous");
+ if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION, "Prepare open transition: no previous");
if (mNoAnimActivities.contains(next)) {
anim = false;
mWindowManager.prepareAppTransition(AppTransition.TRANSIT_NONE, false);
@@ -1817,7 +1819,7 @@ final class ActivityStack {
ActivityStack lastStack = mStackSupervisor.getLastStack();
if (next.app != null && next.app.thread != null) {
- if (DEBUG_SWITCH) Slog.v(TAG, "Resume running: " + next);
+ if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Resume running: " + next);
// This activity is now becoming visible.
mWindowManager.setAppVisibility(next.appToken, true);
@@ -1882,9 +1884,8 @@ final class ActivityStack {
if (a != null) {
final int N = a.size();
if (!next.finishing && N > 0) {
- if (DEBUG_RESULTS) Slog.v(
- TAG, "Delivering results to " + next
- + ": " + a);
+ if (DEBUG_RESULTS) Slog.v(TAG_RESULTS,
+ "Delivering results to " + next + ": " + a);
next.app.thread.scheduleSendResult(next.appToken, a);
}
}
@@ -1961,7 +1962,7 @@ final class ActivityStack {
next.labelRes, next.icon, next.logo, next.windowFlags,
null, true);
}
- if (DEBUG_SWITCH) Slog.v(TAG, "Restarting: " + next);
+ if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Restarting: " + next);
}
if (DEBUG_STATES) Slog.d(TAG, "resumeTopActivityLocked: Restarting " + next);
mStackSupervisor.startSpecificActivityLocked(next, true, true);
@@ -2083,7 +2084,7 @@ final class ActivityStack {
// activity
if (task == r.task && mTaskHistory.indexOf(task) != (mTaskHistory.size() - 1)) {
mStackSupervisor.mUserLeaving = false;
- if (DEBUG_USER_LEAVING) Slog.v(TAG,
+ if (DEBUG_USER_LEAVING) Slog.v(TAG_USER_LEAVING,
"startActivity() behind front, mUserLeaving=false");
}
@@ -2108,9 +2109,9 @@ final class ActivityStack {
if (proc == null || proc.thread == null) {
showStartingIcon = true;
}
- if (DEBUG_TRANSITION) Slog.v(TAG,
+ if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION,
"Prepare open transition: starting " + r);
- if ((r.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) {
+ if ((r.intent.getFlags() & Intent.FLAG_ACTIVITY_NO_ANIMATION) != 0) {
mWindowManager.prepareAppTransition(AppTransition.TRANSIT_NONE, keepCurTransition);
mNoAnimActivities.add(r);
} else {
@@ -2280,13 +2281,13 @@ final class ActivityStack {
// same task affinity as the one we are moving,
// then merge it into the same task.
targetTask = bottom.task;
- if (DEBUG_TASKS) Slog.v(TAG, "Start pushing activity " + target
+ if (DEBUG_TASKS) Slog.v(TAG_TASKS, "Start pushing activity " + target
+ " out to bottom task " + bottom.task);
} else {
targetTask = createTaskRecord(mStackSupervisor.getNextTaskId(), target.info,
null, null, null, false);
targetTask.affinityIntent = target.intent;
- if (DEBUG_TASKS) Slog.v(TAG, "Start pushing activity " + target
+ if (DEBUG_TASKS) Slog.v(TAG_TASKS, "Start pushing activity " + target
+ " out to new task " + target.task);
}
@@ -2311,8 +2312,8 @@ final class ActivityStack {
if (DEBUG_ADD_REMOVE) Slog.i(TAG, "Removing activity " + p + " from task="
+ task + " adding to task=" + targetTask
+ " Callers=" + Debug.getCallers(4));
- if (DEBUG_TASKS) Slog.v(TAG, "Pushing next activity " + p
- + " out to target's task " + target.task);
+ if (DEBUG_TASKS) Slog.v(TAG_TASKS,
+ "Pushing next activity " + p + " out to target's task " + target.task);
p.setTask(targetTask, null);
targetTask.addActivityAtBottom(p);
@@ -2354,7 +2355,7 @@ final class ActivityStack {
noOptions = false;
}
}
- if (DEBUG_TASKS) Slog.w(TAG,
+ if (DEBUG_TASKS) Slog.w(TAG_TASKS,
"resetTaskIntendedTask: calling finishActivity on " + p);
if (finishActivityLocked(
p, Activity.RESULT_CANCELED, null, "reset-task", false)) {
@@ -2428,7 +2429,8 @@ final class ActivityStack {
// in a task that is not currently on top.)
if (forceReset || finishOnTaskLaunch) {
final int start = replyChainEnd >= 0 ? replyChainEnd : i;
- if (DEBUG_TASKS) Slog.v(TAG, "Finishing task at index " + start + " to " + i);
+ if (DEBUG_TASKS) Slog.v(TAG_TASKS,
+ "Finishing task at index " + start + " to " + i);
for (int srcPos = start; srcPos >= i; --srcPos) {
final ActivityRecord p = activities.get(srcPos);
if (p.finishing) {
@@ -2444,8 +2446,9 @@ final class ActivityStack {
}
final int start = replyChainEnd >= 0 ? replyChainEnd : i;
- if (DEBUG_TASKS) Slog.v(TAG, "Reparenting from task=" + affinityTask + ":"
- + start + "-" + i + " to task=" + task + ":" + taskInsertionPoint);
+ if (DEBUG_TASKS) Slog.v(TAG_TASKS,
+ "Reparenting from task=" + affinityTask + ":" + start + "-" + i
+ + " to task=" + task + ":" + taskInsertionPoint);
for (int srcPos = start; srcPos >= i; --srcPos) {
final ActivityRecord p = activities.get(srcPos);
p.setTask(task, null);
@@ -2454,8 +2457,8 @@ final class ActivityStack {
if (DEBUG_ADD_REMOVE) Slog.i(TAG, "Removing and adding activity " + p
+ " to stack at " + task,
new RuntimeException("here").fillInStackTrace());
- if (DEBUG_TASKS) Slog.v(TAG, "Pulling activity " + p + " from " + srcPos
- + " in to resetting task " + task);
+ if (DEBUG_TASKS) Slog.v(TAG_TASKS, "Pulling activity " + p
+ + " from " + srcPos + " in to resetting task " + task);
mWindowManager.setAppTask(p.appToken, taskId);
}
mWindowManager.moveTaskToTop(taskId);
@@ -2613,7 +2616,7 @@ final class ActivityStack {
}
final void stopActivityLocked(ActivityRecord r) {
- if (DEBUG_SWITCH) Slog.d(TAG, "Stopping: " + r);
+ if (DEBUG_SWITCH) Slog.d(TAG_SWITCH, "Stopping: " + r);
if ((r.intent.getFlags()&Intent.FLAG_ACTIVITY_NO_HISTORY) != 0
|| (r.info.flags&ActivityInfo.FLAG_NO_HISTORY) != 0) {
if (!r.finishing) {
@@ -2638,8 +2641,8 @@ final class ActivityStack {
if (DEBUG_STATES) Slog.v(TAG, "Moving to STOPPING: " + r
+ " (stop requested)");
r.state = ActivityState.STOPPING;
- if (DEBUG_VISBILITY) Slog.v(
- TAG, "Stopping visible=" + r.visible + " for " + r);
+ if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY,
+ "Stopping visible=" + r.visible + " for " + r);
if (!r.visible) {
mWindowManager.setAppVisibility(r.appToken, false);
}
@@ -2776,7 +2779,7 @@ final class ActivityStack {
// send the result
ActivityRecord resultTo = r.resultTo;
if (resultTo != null) {
- if (DEBUG_RESULTS) Slog.v(TAG, "Adding result to " + resultTo
+ if (DEBUG_RESULTS) Slog.v(TAG_RESULTS, "Adding result to " + resultTo
+ " who=" + r.resultWho + " req=" + r.requestCode
+ " res=" + resultCode + " data=" + resultData);
if (resultTo.userId != r.userId) {
@@ -2793,7 +2796,7 @@ final class ActivityStack {
resultData);
r.resultTo = null;
}
- else if (DEBUG_RESULTS) Slog.v(TAG, "No result destination from " + r);
+ else if (DEBUG_RESULTS) Slog.v(TAG_RESULTS, "No result destination from " + r);
// Make sure this HistoryRecord is not holding on to other resources,
// because clients have remote IPC references to this object so we
@@ -2841,7 +2844,7 @@ final class ActivityStack {
if (mResumedActivity == r) {
boolean endTask = index <= 0;
- if (DEBUG_VISBILITY || DEBUG_TRANSITION) Slog.v(TAG,
+ if (DEBUG_VISIBILITY || DEBUG_TRANSITION) Slog.v(TAG_TRANSITION,
"Prepare close transition: finishing " + r);
mWindowManager.prepareAppTransition(endTask
? AppTransition.TRANSIT_TASK_CLOSE
@@ -2851,8 +2854,9 @@ final class ActivityStack {
mWindowManager.setAppVisibility(r.appToken, false);
if (mPausingActivity == null) {
- if (DEBUG_PAUSE) Slog.v(TAG, "Finish needs to pause: " + r);
- if (DEBUG_USER_LEAVING) Slog.v(TAG, "finish() => pause with userLeaving=false");
+ if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Finish needs to pause: " + r);
+ if (DEBUG_USER_LEAVING) Slog.v(TAG_USER_LEAVING,
+ "finish() => pause with userLeaving=false");
startPausingLocked(false, false, false, false);
}
@@ -2862,10 +2866,10 @@ final class ActivityStack {
} else if (r.state != ActivityState.PAUSING) {
// If the activity is PAUSING, we will complete the finish once
// it is done pausing; else we can just directly finish it here.
- if (DEBUG_PAUSE) Slog.v(TAG, "Finish not pausing: " + r);
+ if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Finish not pausing: " + r);
return finishCurrentActivityLocked(r, FINISH_AFTER_PAUSE, oomAdj) == null;
} else {
- if (DEBUG_PAUSE) Slog.v(TAG, "Finish waiting for pause of: " + r);
+ if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Finish waiting for pause of: " + r);
}
return false;
@@ -3160,7 +3164,7 @@ final class ActivityStack {
}
final TaskRecord task = r.task;
if (task != null && task.removeActivity(r)) {
- if (DEBUG_STACK) Slog.i(TAG,
+ if (DEBUG_STACK) Slog.i(TAG_STACK,
"removeActivityFromHistoryLocked: last activity removed from " + this);
if (mStackSupervisor.isFrontStack(this) && task == topTask() &&
task.isOverHomeStack()) {
@@ -3213,7 +3217,7 @@ final class ActivityStack {
continue;
}
if (r.isDestroyable()) {
- if (DEBUG_SWITCH) Slog.v(TAG, "Destroying " + r + " in state " + r.state
+ if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Destroying " + r + " in state " + r.state
+ " resumed=" + mResumedActivity
+ " pausing=" + mPausingActivity + " for reason " + reason);
if (destroyActivityLocked(r, true, reason)) {
@@ -3229,8 +3233,8 @@ final class ActivityStack {
final boolean safelyDestroyActivityLocked(ActivityRecord r, String reason) {
if (r.isDestroyable()) {
- if (DEBUG_SWITCH) Slog.v(TAG, "Destroying " + r + " in state " + r.state
- + " resumed=" + mResumedActivity
+ if (DEBUG_SWITCH) Slog.v(TAG_SWITCH,
+ "Destroying " + r + " in state " + r.state + " resumed=" + mResumedActivity
+ " pausing=" + mPausingActivity + " for reason " + reason);
return destroyActivityLocked(r, true, reason);
}
@@ -3288,9 +3292,9 @@ final class ActivityStack {
* but then create a new client-side object for this same HistoryRecord.
*/
final boolean destroyActivityLocked(ActivityRecord r, boolean removeFromApp, String reason) {
- if (DEBUG_SWITCH || DEBUG_CLEANUP) Slog.v(
- TAG, "Removing activity from " + reason + ": token=" + r
- + ", app=" + (r.app != null ? r.app.processName : "(null)"));
+ if (DEBUG_SWITCH || DEBUG_CLEANUP) Slog.v(TAG_SWITCH,
+ "Removing activity from " + reason + ": token=" + r
+ + ", app=" + (r.app != null ? r.app.processName : "(null)"));
EventLog.writeEvent(EventLogTags.AM_DESTROY_ACTIVITY,
r.userId, System.identityHashCode(r),
r.task.taskId, r.shortComponentName, reason);
@@ -3322,7 +3326,7 @@ final class ActivityStack {
boolean skipDestroy = false;
try {
- if (DEBUG_SWITCH) Slog.i(TAG, "Destroying: " + r);
+ if (DEBUG_SWITCH) Slog.i(TAG_SWITCH, "Destroying: " + r);
r.app.thread.scheduleDestroyActivity(r.appToken, r.finishing,
r.configChangeFlags);
} catch (Exception e) {
@@ -3584,8 +3588,8 @@ final class ActivityStack {
for (int taskNdx = top; taskNdx >= 0; --taskNdx) {
final TaskRecord task = mTaskHistory.get(taskNdx);
if (task.taskType == homeStackTaskType) {
- if (DEBUG_TASKS || DEBUG_STACK)
- Slog.d(TAG, "moveHomeStackTaskToTop: moving " + task);
+ if (DEBUG_TASKS || DEBUG_STACK) Slog.d(TAG_STACK,
+ "moveHomeStackTaskToTop: moving " + task);
mTaskHistory.remove(taskNdx);
mTaskHistory.add(top, task);
updateTaskMovement(task, true);
@@ -3596,7 +3600,7 @@ final class ActivityStack {
final void moveTaskToFrontLocked(TaskRecord tr, boolean noAnimation, Bundle options,
String reason) {
- if (DEBUG_SWITCH) Slog.v(TAG, "moveTaskToFront: " + tr);
+ if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "moveTaskToFront: " + tr);
final int numTasks = mTaskHistory.size();
final int index = mTaskHistory.indexOf(tr);
@@ -3618,7 +3622,7 @@ final class ActivityStack {
ActivityRecord r = topRunningActivityLocked(null);
mService.setFocusedActivityLocked(r, reason);
- if (DEBUG_TRANSITION) Slog.v(TAG, "Prepare to front transition: task=" + tr);
+ if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION, "Prepare to front transition: task=" + tr);
if (noAnimation) {
mWindowManager.prepareAppTransition(AppTransition.TRANSIT_NONE, false);
if (r != null) {
@@ -3682,7 +3686,7 @@ final class ActivityStack {
}
}
- if (DEBUG_TRANSITION) Slog.v(TAG, "Prepare to back transition: task=" + taskId);
+ if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION, "Prepare to back transition: task=" + taskId);
boolean prevIsHome = false;
if (tr.isOverHomeStack()) {
@@ -3912,8 +3916,8 @@ final class ActivityStack {
results = r.results;
newIntents = r.newIntents;
}
- if (DEBUG_SWITCH) Slog.v(TAG, "Relaunching: " + r
- + " with results=" + results + " newIntents=" + newIntents
+ if (DEBUG_SWITCH) Slog.v(TAG_SWITCH,
+ "Relaunching: " + r + " with results=" + results + " newIntents=" + newIntents
+ " andResume=" + andResume);
EventLog.writeEvent(andResume ? EventLogTags.AM_RELAUNCH_RESUME_ACTIVITY
: EventLogTags.AM_RELAUNCH_ACTIVITY, r.userId, System.identityHashCode(r),
@@ -3924,8 +3928,8 @@ final class ActivityStack {
mStackSupervisor.removeChildActivityContainers(r);
try {
- if (DEBUG_SWITCH || DEBUG_STATES) Slog.i(TAG, "Moving to " +
- (andResume ? "RESUMED" : "PAUSED") + " Relaunching " + r);
+ if (DEBUG_SWITCH || DEBUG_STATES) Slog.i(TAG_SWITCH,
+ "Moving to " + (andResume ? "RESUMED" : "PAUSED") + " Relaunching " + r);
r.forceNewConfig = false;
r.app.thread.scheduleRelaunchActivity(r.appToken, results, newIntents, changes,
!andResume, new Configuration(mService.mConfiguration),
@@ -3934,7 +3938,7 @@ final class ActivityStack {
// the caller will only pass in 'andResume' if this activity is
// currently resumed, which implies we aren't sleeping.
} catch (RemoteException e) {
- if (DEBUG_SWITCH || DEBUG_STATES) Slog.i(TAG, "Relaunch failed", e);
+ if (DEBUG_SWITCH || DEBUG_STATES) Slog.i(TAG_SWITCH, "Relaunch failed", e);
}
if (andResume) {
@@ -4087,8 +4091,7 @@ final class ActivityStack {
public void unhandledBackLocked() {
final int top = mTaskHistory.size() - 1;
- if (DEBUG_SWITCH) Slog.d(
- TAG, "Performing unhandledBack(): top activity at " + top);
+ if (DEBUG_SWITCH) Slog.d(TAG_SWITCH, "Performing unhandledBack(): top activity at " + top);
if (top >= 0) {
final ArrayList<ActivityRecord> activities = mTaskHistory.get(top).mActivities;
int activityTop = activities.size() - 1;
@@ -4106,7 +4109,7 @@ final class ActivityStack {
*/
boolean handleAppDiedLocked(ProcessRecord app) {
if (mPausingActivity != null && mPausingActivity.app == app) {
- if (DEBUG_PAUSE || DEBUG_CLEANUP) Slog.v(TAG,
+ if (DEBUG_PAUSE || DEBUG_CLEANUP) Slog.v(TAG_PAUSE,
"App died while pausing: " + mPausingActivity);
mPausingActivity = null;
}
@@ -4246,7 +4249,7 @@ final class ActivityStack {
}
if (mTaskHistory.isEmpty()) {
- if (DEBUG_STACK) Slog.i(TAG, "removeTask: removing stack=" + this);
+ if (DEBUG_STACK) Slog.i(TAG_STACK, "removeTask: removing stack=" + this);
final boolean notHomeStack = !isHomeStack();
if (isOnHomeDisplay()) {
String myReason = reason + " leftTaskHistoryEmpty";
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index f874244..c564a6a 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -23,17 +23,11 @@ import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static android.content.Intent.FLAG_ACTIVITY_TASK_ON_HOME;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static com.android.server.am.ActivityManagerDebugConfig.*;
-import static com.android.server.am.ActivityManagerService.DEBUG_PAUSE;
-import static com.android.server.am.ActivityManagerService.DEBUG_RECENTS;
-import static com.android.server.am.ActivityManagerService.DEBUG_RESULTS;
-import static com.android.server.am.ActivityManagerService.DEBUG_STACK;
-import static com.android.server.am.ActivityManagerService.DEBUG_SWITCH;
-import static com.android.server.am.ActivityManagerService.DEBUG_TASKS;
-import static com.android.server.am.ActivityManagerService.DEBUG_USER_LEAVING;
import static com.android.server.am.ActivityManagerService.FIRST_SUPERVISOR_STACK_MSG;
import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE;
import static com.android.server.am.ActivityRecord.RECENTS_ACTIVITY_TYPE;
import static com.android.server.am.ActivityRecord.APPLICATION_ACTIVITY_TYPE;
+import static com.android.server.am.ActivityStack.ActivityState.*;
import android.app.Activity;
import android.app.ActivityManager;
@@ -120,6 +114,13 @@ 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_FOCUS = TAG + POSTFIX_FOCUS;
+ 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_STACK = TAG + POSTFIX_STACK;
+ private static final String TAG_SWITCH = TAG + POSTFIX_SWITCH;
+ private static final String TAG_TASKS = TAG + POSTFIX_TASKS;
+ 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;
@@ -381,7 +382,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
void notifyActivityDrawnForKeyguard() {
- if (ActivityManagerService.DEBUG_LOCKSCREEN) mService.logLockScreen("");
+ if (DEBUG_LOCKSCREEN) mService.logLockScreen("");
mWindowManager.notifyActivityDrawnForKeyguard();
}
@@ -422,7 +423,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
// The home stack should either be at the top or bottom of the stack list.
if ((toFront && (stacks.get(topNdx) != mHomeStack))
|| (!toFront && (stacks.get(0) != mHomeStack))) {
- if (DEBUG_STACK) Slog.d(TAG, "moveHomeTask: topStack old="
+ if (DEBUG_STACK) Slog.d(TAG_STACK, "moveHomeTask: topStack old="
+ ((lastFocusedStack != null) ? lastFocusedStack : stacks.get(topNdx))
+ " new=" + mFocusedStack);
stacks.remove(mHomeStack);
@@ -510,10 +511,10 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
// Don't give up! Look in recents.
- if (DEBUG_RECENTS) Slog.v(TAG, "Looking for task id=" + id + " in recents");
+ if (DEBUG_RECENTS) Slog.v(TAG_RECENTS, "Looking for task id=" + id + " in recents");
TaskRecord task = mRecentTasks.taskForIdLocked(id);
if (task == null) {
- if (DEBUG_RECENTS) Slog.d(TAG, "\tDidn't find task id=" + id + " in recents");
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS, "\tDidn't find task id=" + id + " in recents");
return null;
}
@@ -522,10 +523,11 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
if (!restoreRecentTaskLocked(task)) {
- if (DEBUG_RECENTS) Slog.w(TAG, "Couldn't restore task id=" + id + " found in recents");
+ if (DEBUG_RECENTS) Slog.w(TAG_RECENTS,
+ "Couldn't restore task id=" + id + " found in recents");
return null;
}
- if (DEBUG_RECENTS) Slog.w(TAG, "Restored task id=" + id + " from in recents");
+ if (DEBUG_RECENTS) Slog.w(TAG_RECENTS, "Restored task id=" + id + " from in recents");
return task;
}
@@ -633,14 +635,14 @@ public final class ActivityStackSupervisor implements DisplayListener {
final ActivityStack stack = stacks.get(stackNdx);
if (isFrontStack(stack)) {
final ActivityRecord r = stack.mResumedActivity;
- if (r != null && r.state != ActivityState.RESUMED) {
+ if (r != null && r.state != RESUMED) {
return false;
}
}
}
}
// TODO: Not sure if this should check if all Paused are complete too.
- if (DEBUG_STACK) Slog.d(TAG,
+ if (DEBUG_STACK) Slog.d(TAG_STACK,
"allResumedActivitiesComplete: mLastFocusedStack changing from=" +
mLastFocusedStack + " to=" + mFocusedStack);
mLastFocusedStack = mFocusedStack;
@@ -690,9 +692,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
final ActivityStack stack = stacks.get(stackNdx);
final ActivityRecord r = stack.mPausingActivity;
- if (r != null && r.state != ActivityState.PAUSED
- && r.state != ActivityState.STOPPED
- && r.state != ActivityState.STOPPING) {
+ if (r != null && r.state != PAUSED && r.state != STOPPED && r.state != STOPPING) {
if (DEBUG_STATES) {
Slog.d(TAG, "allPausedActivitiesComplete: r=" + r + " state=" + r.state);
pausing = false;
@@ -897,7 +897,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
ActivityContainer container = (ActivityContainer)iContainer;
synchronized (mService) {
if (container != null && container.mParentActivity != null &&
- container.mParentActivity.state != ActivityState.RESUMED) {
+ container.mParentActivity.state != RESUMED) {
// Cannot start a child activity if the parent is not resumed.
return ActivityManager.START_CANCELED;
}
@@ -1027,7 +1027,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
} while (!outResult.timeout && outResult.who == null);
} else if (res == ActivityManager.START_TASK_TO_FRONT) {
ActivityRecord r = stack.topRunningActivityLocked(null);
- if (r.nowVisible && r.state == ActivityState.RESUMED) {
+ if (r.nowVisible && r.state == RESUMED) {
outResult.timeout = false;
outResult.who = new ComponentName(r.info.packageName, r.info.name);
outResult.totalTime = 0;
@@ -1178,10 +1178,9 @@ public final class ActivityStackSupervisor implements DisplayListener {
results = r.results;
newIntents = r.newIntents;
}
- if (DEBUG_SWITCH) Slog.v(TAG, "Launching: " + r
- + " icicle=" + r.icicle
- + " with results=" + results + " newIntents=" + newIntents
- + " andResume=" + andResume);
+ if (DEBUG_SWITCH) Slog.v(TAG_SWITCH,
+ "Launching: " + r + " icicle=" + r.icicle + " with results=" + results
+ + " newIntents=" + newIntents + " andResume=" + andResume);
if (andResume) {
EventLog.writeEvent(EventLogTags.AM_RESTART_ACTIVITY,
r.userId, System.identityHashCode(r),
@@ -1290,7 +1289,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
// other state.
if (DEBUG_STATES) Slog.v(TAG, "Moving to STOPPED: " + r
+ " (starting in stopped state)");
- r.state = ActivityState.STOPPED;
+ r.state = STOPPED;
r.stopped = true;
}
@@ -1381,8 +1380,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
ActivityRecord resultRecord = null;
if (resultTo != null) {
sourceRecord = isInAnyStackLocked(resultTo);
- if (DEBUG_RESULTS) Slog.v(
- TAG, "Will send result to " + resultTo + " " + sourceRecord);
+ if (DEBUG_RESULTS) Slog.v(TAG_RESULTS,
+ "Will send result to " + resultTo + " " + sourceRecord);
if (sourceRecord != null) {
if (requestCode >= 0 && !sourceRecord.finishing) {
resultRecord = sourceRecord;
@@ -1726,7 +1725,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
// We'll invoke onUserLeaving before onPause only if the launching
// activity did not explicitly state that this is an automated launch.
mUserLeaving = (launchFlags & Intent.FLAG_ACTIVITY_NO_USER_ACTION) == 0;
- if (DEBUG_USER_LEAVING) Slog.v(TAG, "startActivity() => mUserLeaving=" + mUserLeaving);
+ if (DEBUG_USER_LEAVING) Slog.v(TAG_USER_LEAVING,
+ "startActivity() => mUserLeaving=" + mUserLeaving);
// If the caller has asked not to resume at this point, we make note
// of this in the record so that we can skip it when trying to find
@@ -1933,7 +1933,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
}
if (!movedToFront) {
- if (DEBUG_TASKS) Slog.d(TAG, "Bring to front target: " + targetStack
+ if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Bring to front target: " + targetStack
+ " from " + intentActivity);
targetStack.moveToFront("intentActivityFound");
}
@@ -2139,8 +2139,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
newTaskIntent != null ? newTaskIntent : intent,
voiceSession, voiceInteractor, !launchTaskBehind /* toTop */),
taskToAffiliate);
- if (DEBUG_TASKS) Slog.v(TAG, "Starting new activity " + r + " in new task " +
- r.task);
+ if (DEBUG_TASKS) Slog.v(TAG_TASKS,
+ "Starting new activity " + r + " in new task " + r.task);
} else {
r.setTask(reuseTask, taskToAffiliate);
}
@@ -2207,7 +2207,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
// to keep the new one in the same task as the one that is starting
// it.
r.setTask(sourceTask, null);
- if (DEBUG_TASKS) Slog.v(TAG, "Starting new activity " + r
+ if (DEBUG_TASKS) Slog.v(TAG_TASKS, "Starting new activity " + r
+ " in existing task " + r.task + " from source " + sourceRecord);
} else if (inTask != null) {
@@ -2246,7 +2246,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
r.setTask(inTask, null);
- if (DEBUG_TASKS) Slog.v(TAG, "Starting new activity " + r
+ if (DEBUG_TASKS) Slog.v(TAG_TASKS, "Starting new activity " + r
+ " in explicit task " + r.task);
} else {
@@ -2259,7 +2259,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
r.setTask(prev != null ? prev.task : targetStack.createTaskRecord(getNextTaskId(),
r.info, intent, null, null, true), null);
mWindowManager.moveTaskToTop(r.task.taskId);
- if (DEBUG_TASKS) Slog.v(TAG, "Starting new activity " + r
+ if (DEBUG_TASKS) Slog.v(TAG_TASKS, "Starting new activity " + r
+ " in new guessed " + r.task);
}
@@ -2599,8 +2599,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
return;
}
task.stack.moveTaskToFrontLocked(task, false /* noAnimation */, options, reason);
- if (DEBUG_STACK) Slog.d(TAG, "findTaskToMoveToFront: moved to front of stack="
- + task.stack);
+ if (DEBUG_STACK) Slog.d(TAG_STACK,
+ "findTaskToMoveToFront: moved to front of stack=" + task.stack);
}
ActivityStack getStack(int stackId) {
@@ -2793,20 +2793,20 @@ public final class ActivityStackSupervisor implements DisplayListener {
stack = createStackOnDisplay(getNextStackId(), Display.DEFAULT_DISPLAY);
// Restore home stack to top.
moveHomeStack(true, "restoreRecentTask");
- if (DEBUG_RECENTS)
- Slog.v(TAG, "Created stack=" + stack + " for recents restoration.");
+ if (DEBUG_RECENTS) Slog.v(TAG_RECENTS,
+ "Created stack=" + stack + " for recents restoration.");
}
if (stack == null) {
// What does this mean??? Not sure how we would get here...
- if (DEBUG_RECENTS)
- Slog.v(TAG, "Unable to find/create stack to restore recent task=" + task);
+ if (DEBUG_RECENTS) Slog.v(TAG_RECENTS,
+ "Unable to find/create stack to restore recent task=" + task);
return false;
}
stack.addTask(task, false, false);
- if (DEBUG_RECENTS)
- Slog.v(TAG, "Added restored task=" + task + " to stack=" + stack);
+ if (DEBUG_RECENTS) Slog.v(TAG_RECENTS,
+ "Added restored task=" + task + " to stack=" + stack);
final ArrayList<ActivityRecord> activities = task.mActivities;
for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) {
final ActivityRecord r = activities.get(activityNdx);
@@ -2839,18 +2839,18 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
ActivityRecord findTaskLocked(ActivityRecord r) {
- if (DEBUG_TASKS) Slog.d(TAG, "Looking for task of " + r);
+ if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Looking for task of " + r);
for (int displayNdx = mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) {
final ArrayList<ActivityStack> stacks = mActivityDisplays.valueAt(displayNdx).mStacks;
for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
final ActivityStack stack = stacks.get(stackNdx);
if (!r.isApplicationActivity() && !stack.isHomeStack()) {
- if (DEBUG_TASKS) Slog.d(TAG, "Skipping stack: (home activity) " + stack);
+ if (DEBUG_TASKS) Slog.d(TAG_TASKS, "Skipping stack: (home activity) " + stack);
continue;
}
if (!stack.mActivityContainer.isEligibleForNewTasks()) {
- if (DEBUG_TASKS) Slog.d(TAG, "Skipping stack: (new task not allowed) " +
- stack);
+ if (DEBUG_TASKS) Slog.d(TAG_TASKS,
+ "Skipping stack: (new task not allowed) " + stack);
continue;
}
final ActivityRecord ar = stack.findTaskLocked(r);
@@ -2859,7 +2859,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
}
}
- if (DEBUG_TASKS) Slog.d(TAG, "No task found");
+ if (DEBUG_TASKS) Slog.d(TAG_TASKS, "No task found");
return null;
}
@@ -2968,7 +2968,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
if (mStoppingActivities.size() > 0) {
// Still need to tell some activities to stop; can't sleep yet.
- if (DEBUG_PAUSE) Slog.v(TAG, "Sleep still need to stop "
+ if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Sleep still need to stop "
+ mStoppingActivities.size() + " activities");
scheduleIdleLocked();
dontSleep = true;
@@ -2976,7 +2976,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
if (mGoingToSleepActivities.size() > 0) {
// Still need to tell some activities to sleep; can't sleep yet.
- if (DEBUG_PAUSE) Slog.v(TAG, "Sleep still need to sleep "
+ if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Sleep still need to sleep "
+ mGoingToSleepActivities.size() + " activities");
dontSleep = true;
}
@@ -3127,16 +3127,14 @@ public final class ActivityStackSupervisor implements DisplayListener {
// 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 == ActivityState.DESTROYING
- || r.state == ActivityState.DESTROYED) {
+ if (r.finishing || r.state == DESTROYING || r.state == DESTROYED) {
if (DEBUG_RELEASE) Slog.d(TAG, "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 == ActivityState.RESUMED || r.state == ActivityState.PAUSING
- || r.state == ActivityState.PAUSED || r.state == ActivityState.STOPPING) {
+ 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);
continue;
}
@@ -3254,39 +3252,34 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
void validateTopActivitiesLocked() {
- // FIXME
-/* for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
- final ActivityStack stack = stacks.get(stackNdx);
- final ActivityRecord r = stack.topRunningActivityLocked(null);
- final ActivityState state = r == null ? ActivityState.DESTROYED : r.state;
- if (isFrontStack(stack)) {
- if (r == null) {
- Slog.e(TAG, "validateTop...: null top activity, stack=" + stack);
- } else {
- final ActivityRecord pausing = stack.mPausingActivity;
- if (pausing != null && pausing == r) {
- Slog.e(TAG, "validateTop...: top stack has pausing activity r=" + r +
- " state=" + state);
- }
- if (state != ActivityState.INITIALIZING && state != ActivityState.RESUMED) {
- Slog.e(TAG, "validateTop...: activity in front not resumed r=" + r +
- " state=" + state);
+ for (int displayNdx = mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) {
+ final ArrayList<ActivityStack> stacks = mActivityDisplays.valueAt(displayNdx).mStacks;
+ for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
+ final ActivityStack stack = stacks.get(stackNdx);
+ final ActivityRecord r = stack.topRunningActivityLocked(null);
+ final ActivityState state = r == null ? DESTROYED : r.state;
+ if (isFrontStack(stack)) {
+ if (r == null) Slog.e(TAG,
+ "validateTop...: null top activity, stack=" + stack);
+ else {
+ final ActivityRecord pausing = stack.mPausingActivity;
+ if (pausing != null && pausing == r) Slog.e(TAG,
+ "validateTop...: top stack has pausing activity r=" + r
+ + " state=" + state);
+ if (state != INITIALIZING && state != RESUMED) Slog.e(TAG,
+ "validateTop...: activity in front not resumed r=" + r
+ + " state=" + state);
}
- }
- } else {
- final ActivityRecord resumed = stack.mResumedActivity;
- if (resumed != null && resumed == r) {
- Slog.e(TAG, "validateTop...: back stack has resumed activity r=" + r +
- " state=" + state);
- }
- if (r != null && (state == ActivityState.INITIALIZING
- || state == ActivityState.RESUMED)) {
- Slog.e(TAG, "validateTop...: activity in back resumed r=" + r +
- " state=" + state);
+ } else {
+ final ActivityRecord resumed = stack.mResumedActivity;
+ if (resumed != null && resumed == r) Slog.e(TAG,
+ "validateTop...: back stack has resumed activity r=" + r
+ + " state=" + state);
+ if (r != null && (state == INITIALIZING || state == RESUMED)) Slog.e(TAG,
+ "validateTop...: activity in back resumed r=" + r + " state=" + state);
}
}
}
-*/
}
public void dump(PrintWriter pw, String prefix) {
@@ -3851,12 +3844,12 @@ public final class ActivityStackSupervisor implements DisplayListener {
mStackId = stackId;
mStack = new ActivityStack(this, mRecentTasks);
mIdString = "ActivtyContainer{" + mStackId + "}";
- if (DEBUG_STACK) Slog.d(TAG, "Creating " + this);
+ if (DEBUG_STACK) Slog.d(TAG_STACK, "Creating " + this);
}
}
void attachToDisplayLocked(ActivityDisplay activityDisplay) {
- if (DEBUG_STACK) Slog.d(TAG, "attachToDisplayLocked: " + this
+ if (DEBUG_STACK) Slog.d(TAG_STACK, "attachToDisplayLocked: " + this
+ " to display=" + activityDisplay);
mActivityDisplay = activityDisplay;
mStack.mDisplayId = activityDisplay.mDisplayId;
@@ -3934,7 +3927,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
protected void detachLocked() {
- if (DEBUG_STACK) Slog.d(TAG, "detachLocked: " + this + " from display="
+ if (DEBUG_STACK) Slog.d(TAG_STACK, "detachLocked: " + this + " from display="
+ mActivityDisplay + " Callers=" + Debug.getCallers(2));
if (mActivityDisplay != null) {
mActivityDisplay.detachActivitiesLocked(mStack);
@@ -4111,8 +4104,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
setSurfaceIfReadyLocked();
- if (DEBUG_STACK) Slog.d(TAG, "setSurface: " + this + " to display="
- + virtualActivityDisplay);
+ if (DEBUG_STACK) Slog.d(TAG_STACK,
+ "setSurface: " + this + " to display=" + virtualActivityDisplay);
}
@Override
@@ -4135,7 +4128,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
private void setSurfaceIfReadyLocked() {
- if (DEBUG_STACK) Slog.v(TAG, "setSurfaceIfReadyLocked: mDrawn=" + mDrawn +
+ if (DEBUG_STACK) Slog.v(TAG_STACK, "setSurfaceIfReadyLocked: mDrawn=" + mDrawn +
" mContainerState=" + mContainerState + " mSurface=" + mSurface);
if (mDrawn && mSurface != null && mContainerState == CONTAINER_STATE_NO_SURFACE) {
((VirtualActivityDisplay) mActivityDisplay).setSurface(mSurface);
@@ -4178,13 +4171,13 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
void attachActivities(ActivityStack stack) {
- if (DEBUG_STACK) Slog.v(TAG, "attachActivities: attaching " + stack + " to displayId="
- + mDisplayId);
+ if (DEBUG_STACK) Slog.v(TAG_STACK,
+ "attachActivities: attaching " + stack + " to displayId=" + mDisplayId);
mStacks.add(stack);
}
void detachActivitiesLocked(ActivityStack stack) {
- if (DEBUG_STACK) Slog.v(TAG, "detachActivitiesLocked: detaching " + stack
+ if (DEBUG_STACK) Slog.v(TAG_STACK, "detachActivitiesLocked: detaching " + stack
+ " from displayId=" + mDisplayId);
mStacks.remove(stack);
}
diff --git a/services/core/java/com/android/server/am/RecentTasks.java b/services/core/java/com/android/server/am/RecentTasks.java
index 04912d0..3a20ded 100644
--- a/services/core/java/com/android/server/am/RecentTasks.java
+++ b/services/core/java/com/android/server/am/RecentTasks.java
@@ -16,10 +16,7 @@
package com.android.server.am;
-import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
-import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
-import static com.android.server.am.ActivityManagerService.DEBUG_RECENTS;
-import static com.android.server.am.ActivityManagerService.DEBUG_TASKS;
+import static com.android.server.am.ActivityManagerDebugConfig.*;
import static com.android.server.am.TaskRecord.INVALID_TASK_ID;
import android.app.ActivityManager;
@@ -44,6 +41,8 @@ import java.util.HashMap;
*/
class RecentTasks extends ArrayList<TaskRecord> {
private static final String TAG = TAG_WITH_CLASS_NAME ? "RecentTasks" : TAG_AM;
+ private static final String TAG_RECENTS = TAG + POSTFIX_RECENTS;
+ private static final String TAG_TASKS = TAG + POSTFIX_TASKS;
// Maximum number recent bitmaps to keep in memory.
private static final int MAX_RECENT_BITMAPS = 3;
@@ -83,8 +82,8 @@ class RecentTasks extends ArrayList<TaskRecord> {
for (int i = size() - 1; i >= 0; --i) {
TaskRecord tr = get(i);
if (tr.userId == userId) {
- if(DEBUG_TASKS) Slog.i(TAG, "remove RecentTask " + tr
- + " when finishing user" + userId);
+ if(DEBUG_TASKS) Slog.i(TAG_TASKS,
+ "remove RecentTask " + tr + " when finishing user" + userId);
remove(i);
tr.removedFromRecents();
}
@@ -170,21 +169,21 @@ class RecentTasks extends ArrayList<TaskRecord> {
continue;
} else {
// Otherwise just not available for now.
- if (DEBUG_RECENTS && task.isAvailable) Slog.d(TAG,
+ if (DEBUG_RECENTS && task.isAvailable) Slog.d(TAG_RECENTS,
"Making recent unavailable: " + task);
task.isAvailable = false;
}
} else {
if (!ai.enabled || !ai.applicationInfo.enabled
|| (ai.applicationInfo.flags&ApplicationInfo.FLAG_INSTALLED) == 0) {
- if (DEBUG_RECENTS && task.isAvailable) Slog.d(TAG,
+ if (DEBUG_RECENTS && task.isAvailable) Slog.d(TAG_RECENTS,
"Making recent unavailable: " + task
+ " (enabled=" + ai.enabled + "/" + ai.applicationInfo.enabled
+ " flags=" + Integer.toHexString(ai.applicationInfo.flags)
+ ")");
task.isAvailable = false;
} else {
- if (DEBUG_RECENTS && !task.isAvailable) Slog.d(TAG,
+ if (DEBUG_RECENTS && !task.isAvailable) Slog.d(TAG_RECENTS,
"Making recent available: " + task);
task.isAvailable = true;
}
@@ -210,7 +209,7 @@ class RecentTasks extends ArrayList<TaskRecord> {
top = top.mNextAffiliate;
topIndex--;
}
- if (DEBUG_RECENTS) Slog.d(TAG, "addRecent: adding affilliates starting at "
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS, "addRecent: adding affilliates starting at "
+ topIndex + " from intial " + taskIndex);
// Find the end of the chain, doing a sanity check along the way.
boolean sane = top.mAffiliatedTaskId == task.mAffiliatedTaskId;
@@ -218,7 +217,7 @@ class RecentTasks extends ArrayList<TaskRecord> {
TaskRecord prev = top;
while (endIndex < recentsCount) {
TaskRecord cur = get(endIndex);
- if (DEBUG_RECENTS) Slog.d(TAG, "addRecent: looking at next chain @"
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS, "addRecent: looking at next chain @"
+ endIndex + " " + cur);
if (cur == top) {
// Verify start of the chain.
@@ -249,7 +248,7 @@ class RecentTasks extends ArrayList<TaskRecord> {
+ cur.mPrevAffiliate);
sane = false;
}
- if (DEBUG_RECENTS) Slog.d(TAG, "addRecent: end of chain @" + endIndex);
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS, "addRecent: end of chain @" + endIndex);
break;
} else {
// Verify middle of the chain's prev points to a valid item.
@@ -290,12 +289,12 @@ class RecentTasks extends ArrayList<TaskRecord> {
// All looks good, we can just move all of the affiliated tasks
// to the top.
for (int i=topIndex; i<=endIndex; i++) {
- if (DEBUG_RECENTS) Slog.d(TAG, "addRecent: moving affiliated " + task
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS, "addRecent: moving affiliated " + task
+ " from " + i + " to " + (i-topIndex));
TaskRecord cur = remove(i);
add(i - topIndex, cur);
}
- if (DEBUG_RECENTS) Slog.d(TAG, "addRecent: done moving tasks " + topIndex
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS, "addRecent: done moving tasks " + topIndex
+ " to " + endIndex);
return true;
}
@@ -312,19 +311,20 @@ class RecentTasks extends ArrayList<TaskRecord> {
int recentsCount = size();
// Quick case: never add voice sessions.
if (task.voiceSession != null) {
- if (DEBUG_RECENTS) Slog.d(TAG, "addRecent: not adding voice interaction " + task);
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS,
+ "addRecent: not adding voice interaction " + task);
return;
}
// Another quick case: check if the top-most recent task is the same.
if (!isAffiliated && recentsCount > 0 && get(0) == task) {
- if (DEBUG_RECENTS) Slog.d(TAG, "addRecent: already at top: " + task);
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS, "addRecent: already at top: " + task);
return;
}
// Another quick case: check if this is part of a set of affiliated
// tasks that are at the top.
if (isAffiliated && recentsCount > 0 && task.inRecents
&& task.mAffiliatedTaskId == get(0).mAffiliatedTaskId) {
- if (DEBUG_RECENTS) Slog.d(TAG, "addRecent: affiliated " + get(0)
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS, "addRecent: affiliated " + get(0)
+ " at top when adding " + task);
return;
}
@@ -341,7 +341,7 @@ class RecentTasks extends ArrayList<TaskRecord> {
remove(taskIndex);
add(0, task);
mService.notifyTaskPersisterLocked(task, false);
- if (DEBUG_RECENTS) Slog.d(TAG, "addRecent: moving to top " + task
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS, "addRecent: moving to top " + task
+ " from " + taskIndex);
return;
} else {
@@ -361,7 +361,7 @@ class RecentTasks extends ArrayList<TaskRecord> {
}
}
- if (DEBUG_RECENTS) Slog.d(TAG, "addRecent: trimming tasks for " + task);
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS, "addRecent: trimming tasks for " + task);
trimForTaskLocked(task, true);
recentsCount = size();
@@ -376,7 +376,7 @@ class RecentTasks extends ArrayList<TaskRecord> {
// If this is a simple non-affiliated task, or we had some failure trying to
// handle it as part of an affilated task, then just place it at the top.
add(0, task);
- if (DEBUG_RECENTS) Slog.d(TAG, "addRecent: adding " + task);
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS, "addRecent: adding " + task);
} else if (isAffiliated) {
// If this is a new affiliated task, then move all of the affiliated tasks
// to the front and insert this new one.
@@ -398,8 +398,8 @@ class RecentTasks extends ArrayList<TaskRecord> {
// after us in the list, so add at their position.
taskIndex = otherIndex;
}
- if (DEBUG_RECENTS) Slog.d(TAG, "addRecent: new affiliated task added at "
- + taskIndex + ": " + task);
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS,
+ "addRecent: new affiliated task added at " + taskIndex + ": " + task);
add(taskIndex, task);
// Now move everything to the front.
@@ -412,19 +412,19 @@ class RecentTasks extends ArrayList<TaskRecord> {
// everything and then go through our general path of adding a new task.
needAffiliationFix = true;
} else {
- if (DEBUG_RECENTS) Slog.d(TAG, "addRecent: couldn't find other affiliation "
- + other);
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS,
+ "addRecent: couldn't find other affiliation " + other);
needAffiliationFix = true;
}
} else {
- if (DEBUG_RECENTS) Slog.d(TAG,
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS,
"addRecent: adding affiliated task without next/prev:" + task);
needAffiliationFix = true;
}
}
if (needAffiliationFix) {
- if (DEBUG_RECENTS) Slog.d(TAG, "addRecent: regrouping affiliations");
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS, "addRecent: regrouping affiliations");
cleanupLocked(task.userId);
}
}
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index 3b34541..82e6d47 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -18,8 +18,7 @@ package com.android.server.am;
import static android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT;
import static android.content.Intent.FLAG_ACTIVITY_RETAIN_IN_RECENTS;
-import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
-import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
+import static com.android.server.am.ActivityManagerDebugConfig.*;
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;
@@ -58,6 +57,8 @@ import java.util.ArrayList;
final class TaskRecord {
private static final String TAG = TAG_WITH_CLASS_NAME ? "TaskRecord" : TAG_AM;
+ private static final String TAG_RECENTS = TAG + POSTFIX_RECENTS;
+ private static final String TAG_TASKS = TAG + POSTFIX_TASKS;
static final String ATTR_TASKID = "task_id";
private static final String TAG_INTENT = "intent";
@@ -312,8 +313,7 @@ final class TaskRecord {
_intent.setSourceBounds(null);
}
}
- if (ActivityManagerService.DEBUG_TASKS) Slog.v(TAG,
- "Setting Intent of " + this + " to " + _intent);
+ if (DEBUG_TASKS) Slog.v(TAG_TASKS, "Setting Intent of " + this + " to " + _intent);
intent = _intent;
realActivity = _intent != null ? _intent.getComponent() : null;
origActivity = null;
@@ -325,7 +325,7 @@ final class TaskRecord {
targetIntent.setComponent(targetComponent);
targetIntent.setSelector(null);
targetIntent.setSourceBounds(null);
- if (ActivityManagerService.DEBUG_TASKS) Slog.v(TAG,
+ if (DEBUG_TASKS) Slog.v(TAG_TASKS,
"Setting Intent of " + this + " to target " + targetIntent);
intent = targetIntent;
realActivity = targetComponent;
@@ -821,7 +821,7 @@ final class TaskRecord {
}
void saveToXml(XmlSerializer out) throws IOException, XmlPullParserException {
- if (ActivityManagerService.DEBUG_RECENTS) Slog.i(TAG, "Saving task=" + this);
+ if (DEBUG_RECENTS) Slog.i(TAG_RECENTS, "Saving task=" + this);
out.attribute(null, ATTR_TASKID, String.valueOf(taskId));
if (realActivity != null) {
@@ -1048,7 +1048,7 @@ final class TaskRecord {
activities.get(activityNdx).task = task;
}
- if (ActivityManagerService.DEBUG_RECENTS) Slog.d(TAG, "Restored task=" + task);
+ if (DEBUG_RECENTS) Slog.d(TAG_RECENTS, "Restored task=" + task);
return task;
}