Merge "Converted some AMS log points to use ActivityManagerDebugConfig."

This commit is contained in:
Wale Ogunwale
2015-03-11 00:31:32 +00:00
committed by Android (Google) Code Review
12 changed files with 153 additions and 143 deletions

View File

@@ -76,6 +76,7 @@ class ActivityManagerDebugConfig {
static final String POSTFIX_BACKUP = (PREPEND_CATEGORY_NAME) ? "_Backup" : "";
static final String POSTFIX_BROADCAST = (PREPEND_CATEGORY_NAME) ? "_Broadcast" : "";
static final String POSTFIX_CLEANUP = (PREPEND_CATEGORY_NAME) ? "_Cleanup" : "";
static final String POSTFIX_MU = "_MU";
static final String POSTFIX_SERVICE = (PREPEND_CATEGORY_NAME) ? "_Service" : "";
static final String POSTFIX_SERVICE_EXECUTING =

View File

@@ -248,42 +248,39 @@ public final class ActivityManagerService extends ActivityManagerNative
// File that stores last updated system version and called preboot receivers
static final String CALLED_PRE_BOOTS_FILENAME = "called_pre_boots.dat";
static final String TAG = TAG_WITH_CLASS_NAME ? "ActivityManagerService" : TAG_AM;
private static final String TAG = TAG_WITH_CLASS_NAME ? "ActivityManagerService" : TAG_AM;
private static final String TAG_BACKUP = TAG + POSTFIX_BACKUP;
private static final String TAG_BROADCAST = TAG + POSTFIX_BROADCAST;
private static final String TAG_CLEANUP = TAG + POSTFIX_CLEANUP;
private static final String TAG_MU = TAG + POSTFIX_MU;
// TODO(ogunwale): Migrate all the constants below to use ActivityManagerDebugConfig class.
static final boolean localLOGV = DEBUG_ALL || false;
static final boolean DEBUG_BACKUP = localLOGV || false;
static final boolean DEBUG_BROADCAST = localLOGV || false;
static final boolean DEBUG_BROADCAST_LIGHT = DEBUG_BROADCAST || false;
static final boolean DEBUG_BACKGROUND_BROADCAST = DEBUG_BROADCAST || false;
static final boolean DEBUG_CLEANUP = localLOGV || false;
static final boolean DEBUG_CONFIGURATION = localLOGV || false;
static final boolean DEBUG_CONFIGURATION = DEBUG_ALL || false;
static final boolean DEBUG_FOCUS = false;
static final boolean DEBUG_IMMERSIVE = localLOGV || false;
static final boolean DEBUG_MU = localLOGV || false;
static final boolean DEBUG_OOM_ADJ = localLOGV || false;
static final boolean DEBUG_LRU = localLOGV || false;
static final boolean DEBUG_PAUSE = localLOGV || false;
static final boolean DEBUG_POWER = localLOGV || false;
static final boolean DEBUG_IMMERSIVE = DEBUG_ALL || false;
static final boolean DEBUG_MU = DEBUG_ALL || false;
static final boolean DEBUG_OOM_ADJ = DEBUG_ALL || false;
static final boolean DEBUG_LRU = DEBUG_ALL || false;
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 = localLOGV || false;
static final boolean DEBUG_PROCESSES = localLOGV || false;
static final boolean DEBUG_PROVIDER = localLOGV || false;
static final boolean DEBUG_RESULTS = localLOGV || false;
static final boolean DEBUG_SERVICE = localLOGV || false;
static final boolean DEBUG_SERVICE_EXECUTING = localLOGV || false;
static final boolean DEBUG_STACK = localLOGV || false;
static final boolean DEBUG_SWITCH = localLOGV || false;
static final boolean DEBUG_TASKS = localLOGV || false;
static final boolean DEBUG_THUMBNAILS = localLOGV || false;
static final boolean DEBUG_TRANSITION = localLOGV || false;
static final boolean DEBUG_URI_PERMISSION = localLOGV || false;
static final boolean DEBUG_USER_LEAVING = localLOGV || false;
static final boolean DEBUG_VISBILITY = localLOGV || false;
static final boolean DEBUG_PSS = localLOGV || false;
static final boolean DEBUG_LOCKSCREEN = localLOGV || false;
static final boolean DEBUG_RECENTS = localLOGV || 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;
static final boolean VALIDATE_TOKENS = false;
static final boolean SHOW_ACTIVITY_START_TIME = true;
@@ -407,11 +404,9 @@ public final class ActivityManagerService extends ActivityManagerNative
BroadcastQueue broadcastQueueForIntent(Intent intent) {
final boolean isFg = (intent.getFlags() & Intent.FLAG_RECEIVER_FOREGROUND) != 0;
if (DEBUG_BACKGROUND_BROADCAST) {
Slog.i(TAG, "Broadcast intent " + intent + " on "
+ (isFg ? "foreground" : "background")
+ " queue");
}
if (DEBUG_BROADCAST_BACKGROUND) Slog.i(TAG_BROADCAST,
"Broadcast intent " + intent + " on "
+ (isFg ? "foreground" : "background") + " queue");
return (isFg) ? mFgBroadcastQueue : mBgBroadcastQueue;
}
@@ -1215,7 +1210,7 @@ public final class ActivityManagerService extends ActivityManagerNative
AppDeathRecipient(ProcessRecord app, int pid,
IApplicationThread thread) {
if (localLOGV) Slog.v(
if (DEBUG_ALL) Slog.v(
TAG, "New death recipient " + this
+ " for thread " + thread.asBinder());
mApp = app;
@@ -1225,7 +1220,7 @@ public final class ActivityManagerService extends ActivityManagerNative
@Override
public void binderDied() {
if (localLOGV) Slog.v(
if (DEBUG_ALL) Slog.v(
TAG, "Death received in " + this
+ " for thread " + mAppThread.asBinder());
synchronized(ActivityManagerService.this) {
@@ -4316,9 +4311,8 @@ public final class ActivityManagerService extends ActivityManagerNative
doLowMem = false;
}
EventLog.writeEvent(EventLogTags.AM_PROC_DIED, app.userId, app.pid, app.processName);
if (DEBUG_CLEANUP) Slog.v(
TAG, "Dying app: " + app + ", pid: " + pid
+ ", thread: " + thread.asBinder());
if (DEBUG_CLEANUP) Slog.v(TAG_CLEANUP,
"Dying app: " + app + ", pid: " + pid + ", thread: " + thread.asBinder());
handleAppDiedLocked(app, false, true);
if (doOomAdj) {
@@ -5499,7 +5493,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// Tell the process all about itself.
if (localLOGV) Slog.v(
if (DEBUG_ALL) Slog.v(
TAG, "Binding process pid " + pid + " to record " + app);
final String processName = app.processName;
@@ -5535,7 +5529,7 @@ public final class ActivityManagerService extends ActivityManagerNative
Slog.i(TAG, "Launching preboot mode app: " + app);
}
if (localLOGV) Slog.v(
if (DEBUG_ALL) Slog.v(
TAG, "New app record " + app
+ " thread=" + thread.asBinder() + " pid=" + pid);
try {
@@ -5656,7 +5650,8 @@ public final class ActivityManagerService extends ActivityManagerNative
// Check whether the next backup agent is in this process...
if (!badApp && mBackupTarget != null && mBackupTarget.appInfo.uid == app.uid) {
if (DEBUG_BACKUP) Slog.v(TAG, "New app is backup target, launching agent for " + app);
if (DEBUG_BACKUP) Slog.v(TAG_BACKUP,
"New app is backup target, launching agent for " + app);
ensurePackageDexOpt(mBackupTarget.appInfo.packageName);
try {
thread.scheduleCreateBackupAgent(mBackupTarget.appInfo,
@@ -5939,7 +5934,7 @@ public final class ActivityManagerService extends ActivityManagerNative
@Override
public final void activityStopped(IBinder token, Bundle icicle,
PersistableBundle persistentState, CharSequence description) {
if (localLOGV) Slog.v(TAG, "Activity stopped: token=" + token);
if (DEBUG_ALL) Slog.v(TAG, "Activity stopped: token=" + token);
// Refuse possible leaked file descriptors
if (icicle != null && icicle.hasFileDescriptors()) {
@@ -7689,7 +7684,7 @@ public final class ActivityManagerService extends ActivityManagerNative
synchronized(this) {
ArrayList<IAppTask> list = new ArrayList<IAppTask>();
try {
if (localLOGV) Slog.v(TAG, "getAppTasks");
if (DEBUG_ALL) Slog.v(TAG, "getAppTasks");
final int N = mRecentTasks.size();
for (int i = 0; i < N; i++) {
@@ -7723,7 +7718,7 @@ public final class ActivityManagerService extends ActivityManagerNative
ArrayList<RunningTaskInfo> list = new ArrayList<RunningTaskInfo>();
synchronized(this) {
if (localLOGV) Slog.v(
if (DEBUG_ALL) Slog.v(
TAG, "getTasks: max=" + maxNum + ", flags=" + flags);
final boolean allowed = isGetTasksAllowed("getTasks", Binder.getCallingPid(),
@@ -9250,7 +9245,7 @@ public final class ActivityManagerService extends ActivityManagerNative
ContentProviderRecord cpr = mProviderMap.getProviderByName(name, userId);
if(cpr == null) {
//remove from mProvidersByClass
if(localLOGV) Slog.v(TAG, name+" content provider not found in providers list");
if(DEBUG_ALL) Slog.v(TAG, name+" content provider not found in providers list");
return;
}
@@ -9787,7 +9782,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
public final void activitySlept(IBinder token) {
if (localLOGV) Slog.v(TAG, "Activity slept: token=" + token);
if (DEBUG_ALL) Slog.v(TAG, "Activity slept: token=" + token);
final long origId = Binder.clearCallingIdentity();
@@ -14738,7 +14733,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// If the app is undergoing backup, tell the backup manager about it
if (mBackupTarget != null && app.pid == mBackupTarget.app.pid) {
if (DEBUG_BACKUP || DEBUG_CLEANUP) Slog.d(TAG, "App "
if (DEBUG_BACKUP || DEBUG_CLEANUP) Slog.d(TAG_CLEANUP, "App "
+ mBackupTarget.appInfo + " died during backup");
try {
IBackupManager bm = IBackupManager.Stub.asInterface(
@@ -14765,7 +14760,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
if (!app.persistent || app.isolated) {
if (DEBUG_PROCESSES || DEBUG_CLEANUP) Slog.v(TAG,
if (DEBUG_PROCESSES || DEBUG_CLEANUP) Slog.v(TAG_CLEANUP,
"Removing non-persistent process during cleanup: " + app);
mProcessNames.remove(app.processName, app.uid);
mIsolatedProcesses.remove(app.uid);
@@ -14783,8 +14778,8 @@ public final class ActivityManagerService extends ActivityManagerNative
restart = true;
}
}
if ((DEBUG_PROCESSES || DEBUG_CLEANUP) && mProcessesOnHold.contains(app)) Slog.v(TAG,
"Clean-up removing on hold: " + app);
if ((DEBUG_PROCESSES || DEBUG_CLEANUP) && mProcessesOnHold.contains(app)) Slog.v(
TAG_CLEANUP, "Clean-up removing on hold: " + app);
mProcessesOnHold.remove(app);
if (app == mHomeProcess) {
@@ -15155,7 +15150,8 @@ public final class ActivityManagerService extends ActivityManagerNative
// instantiated. The backup agent will invoke backupAgentCreated() on the
// activity manager to announce its creation.
public boolean bindBackupAgent(ApplicationInfo app, int backupMode) {
if (DEBUG_BACKUP) Slog.v(TAG, "bindBackupAgent: app=" + app + " mode=" + backupMode);
if (DEBUG_BACKUP) Slog.v(TAG_BACKUP,
"bindBackupAgent: app=" + app + " mode=" + backupMode);
enforceCallingPermission("android.permission.CONFIRM_FULL_BACKUP", "bindBackupAgent");
synchronized(this) {
@@ -15198,7 +15194,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// If the process is already attached, schedule the creation of the backup agent now.
// If it is not yet live, this will be done when it attaches to the framework.
if (proc.thread != null) {
if (DEBUG_BACKUP) Slog.v(TAG, "Agent proc already running: " + proc);
if (DEBUG_BACKUP) Slog.v(TAG_BACKUP, "Agent proc already running: " + proc);
try {
proc.thread.scheduleCreateBackupAgent(app,
compatibilityInfoForPackageLocked(app), backupMode);
@@ -15206,7 +15202,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// Will time out on the backup manager side
}
} else {
if (DEBUG_BACKUP) Slog.v(TAG, "Agent proc not running, waiting for attach");
if (DEBUG_BACKUP) Slog.v(TAG_BACKUP, "Agent proc not running, waiting for attach");
}
// Invariants: at this point, the target app process exists and the application
// is either already running or in the process of coming up. mBackupTarget and
@@ -15219,7 +15215,7 @@ public final class ActivityManagerService extends ActivityManagerNative
@Override
public void clearPendingBackup() {
if (DEBUG_BACKUP) Slog.v(TAG, "clearPendingBackup");
if (DEBUG_BACKUP) Slog.v(TAG_BACKUP, "clearPendingBackup");
enforceCallingPermission("android.permission.BACKUP", "clearPendingBackup");
synchronized (this) {
@@ -15230,7 +15226,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// A backup agent has just come up
public void backupAgentCreated(String agentPackageName, IBinder agent) {
if (DEBUG_BACKUP) Slog.v(TAG, "backupAgentCreated: " + agentPackageName
if (DEBUG_BACKUP) Slog.v(TAG_BACKUP, "backupAgentCreated: " + agentPackageName
+ " = " + agent);
synchronized(this) {
@@ -15257,7 +15253,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// done with this agent
public void unbindBackupAgent(ApplicationInfo appInfo) {
if (DEBUG_BACKUP) Slog.v(TAG, "unbindBackupAgent: " + appInfo);
if (DEBUG_BACKUP) Slog.v(TAG_BACKUP, "unbindBackupAgent: " + appInfo);
if (appInfo == null) {
Slog.w(TAG, "unbind backup agent for null app");
return;
@@ -15400,7 +15396,7 @@ public final class ActivityManagerService extends ActivityManagerNative
// The first sticky in the list is returned directly back to the client.
Intent sticky = allSticky != null ? allSticky.get(0) : null;
if (DEBUG_BROADCAST) Slog.v(TAG, "Register receiver " + filter + ": " + sticky);
if (DEBUG_BROADCAST) Slog.v(TAG_BROADCAST, "Register receiver " + filter + ": " + sticky);
if (receiver == null) {
return sticky;
}
@@ -15470,7 +15466,7 @@ public final class ActivityManagerService extends ActivityManagerNative
}
public void unregisterReceiver(IIntentReceiver receiver) {
if (DEBUG_BROADCAST) Slog.v(TAG, "Unregister receiver: " + receiver);
if (DEBUG_BROADCAST) Slog.v(TAG_BROADCAST, "Unregister receiver: " + receiver);
final long origId = Binder.clearCallingIdentity();
try {
@@ -15621,9 +15617,9 @@ public final class ActivityManagerService extends ActivityManagerNative
// By default broadcasts do not go to stopped apps.
intent.addFlags(Intent.FLAG_EXCLUDE_STOPPED_PACKAGES);
if (DEBUG_BROADCAST_LIGHT) Slog.v(
TAG, (sticky ? "Broadcast sticky: ": "Broadcast: ") + intent
+ " ordered=" + ordered + " userid=" + userId);
if (DEBUG_BROADCAST_LIGHT) Slog.v(TAG_BROADCAST,
(sticky ? "Broadcast sticky: ": "Broadcast: ") + intent
+ " ordered=" + ordered + " userid=" + userId);
if ((resultTo != null) && !ordered) {
Slog.w(TAG, "Broadcast " + intent + " not ordered but result callback requested!");
}
@@ -15945,7 +15941,7 @@ public final class ActivityManagerService extends ActivityManagerNative
final boolean replacePending =
(intent.getFlags()&Intent.FLAG_RECEIVER_REPLACE_PENDING) != 0;
if (DEBUG_BROADCAST) Slog.v(TAG, "Enqueing broadcast: " + intent.getAction()
if (DEBUG_BROADCAST) Slog.v(TAG_BROADCAST, "Enqueing broadcast: " + intent.getAction()
+ " replacePending=" + replacePending);
int NR = registeredReceivers != null ? registeredReceivers.size() : 0;
@@ -15958,8 +15954,7 @@ public final class ActivityManagerService extends ActivityManagerNative
callerPackage, callingPid, callingUid, resolvedType, requiredPermission,
appOp, registeredReceivers, resultTo, resultCode, resultData, map,
ordered, sticky, false, userId);
if (DEBUG_BROADCAST) Slog.v(
TAG, "Enqueueing parallel broadcast " + r);
if (DEBUG_BROADCAST) Slog.v(TAG_BROADCAST, "Enqueueing parallel broadcast " + r);
final boolean replaced = replacePending && queue.replaceParallelBroadcastLocked(r);
if (!replaced) {
queue.enqueueParallelBroadcastLocked(r);
@@ -16049,11 +16044,10 @@ public final class ActivityManagerService extends ActivityManagerNative
requiredPermission, appOp, receivers, resultTo, resultCode,
resultData, map, ordered, sticky, false, userId);
if (DEBUG_BROADCAST) Slog.v(
TAG, "Enqueueing ordered broadcast " + r
if (DEBUG_BROADCAST) Slog.v(TAG_BROADCAST, "Enqueueing ordered broadcast " + r
+ ": prev had " + queue.mOrderedBroadcasts.size());
if (DEBUG_BROADCAST) Slog.i(
TAG, "Enqueueing broadcast " + r.intent.getAction());
if (DEBUG_BROADCAST) Slog.i(TAG_BROADCAST,
"Enqueueing broadcast " + r.intent.getAction());
boolean replaced = replacePending && queue.replaceOrderedBroadcastLocked(r);
if (!replaced) {
@@ -16182,7 +16176,7 @@ public final class ActivityManagerService extends ActivityManagerNative
public void finishReceiver(IBinder who, int resultCode, String resultData,
Bundle resultExtras, boolean resultAbort, int flags) {
if (DEBUG_BROADCAST) Slog.v(TAG, "Finish receiver: " + who);
if (DEBUG_BROADCAST) Slog.v(TAG_BROADCAST, "Finish receiver: " + who);
// Refuse possible leaked file descriptors
if (resultExtras != null && resultExtras.hasFileDescriptors()) {
@@ -16948,7 +16942,7 @@ public final class ActivityManagerService extends ActivityManagerNative
if (mBackupTarget != null && app == mBackupTarget.app) {
// If possible we want to avoid killing apps while they're being backed up
if (adj > ProcessList.BACKUP_APP_ADJ) {
if (DEBUG_BACKUP) Slog.v(TAG, "oom BACKUP_APP_ADJ for " + app);
if (DEBUG_BACKUP) Slog.v(TAG_BACKUP, "oom BACKUP_APP_ADJ for " + app);
adj = ProcessList.BACKUP_APP_ADJ;
if (procState > ActivityManager.PROCESS_STATE_IMPORTANT_BACKGROUND) {
procState = ActivityManager.PROCESS_STATE_IMPORTANT_BACKGROUND;

View File

@@ -16,6 +16,8 @@
package com.android.server.am;
import static com.android.server.am.ActivityManagerDebugConfig.*;
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;
@@ -71,7 +73,8 @@ import java.util.Objects;
* An entry in the history stack, representing an activity.
*/
final class ActivityRecord {
static final String TAG = ActivityManagerService.TAG;
private static final String TAG = TAG_WITH_CLASS_NAME ? "ActivityRecord" : TAG_AM;
static final boolean DEBUG_SAVED_STATE = ActivityStackSupervisor.DEBUG_SAVED_STATE;
final public static String RECENTS_PACKAGE_NAME = "com.android.systemui.recents";
@@ -319,7 +322,7 @@ final class ActivityRecord {
final WeakReference<ActivityRecord> weakActivity;
Token(ActivityRecord activity) {
weakActivity = new WeakReference<ActivityRecord>(activity);
weakActivity = new WeakReference<>(activity);
}
@Override public void windowsDrawn() {
@@ -372,7 +375,7 @@ final class ActivityRecord {
try {
return token != null ? ((Token)token).weakActivity.get() : null;
} catch (ClassCastException e) {
Slog.w(ActivityManagerService.TAG, "Bad activity token: " + token, e);
Slog.w(TAG, "Bad activity token: " + token, e);
return null;
}
}
@@ -676,11 +679,9 @@ final class ActivityRecord {
app.thread.scheduleNewIntent(ar, appToken);
unsent = false;
} catch (RemoteException e) {
Slog.w(ActivityManagerService.TAG,
"Exception thrown sending new intent to " + this, e);
Slog.w(TAG, "Exception thrown sending new intent to " + this, e);
} catch (NullPointerException e) {
Slog.w(ActivityManagerService.TAG,
"Exception thrown sending new intent to " + this, e);
Slog.w(TAG, "Exception thrown sending new intent to " + this, e);
}
}
if (unsent) {
@@ -820,7 +821,7 @@ final class ActivityRecord {
void updateThumbnailLocked(Bitmap newThumbnail, CharSequence description) {
if (newThumbnail != null) {
if (ActivityManagerService.DEBUG_THUMBNAILS) Slog.i(ActivityManagerService.TAG,
if (DEBUG_THUMBNAILS) Slog.i(TAG,
"Setting thumbnail of " + this + " to " + newThumbnail);
boolean thumbnailUpdated = task.setLastThumbnail(newThumbnail);
if (thumbnailUpdated && isPersistable()) {
@@ -905,7 +906,7 @@ final class ActivityRecord {
TimeUtils.formatDuration(totalTime, sb);
sb.append(")");
}
Log.i(ActivityManagerService.TAG, sb.toString());
Log.i(TAG, sb.toString());
}
if (totalTime > 0) {
//service.mUsageStatsService.noteFullyDrawnTime(realActivity, (int) totalTime);
@@ -936,7 +937,7 @@ final class ActivityRecord {
TimeUtils.formatDuration(totalTime, sb);
sb.append(")");
}
Log.i(ActivityManagerService.TAG, sb.toString());
Log.i(TAG, sb.toString());
}
mStackSupervisor.reportActivityLaunchedLocked(false, this, thisTime, totalTime);
if (totalTime > 0) {
@@ -963,8 +964,7 @@ final class ActivityRecord {
public void windowsVisible() {
synchronized(service) {
mStackSupervisor.reportActivityVisibleLocked(this);
if (ActivityManagerService.DEBUG_SWITCH) Log.v(
ActivityManagerService.TAG, "windowsVisible(): " + this);
if (ActivityManagerService.DEBUG_SWITCH) Log.v(TAG, "windowsVisible(): " + this);
if (!nowVisible) {
nowVisible = true;
lastVisibleTime = SystemClock.uptimeMillis();
@@ -983,8 +983,7 @@ final class ActivityRecord {
if (N > 0) {
for (int i=0; i<N; i++) {
ActivityRecord r = mStackSupervisor.mWaitingVisibleActivities.get(i);
if (ActivityManagerService.DEBUG_SWITCH) Log.v(
ActivityManagerService.TAG,
if (ActivityManagerService.DEBUG_SWITCH) Log.v(TAG,
"Was waiting for visible: " + r);
}
mStackSupervisor.mWaitingVisibleActivities.clear();
@@ -997,8 +996,7 @@ final class ActivityRecord {
}
public void windowsGone() {
if (ActivityManagerService.DEBUG_SWITCH) Log.v(
ActivityManagerService.TAG, "windowsGone(): " + this);
if (ActivityManagerService.DEBUG_SWITCH) Log.v(TAG, "windowsGone(): " + this);
nowVisible = false;
}

View File

@@ -16,9 +16,7 @@
package com.android.server.am;
import static com.android.server.am.ActivityManagerService.TAG;
import static com.android.server.am.ActivityManagerService.localLOGV;
import static com.android.server.am.ActivityManagerService.DEBUG_CLEANUP;
import static com.android.server.am.ActivityManagerDebugConfig.*;
import static com.android.server.am.ActivityManagerService.DEBUG_CONFIGURATION;
import static com.android.server.am.ActivityManagerService.DEBUG_PAUSE;
import static com.android.server.am.ActivityManagerService.DEBUG_RESULTS;
@@ -97,6 +95,9 @@ import java.util.Objects;
*/
final class ActivityStack {
private static final String TAG = TAG_WITH_CLASS_NAME ? "ActivityStack" : TAG_AM;
private static final String TAG_CLEANUP = TAG + POSTFIX_CLEANUP;
// Ticks during which we check progress while waiting for an app to launch.
static final int LAUNCH_TICK = 500;
@@ -264,9 +265,7 @@ final class ActivityStack {
final Handler mHandler;
final class ActivityStackHandler extends Handler {
//public Handler() {
// if (localLOGV) Slog.v(TAG, "Handler started!");
//}
ActivityStackHandler(Looper looper) {
super(looper);
}
@@ -2912,7 +2911,7 @@ final class ActivityStack {
// Need to go through the full pause cycle to get this
// activity into the stopped state and then finish it.
if (localLOGV) Slog.v(TAG, "Enqueueing pending finish: " + r);
if (DEBUG_ALL) Slog.v(TAG, "Enqueueing pending finish: " + r);
mStackSupervisor.mFinishingActivities.add(r);
r.resumeKeyDispatchingLocked();
mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null);
@@ -3435,15 +3434,14 @@ final class ActivityStack {
private void removeHistoryRecordsForAppLocked(ArrayList<ActivityRecord> list,
ProcessRecord app, String listName) {
int i = list.size();
if (DEBUG_CLEANUP) Slog.v(
TAG, "Removing app " + app + " from list " + listName
+ " with " + i + " entries");
if (DEBUG_CLEANUP) Slog.v(TAG_CLEANUP,
"Removing app " + app + " from list " + listName + " with " + i + " entries");
while (i > 0) {
i--;
ActivityRecord r = list.get(i);
if (DEBUG_CLEANUP) Slog.v(TAG, "Record #" + i + " " + r);
if (DEBUG_CLEANUP) Slog.v(TAG_CLEANUP, "Record #" + i + " " + r);
if (r.app == app) {
if (DEBUG_CLEANUP) Slog.v(TAG, "---> REMOVING this entry!");
if (DEBUG_CLEANUP) Slog.v(TAG_CLEANUP, "---> REMOVING this entry!");
list.remove(i);
removeTimeoutsForActivityLocked(r);
}
@@ -3465,15 +3463,15 @@ final class ActivityStack {
// Clean out the history list.
int i = numActivities();
if (DEBUG_CLEANUP) Slog.v(
TAG, "Removing app " + app + " from history with " + i + " entries");
if (DEBUG_CLEANUP) Slog.v(TAG_CLEANUP,
"Removing app " + app + " from history with " + i + " entries");
for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
final ArrayList<ActivityRecord> activities = mTaskHistory.get(taskNdx).mActivities;
for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) {
final ActivityRecord r = activities.get(activityNdx);
--i;
if (DEBUG_CLEANUP) Slog.v(
TAG, "Record #" + i + " " + r + ": app=" + r.app);
if (DEBUG_CLEANUP) Slog.v(TAG_CLEANUP,
"Record #" + i + " " + r + ": app=" + r.app);
if (r.app == app) {
final boolean remove;
if ((!r.haveState && !r.stateNotNeeded) || r.finishing) {
@@ -3512,7 +3510,7 @@ final class ActivityStack {
} else {
// We have the current state for this activity, so
// it can be restarted later when needed.
if (localLOGV) Slog.v(
if (DEBUG_ALL) Slog.v(
TAG, "Keeping entry, setting app to null");
if (r.visible) {
hasVisibleActivities = true;
@@ -4048,7 +4046,7 @@ final class ActivityStack {
numRunning++;
}
if (localLOGV) Slog.v(
if (DEBUG_ALL) Slog.v(
TAG, r.intent.getComponent().flattenToShortString()
+ ": task=" + r.task);
}

View File

@@ -21,7 +21,6 @@ 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.localLOGV;
import static com.android.server.am.ActivityManagerService.DEBUG_CONFIGURATION;
import static com.android.server.am.ActivityManagerService.DEBUG_FOCUS;
import static com.android.server.am.ActivityManagerService.DEBUG_PAUSE;
@@ -32,7 +31,6 @@ 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.ActivityManagerService.TAG;
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;
@@ -117,6 +115,8 @@ import java.util.ArrayList;
import java.util.List;
public final class ActivityStackSupervisor implements DisplayListener {
private static final String TAG = TAG_WITH_CLASS_NAME ? "ActivityStackSupervisor" : TAG_AM;
static final boolean DEBUG = DEBUG_ALL || false;
static final boolean DEBUG_ADD_REMOVE = DEBUG || false;
static final boolean DEBUG_APP = DEBUG || false;
@@ -1127,7 +1127,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
r.launchCount++;
r.lastLaunchTime = SystemClock.uptimeMillis();
if (localLOGV) Slog.v(TAG, "Launching: " + r);
if (DEBUG_ALL) Slog.v(TAG, "Launching: " + r);
int idx = app.activities.indexOf(r);
if (idx < 0) {
@@ -2283,7 +2283,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
// Checked.
final ActivityRecord activityIdleInternalLocked(final IBinder token, boolean fromTimeout,
Configuration config) {
if (localLOGV) Slog.v(TAG, "Activity idle: " + token);
if (DEBUG_ALL) Slog.v(TAG, "Activity idle: " + token);
ArrayList<ActivityRecord> stops = null;
ArrayList<ActivityRecord> finishes = null;
@@ -3164,7 +3164,7 @@ public final class ActivityStackSupervisor implements DisplayListener {
for (int activityNdx = mStoppingActivities.size() - 1; activityNdx >= 0; --activityNdx) {
ActivityRecord s = mStoppingActivities.get(activityNdx);
final boolean waitingVisible = mWaitingVisibleActivities.contains(s);
if (localLOGV) Slog.v(TAG, "Stopping " + s + ": nowVisible=" + nowVisible
if (DEBUG_ALL) Slog.v(TAG, "Stopping " + s + ": nowVisible=" + nowVisible
+ " waitingVisible=" + waitingVisible + " finishing=" + s.finishing);
if (waitingVisible && nowVisible) {
mWaitingVisibleActivities.remove(s);
@@ -3174,12 +3174,12 @@ public final class ActivityStackSupervisor implements DisplayListener {
// so get rid of it. Otherwise, we need to go through the
// normal flow and hide it once we determine that it is
// hidden by the activities in front of it.
if (localLOGV) Slog.v(TAG, "Before stopping, can hide: " + s);
if (DEBUG_ALL) Slog.v(TAG, "Before stopping, can hide: " + s);
mWindowManager.setAppVisibility(s.appToken, false);
}
}
if ((!waitingVisible || mService.isSleepingOrShuttingDown()) && remove) {
if (localLOGV) Slog.v(TAG, "Ready to stop: " + s);
if (DEBUG_ALL) Slog.v(TAG, "Ready to stop: " + s);
if (stops == null) {
stops = new ArrayList<>();
}

View File

@@ -16,6 +16,8 @@
package com.android.server.am;
import static com.android.server.am.ActivityManagerDebugConfig.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -43,7 +45,7 @@ import android.util.Slog;
import android.util.Xml;
public final class CompatModePackages {
private final String TAG = ActivityManagerService.TAG;
private static final String TAG = TAG_WITH_CLASS_NAME ? "CompatModePackages" : TAG_AM;
private final boolean DEBUG_CONFIGURATION = ActivityManagerService.DEBUG_CONFIGURATION;
private final ActivityManagerService mService;

View File

@@ -16,6 +16,9 @@
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 android.app.ActivityManager;
import android.app.IActivityContainer;
import android.content.IIntentSender;
@@ -35,6 +38,8 @@ import java.io.PrintWriter;
import java.lang.ref.WeakReference;
final class PendingIntentRecord extends IIntentSender.Stub {
private static final String TAG = TAG_WITH_CLASS_NAME ? "PendingIntentRecord" : TAG_AM;
final ActivityManagerService owner;
final Key key;
final int uid;
@@ -45,7 +50,7 @@ final class PendingIntentRecord extends IIntentSender.Stub {
String stringName;
String lastTagPrefix;
String lastTag;
final static class Key {
final int type;
final String packageName;
@@ -266,8 +271,7 @@ final class PendingIntentRecord extends IIntentSender.Stub {
options, userId, container, null);
}
} catch (RuntimeException e) {
Slog.w(ActivityManagerService.TAG,
"Unable to send startActivity intent", e);
Slog.w(TAG, "Unable to send startActivity intent", e);
}
break;
case ActivityManager.INTENT_SENDER_ACTIVITY_RESULT:
@@ -286,8 +290,7 @@ final class PendingIntentRecord extends IIntentSender.Stub {
sendFinish = false;
}
} catch (RuntimeException e) {
Slog.w(ActivityManagerService.TAG,
"Unable to send startActivity intent", e);
Slog.w(TAG, "Unable to send startActivity intent", e);
}
break;
case ActivityManager.INTENT_SENDER_SERVICE:
@@ -295,12 +298,11 @@ final class PendingIntentRecord extends IIntentSender.Stub {
owner.startServiceInPackage(uid,
finalIntent, resolvedType, userId);
} catch (RuntimeException e) {
Slog.w(ActivityManagerService.TAG,
"Unable to send startService intent", e);
Slog.w(TAG, "Unable to send startService intent", e);
}
break;
}
if (sendFinish) {
try {
finishedReceiver.performReceive(new Intent(finalIntent), 0,

View File

@@ -16,6 +16,9 @@
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 java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;
@@ -38,6 +41,8 @@ import android.view.Display;
* Activity manager code dealing with processes.
*/
final class ProcessList {
private static final String TAG = TAG_WITH_CLASS_NAME ? "ProcessList" : TAG_AM;
// The minimum time we allow between crashes, for us to consider this
// application to be bad and stop and its services and reject broadcasts.
static final int MIN_CRASH_INTERVAL = 60*1000;
@@ -633,8 +638,7 @@ final class ProcessList {
LocalSocketAddress.Namespace.RESERVED));
sLmkdOutputStream = sLmkdSocket.getOutputStream();
} catch (IOException ex) {
Slog.w(ActivityManagerService.TAG,
"lowmemorykiller daemon socket open failed");
Slog.w(TAG, "lowmemorykiller daemon socket open failed");
sLmkdSocket = null;
return false;
}
@@ -659,8 +663,7 @@ final class ProcessList {
sLmkdOutputStream.write(buf.array(), 0, buf.position());
return;
} catch (IOException ex) {
Slog.w(ActivityManagerService.TAG,
"Error writing to lowmemorykiller socket");
Slog.w(TAG, "Error writing to lowmemorykiller socket");
try {
sLmkdSocket.close();

View File

@@ -16,6 +16,9 @@
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 android.util.ArraySet;
import android.util.DebugUtils;
import android.util.EventLog;
@@ -49,6 +52,8 @@ import java.util.ArrayList;
* is currently running.
*/
final class ProcessRecord {
private static final String TAG = TAG_WITH_CLASS_NAME ? "ProcessRecord" : TAG_AM;
private final BatteryStatsImpl mBatteryStats; // where to collect runtime statistics
final ApplicationInfo info; // all about the first app in the process
final boolean isolated; // true if this is a special isolated process
@@ -472,7 +477,7 @@ final class ProcessRecord {
}
return false;
}
public void stopFreezingAllLocked() {
int i = activities.size();
while (i > 0) {
@@ -480,7 +485,7 @@ final class ProcessRecord {
activities.get(i).stopFreezingScreenLocked(true);
}
}
public void unlinkDeathRecipient() {
if (deathRecipient != null && thread != null) {
thread.asBinder().unlinkToDeath(deathRecipient, 0);
@@ -524,8 +529,7 @@ final class ProcessRecord {
void kill(String reason, boolean noisy) {
if (!killedByAm) {
if (noisy) {
Slog.i(ActivityManagerService.TAG, "Killing " + toShortString() + " (adj " + setAdj
+ "): " + reason);
Slog.i(TAG, "Killing " + toShortString() + " (adj " + setAdj + "): " + reason);
}
EventLog.writeEvent(EventLogTags.AM_KILL, userId, pid, processName, setAdj, reason);
Process.killProcessQuiet(pid);

View File

@@ -16,6 +16,12 @@
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.TaskRecord.INVALID_TASK_ID;
import android.app.ActivityManager;
import android.app.AppGlobals;
import android.content.ComponentName;
@@ -28,11 +34,6 @@ import android.os.RemoteException;
import android.os.UserHandle;
import android.util.Slog;
import static com.android.server.am.ActivityManagerService.DEBUG_RECENTS;
import static com.android.server.am.ActivityManagerService.DEBUG_TASKS;
import static com.android.server.am.ActivityManagerService.TAG;
import static com.android.server.am.TaskRecord.INVALID_TASK_ID;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@@ -42,6 +43,7 @@ import java.util.HashMap;
* Class for managing the recent tasks list.
*/
class RecentTasks extends ArrayList<TaskRecord> {
private static final String TAG = TAG_WITH_CLASS_NAME ? "RecentTasks" : TAG_AM;
// Maximum number recent bitmaps to keep in memory.
private static final int MAX_RECENT_BITMAPS = 3;

View File

@@ -47,10 +47,15 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
/**
* A running application service.
*/
final class ServiceRecord extends Binder {
private static final String TAG = TAG_WITH_CLASS_NAME ? "ServiceRecord" : TAG_AM;
// Maximum number of delivery attempts before giving up.
static final int MAX_DELIVERY_COUNT = 3;
@@ -487,8 +492,7 @@ final class ServiceRecord extends Binder {
appUid, appPid, null, localForegroundId, localForegroundNoti,
outId, userId);
} catch (RuntimeException e) {
Slog.w(ActivityManagerService.TAG,
"Error showing notification for service", e);
Slog.w(TAG, "Error showing notification for service", e);
// If it gave us a garbage notification, it doesn't
// get to be foreground.
ams.setServiceForeground(name, ServiceRecord.this,
@@ -517,8 +521,7 @@ final class ServiceRecord extends Binder {
inm.cancelNotificationWithTag(localPackageName, null,
localForegroundId, userId);
} catch (RuntimeException e) {
Slog.w(ActivityManagerService.TAG,
"Error canceling notification for service", e);
Slog.w(TAG, "Error canceling notification for service", e);
} catch (RemoteException e) {
}
}

View File

@@ -16,7 +16,8 @@
package com.android.server.am;
import static com.android.server.am.ActivityManagerService.TAG;
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.ActivityRecord.HOME_ACTIVITY_TYPE;
import static com.android.server.am.ActivityRecord.APPLICATION_ACTIVITY_TYPE;
import static com.android.server.am.ActivityRecord.RECENTS_ACTIVITY_TYPE;
@@ -54,6 +55,8 @@ import java.io.PrintWriter;
import java.util.ArrayList;
final class TaskRecord {
private static final String TAG = TAG_WITH_CLASS_NAME ? "TaskRecord" : TAG_AM;
static final String ATTR_TASKID = "task_id";
private static final String TAG_INTENT = "intent";
private static final String TAG_AFFINITYINTENT = "affinity_intent";
@@ -307,7 +310,7 @@ final class TaskRecord {
_intent.setSourceBounds(null);
}
}
if (ActivityManagerService.DEBUG_TASKS) Slog.v(ActivityManagerService.TAG,
if (ActivityManagerService.DEBUG_TASKS) Slog.v(TAG,
"Setting Intent of " + this + " to " + _intent);
intent = _intent;
realActivity = _intent != null ? _intent.getComponent() : null;
@@ -320,7 +323,7 @@ final class TaskRecord {
targetIntent.setComponent(targetComponent);
targetIntent.setSelector(null);
targetIntent.setSourceBounds(null);
if (ActivityManagerService.DEBUG_TASKS) Slog.v(ActivityManagerService.TAG,
if (ActivityManagerService.DEBUG_TASKS) Slog.v(TAG,
"Setting Intent of " + this + " to target " + targetIntent);
intent = targetIntent;
realActivity = targetComponent;