Add additional logging for incorrect activity stop
Print ActivityClientRecord state when ActivityThread#performStopActivityInner
is called for already stopped activity.
Bug: 25267624
Change-Id: I2b044e42d0188ef9eaf15422b6a05617ade802e2
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 6b67b95..772dc9c 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -744,7 +744,7 @@
Activity mParent;
boolean mCalled;
/*package*/ boolean mResumed;
- private boolean mStopped;
+ /*package*/ boolean mStopped;
boolean mFinished;
boolean mStartedActivity;
private boolean mDestroyed;
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 060ac5e..93c668d1 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -379,6 +379,33 @@
? "no component name" : componentName.toShortString())
+ "}";
}
+
+ public String getStateString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("ActivityClientRecord{");
+ sb.append("paused=").append(paused);
+ sb.append(", stopped=").append(stopped);
+ sb.append(", hideForNow=").append(hideForNow);
+ sb.append(", startsNotResumed=").append(startsNotResumed);
+ sb.append(", isForward=").append(isForward);
+ sb.append(", pendingConfigChanges=").append(pendingConfigChanges);
+ sb.append(", onlyLocalRequest=").append(onlyLocalRequest);
+ sb.append(", preserveWindow=").append(mPreserveWindow);
+ if (activity != null) {
+ sb.append(", Activity{");
+ sb.append("resumed=").append(activity.mResumed);
+ sb.append(", stopped=").append(activity.mStopped);
+ sb.append(", finished=").append(activity.isFinishing());
+ sb.append(", destroyed=").append(activity.isDestroyed());
+ sb.append(", startedActivity=").append(activity.mStartedActivity);
+ sb.append(", temporaryPause=").append(activity.mTemporaryPause);
+ sb.append(", changingConfigurations=").append(activity.mChangingConfigurations);
+ sb.append(", visibleBehind=").append(activity.mVisibleBehind);
+ sb.append("}");
+ }
+ sb.append("}");
+ return sb.toString();
+ }
}
final class ProviderClientRecord {
@@ -3752,9 +3779,10 @@
return;
}
RuntimeException e = new RuntimeException(
- "Performing stop of activity that is not resumed: "
+ "Performing stop of activity that is already stopped: "
+ r.intent.getComponent().toShortString());
Slog.e(TAG, e.getMessage(), e);
+ Slog.e(TAG, r.getStateString());
}
if (info != null) {