diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 9382e1aa2a9e3abdef5c8ebd33fa15ab54d351a3..4d477c86b6c40fc64a991d0993cd7d3f873772fa 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -130,6 +130,7 @@ import static com.android.server.wm.ActivityTaskManagerService.DUMP_LASTANR_TRAC import static com.android.server.wm.ActivityTaskManagerService.DUMP_RECENTS_CMD; import static com.android.server.wm.ActivityTaskManagerService.DUMP_RECENTS_SHORT_CMD; import static com.android.server.wm.ActivityTaskManagerService.DUMP_STARTER_CMD; +import static com.android.server.wm.ActivityTaskManagerService.DUMP_TOP_RESUMED_ACTIVITY; import static com.android.server.wm.ActivityTaskManagerService.RELAUNCH_REASON_NONE; import static com.android.server.wm.ActivityTaskManagerService.relaunchReasonToString; @@ -8648,7 +8649,8 @@ public class ActivityManagerService extends IActivityManager.Stub if (DUMP_ACTIVITIES_CMD.equals(cmd) || DUMP_ACTIVITIES_SHORT_CMD.equals(cmd) || DUMP_LASTANR_CMD.equals(cmd) || DUMP_LASTANR_TRACES_CMD.equals(cmd) || DUMP_STARTER_CMD.equals(cmd) || DUMP_CONTAINERS_CMD.equals(cmd) - || DUMP_RECENTS_CMD.equals(cmd) || DUMP_RECENTS_SHORT_CMD.equals(cmd)) { + || DUMP_RECENTS_CMD.equals(cmd) || DUMP_RECENTS_SHORT_CMD.equals(cmd) + || DUMP_TOP_RESUMED_ACTIVITY.equals(cmd)) { mAtmInternal.dump( cmd, fd, pw, args, opti, true /* dumpAll */, dumpClient, dumpPackage); } else if ("binder-proxies".equals(cmd)) { diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java index f97af6259c9c327c3a2f3a0299ca3f9bd5d04321..c885520af8ac4ca93b68c6c1448fcc7ce65a6c68 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java @@ -317,6 +317,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { public static final String DUMP_CONTAINERS_CMD = "containers"; public static final String DUMP_RECENTS_CMD = "recents"; public static final String DUMP_RECENTS_SHORT_CMD = "r"; + public static final String DUMP_TOP_RESUMED_ACTIVITY = "top-resumed"; /** This activity is not being relaunched, or being relaunched for a non-resize reason. */ public static final int RELAUNCH_REASON_NONE = 0; @@ -3730,6 +3731,14 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } } + void dumpTopResumedActivityLocked(PrintWriter pw) { + pw.println("ACTIVITY MANAGER TOP-RESUMED (dumpsys activity top-resumed)"); + ActivityRecord topRecord = mRootWindowContainer.getTopResumedActivity(); + if (topRecord != null) { + topRecord.dump(pw, "", true); + } + } + void dumpActivitiesLocked(FileDescriptor fd, PrintWriter pw, String[] args, int opti, boolean dumpAll, boolean dumpClient, String dumpPackage) { dumpActivitiesLocked(fd, pw, args, opti, dumpAll, dumpClient, dumpPackage, @@ -5869,6 +5878,8 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { if (getRecentTasks() != null) { getRecentTasks().dump(pw, dumpAll, dumpPackage); } + } else if (DUMP_TOP_RESUMED_ACTIVITY.equals(cmd)) { + dumpTopResumedActivityLocked(pw); } } }