Loading services/core/java/com/android/server/am/ActivityManagerService.java +11 −0 Original line number Diff line number Diff line Loading @@ -9851,6 +9851,10 @@ public class ActivityManagerService extends IActivityManager.Stub PriorityDump.dump(mPriorityDumper, fd, pw, args); } private static final String TICK = "---------------------------------------" + "----------------------------------------"; private void dumpEverything(FileDescriptor fd, PrintWriter pw, String[] args, int opti, boolean dumpAll, String dumpPackage, int displayIdFilter, boolean dumpClient, boolean dumpNormalPriority, int dumpAppId, boolean dumpProxies) { Loading Loading @@ -9906,6 +9910,11 @@ public class ActivityManagerService extends IActivityManager.Stub sdumper.dumpLocked(); } } // No need to hold the lock. pw.println(TICK); AnrTimer.dump(pw, false); // We drop the lock here because we can't call dumpWithClient() with the lock held; // if the caller wants a consistent state for the !dumpClient case, it can call this // method with the lock held. Loading Loading @@ -10351,6 +10360,8 @@ public class ActivityManagerService extends IActivityManager.Stub mOomAdjuster.dumpCachedAppOptimizerSettings(pw); mOomAdjuster.dumpCacheOomRankerSettings(pw); } } else if ("timers".equals(cmd)) { AnrTimer.dump(pw, true); } else if ("services".equals(cmd) || "s".equals(cmd)) { if (dumpClient) { ActiveServices.ServiceDumper dumper; Loading services/core/java/com/android/server/am/ActivityManagerShellCommand.java +1 −0 Original line number Diff line number Diff line Loading @@ -4095,6 +4095,7 @@ final class ActivityManagerShellCommand extends ShellCommand { pw.println(" lru: raw LRU process list"); pw.println(" binder-proxies: stats on binder objects and IPCs"); pw.println(" settings: currently applied config settings"); pw.println(" timers: the current ANR timer state"); pw.println(" service [COMP_SPEC]: service client-side state"); pw.println(" package [PACKAGE_NAME]: all state related to given package"); pw.println(" all: dump all activities"); Loading services/core/java/com/android/server/am/AnrHelper.java +3 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; import android.content.pm.ApplicationInfo; import android.os.Process; import android.os.SystemClock; import android.os.Trace; import android.util.ArraySet; Loading Loading @@ -267,6 +268,7 @@ class AnrHelper { private class AnrRecord { final ProcessRecord mApp; final int mPid; final int mUid; final String mActivityShortComponentName; final String mParentShortComponentName; final TimeoutRecord mTimeoutRecord; Loading @@ -283,6 +285,7 @@ class AnrHelper { Future<File> firstPidFilePromise) { mApp = anrProcess; mPid = anrProcess.mPid; mUid = anrProcess.uid; mActivityShortComponentName = activityShortComponentName; mParentShortComponentName = parentShortComponentName; mTimeoutRecord = timeoutRecord; Loading services/core/java/com/android/server/am/AnrTimer.java 0 → 100644 +834 −0 File added.Preview size limit exceeded, changes collapsed. Show changes services/core/java/com/android/server/am/BroadcastProcessQueue.java +17 −3 Original line number Diff line number Diff line Loading @@ -101,10 +101,9 @@ class BroadcastProcessQueue { boolean runningOomAdjusted; /** * Snapshotted value of {@link ProcessRecord#getCpuDelayTime()}, typically * used when deciding if we should extend the soft ANR timeout. * True if a timer has been started against this queue. */ long lastCpuDelayTime; private boolean mTimeoutScheduled; /** * Snapshotted value of {@link ProcessStateRecord#getCurProcState()} before Loading Loading @@ -1344,6 +1343,21 @@ class BroadcastProcessQueue { return head; } /** * Set the timeout flag to indicate that an ANR timer has been started. A value of true means a * timer is running; a value of false means there is no timer running. */ void setTimeoutScheduled(boolean timeoutStarted) { mTimeoutScheduled = timeoutStarted; } /** * Get the timeout flag */ boolean timeoutScheduled() { return mTimeoutScheduled; } @Override public String toString() { if (mCachedToString == null) { Loading Loading
services/core/java/com/android/server/am/ActivityManagerService.java +11 −0 Original line number Diff line number Diff line Loading @@ -9851,6 +9851,10 @@ public class ActivityManagerService extends IActivityManager.Stub PriorityDump.dump(mPriorityDumper, fd, pw, args); } private static final String TICK = "---------------------------------------" + "----------------------------------------"; private void dumpEverything(FileDescriptor fd, PrintWriter pw, String[] args, int opti, boolean dumpAll, String dumpPackage, int displayIdFilter, boolean dumpClient, boolean dumpNormalPriority, int dumpAppId, boolean dumpProxies) { Loading Loading @@ -9906,6 +9910,11 @@ public class ActivityManagerService extends IActivityManager.Stub sdumper.dumpLocked(); } } // No need to hold the lock. pw.println(TICK); AnrTimer.dump(pw, false); // We drop the lock here because we can't call dumpWithClient() with the lock held; // if the caller wants a consistent state for the !dumpClient case, it can call this // method with the lock held. Loading Loading @@ -10351,6 +10360,8 @@ public class ActivityManagerService extends IActivityManager.Stub mOomAdjuster.dumpCachedAppOptimizerSettings(pw); mOomAdjuster.dumpCacheOomRankerSettings(pw); } } else if ("timers".equals(cmd)) { AnrTimer.dump(pw, true); } else if ("services".equals(cmd) || "s".equals(cmd)) { if (dumpClient) { ActiveServices.ServiceDumper dumper; Loading
services/core/java/com/android/server/am/ActivityManagerShellCommand.java +1 −0 Original line number Diff line number Diff line Loading @@ -4095,6 +4095,7 @@ final class ActivityManagerShellCommand extends ShellCommand { pw.println(" lru: raw LRU process list"); pw.println(" binder-proxies: stats on binder objects and IPCs"); pw.println(" settings: currently applied config settings"); pw.println(" timers: the current ANR timer state"); pw.println(" service [COMP_SPEC]: service client-side state"); pw.println(" package [PACKAGE_NAME]: all state related to given package"); pw.println(" all: dump all activities"); Loading
services/core/java/com/android/server/am/AnrHelper.java +3 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; import android.content.pm.ApplicationInfo; import android.os.Process; import android.os.SystemClock; import android.os.Trace; import android.util.ArraySet; Loading Loading @@ -267,6 +268,7 @@ class AnrHelper { private class AnrRecord { final ProcessRecord mApp; final int mPid; final int mUid; final String mActivityShortComponentName; final String mParentShortComponentName; final TimeoutRecord mTimeoutRecord; Loading @@ -283,6 +285,7 @@ class AnrHelper { Future<File> firstPidFilePromise) { mApp = anrProcess; mPid = anrProcess.mPid; mUid = anrProcess.uid; mActivityShortComponentName = activityShortComponentName; mParentShortComponentName = parentShortComponentName; mTimeoutRecord = timeoutRecord; Loading
services/core/java/com/android/server/am/AnrTimer.java 0 → 100644 +834 −0 File added.Preview size limit exceeded, changes collapsed. Show changes
services/core/java/com/android/server/am/BroadcastProcessQueue.java +17 −3 Original line number Diff line number Diff line Loading @@ -101,10 +101,9 @@ class BroadcastProcessQueue { boolean runningOomAdjusted; /** * Snapshotted value of {@link ProcessRecord#getCpuDelayTime()}, typically * used when deciding if we should extend the soft ANR timeout. * True if a timer has been started against this queue. */ long lastCpuDelayTime; private boolean mTimeoutScheduled; /** * Snapshotted value of {@link ProcessStateRecord#getCurProcState()} before Loading Loading @@ -1344,6 +1343,21 @@ class BroadcastProcessQueue { return head; } /** * Set the timeout flag to indicate that an ANR timer has been started. A value of true means a * timer is running; a value of false means there is no timer running. */ void setTimeoutScheduled(boolean timeoutStarted) { mTimeoutScheduled = timeoutStarted; } /** * Get the timeout flag */ boolean timeoutScheduled() { return mTimeoutScheduled; } @Override public String toString() { if (mCachedToString == null) { Loading