OSDN Git Service

Dump user id in dumpsys activity starter
authorWale Ogunwale <ogunwale@google.com>
Thu, 22 Jun 2017 23:43:53 +0000 (16:43 -0700)
committerWale Ogunwale <ogunwale@google.com>
Thu, 22 Jun 2017 23:43:53 +0000 (16:43 -0700)
To help with ANR debugging.

Test: adb shell dumpsys activity starter
Bug: 38121026
Change-Id: I96d530662e6a362b817df3ca8410cb173a2c0dd4

services/core/java/com/android/server/am/ActivityManagerService.java
services/core/java/com/android/server/am/ActivityStarter.java

index 6c3a8a4..607b84c 100644 (file)
@@ -4064,7 +4064,11 @@ public class ActivityManagerService extends IActivityManager.Stub
                     aInfo.applicationInfo.uid, true);
             if (app == null || app.instr == null) {
                 intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK);
-                mActivityStarter.startHomeActivityLocked(intent, aInfo, reason);
+                final int resolvedUserId = UserHandle.getUserId(aInfo.applicationInfo.uid);
+                // For ANR debugging to verify if the user activity is the one that actually
+                // launched.
+                final String myReason = reason + ":" + userId + ":" + resolvedUserId;
+                mActivityStarter.startHomeActivityLocked(intent, aInfo, myReason);
             }
         } else {
             Slog.wtf(TAG, "No home screen found for " + intent, new Throwable());
index be30d5a..a145435 100644 (file)
@@ -2308,6 +2308,7 @@ class ActivityStarter {
         pw.println(prefix + "ActivityStarter:");
         prefix = prefix + "  ";
 
+        pw.println(prefix + "mCurrentUser=" + mSupervisor.mCurrentUser);
         pw.println(prefix + "mLastStartReason=" + mLastStartReason);
         pw.println(prefix + "mLastStartActivityTimeMs="
                 + DateFormat.getDateTimeInstance().format(new Date(mLastStartActivityTimeMs)));