Merge "[ActivityManager] Reduce report wrong anr activity"

This commit is contained in:
Olawale Ogunwale
2015-04-01 17:32:37 +00:00
committed by Gerrit Code Review
2 changed files with 16 additions and 15 deletions

View File

@@ -982,24 +982,21 @@ final class ActivityRecord {
}
private ActivityRecord getWaitingHistoryRecordLocked() {
// First find the real culprit... if we are waiting
// for another app to start, then we have paused dispatching
// for this activity.
ActivityRecord r = this;
if (r.waitingVisible) {
// First find the real culprit... if this activity is waiting for
// another activity to start or has stopped, then the key dispatching
// timeout should not be caused by this.
if (waitingVisible || stopped) {
final ActivityStack stack = mStackSupervisor.getFocusedStack();
// Hmmm, who might we be waiting for?
r = stack.mResumedActivity;
// Try to use the one which is closest to top.
ActivityRecord r = stack.mResumedActivity;
if (r == null) {
r = stack.mPausingActivity;
}
// Both of those null? Fall back to 'this' again
if (r == null) {
r = this;
if (r != null) {
return r;
}
}
return r;
return this;
}
public boolean keyDispatchingTimedOut(String reason) {

View File

@@ -607,17 +607,21 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
boolean allResumedActivitiesVisible() {
boolean foundResumed = false;
for (int displayNdx = mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) {
ArrayList<ActivityStack> stacks = mActivityDisplays.valueAt(displayNdx).mStacks;
for (int stackNdx = stacks.size() - 1; stackNdx >= 0; --stackNdx) {
final ActivityStack stack = stacks.get(stackNdx);
final ActivityRecord r = stack.mResumedActivity;
if (r != null && (!r.nowVisible || r.waitingVisible)) {
return false;
if (r != null) {
if (!r.nowVisible || r.waitingVisible) {
return false;
}
foundResumed = true;
}
}
}
return true;
return foundResumed;
}
/**