Add additional logging for incorrect activity stop

Print ActivityClientRecord state when ActivityThread#performStopActivityInner
is called for already stopped activity.

Bug: 25267624
Change-Id: I2b044e42d0188ef9eaf15422b6a05617ade802e2
This commit is contained in:
Andrii Kulian
2016-03-16 13:44:56 -07:00
parent 794f70f172
commit 58178f2fe4
2 changed files with 30 additions and 2 deletions

View File

@@ -744,7 +744,7 @@ public class Activity extends ContextThemeWrapper
Activity mParent;
boolean mCalled;
/*package*/ boolean mResumed;
private boolean mStopped;
/*package*/ boolean mStopped;
boolean mFinished;
boolean mStartedActivity;
private boolean mDestroyed;

View File

@@ -379,6 +379,33 @@ public final class ActivityThread {
? "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 @@ public final class ActivityThread {
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) {