summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorriddle_hsu <riddle_hsu@htc.com>2015-03-04 17:27:05 +0800
committerriddle_hsu <riddle_hsu@htc.com>2015-03-04 17:27:05 +0800
commit01eb7fa7f99ebc410ae0bf17ea8fec8e61e694f0 (patch)
tree22322e7b722de0b5fa114c714b060f460a684df2 /services
parent75666e9054d97a9daecd5648f71414406413c6d9 (diff)
downloadframeworks_base-01eb7fa7f99ebc410ae0bf17ea8fec8e61e694f0.zip
frameworks_base-01eb7fa7f99ebc410ae0bf17ea8fec8e61e694f0.tar.gz
frameworks_base-01eb7fa7f99ebc410ae0bf17ea8fec8e61e694f0.tar.bz2
[ActivityManager] Skip receiver precisely.
Symptom: Report broadcast ANR on a dead process. Detail and sample: http://code.google.com/p/android/issues/detail?id=158329 Root cause: app.curReceiver can only remember the last running. If an application is both receiving FG and BG broadcast, only one of queue can discard, the remain one will still count as timeout. Solution: Select the skip-tartget-receiver by comparing the skipping app to the first record of mOrderedBroadcasts of each broadcast queues. Change-Id: Ic68d56f21b417a34f2d30d64ecfbed09c5e1764d
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/am/BroadcastQueue.java27
1 files changed, 11 insertions, 16 deletions
diff --git a/services/core/java/com/android/server/am/BroadcastQueue.java b/services/core/java/com/android/server/am/BroadcastQueue.java
index 9b7d0b2..5d969c6 100644
--- a/services/core/java/com/android/server/am/BroadcastQueue.java
+++ b/services/core/java/com/android/server/am/BroadcastQueue.java
@@ -294,28 +294,23 @@ public final class BroadcastQueue {
}
public void skipCurrentReceiverLocked(ProcessRecord app) {
- boolean reschedule = false;
- BroadcastRecord r = app.curReceiver;
- if (r != null && r.queue == this) {
- // The current broadcast is waiting for this app's receiver
- // to be finished. Looks like that's not going to happen, so
- // let the broadcast continue.
- logBroadcastReceiverDiscardLocked(r);
- finishReceiverLocked(r, r.resultCode, r.resultData,
- r.resultExtras, r.resultAbort, false);
- reschedule = true;
+ BroadcastRecord r = null;
+ if (mOrderedBroadcasts.size() > 0) {
+ BroadcastRecord br = mOrderedBroadcasts.get(0);
+ if (br.curApp == app) {
+ r = br;
+ }
}
-
- r = mPendingBroadcast;
- if (r != null && r.curApp == app) {
+ if (r == null && mPendingBroadcast != null && mPendingBroadcast.curApp == app) {
if (DEBUG_BROADCAST) Slog.v(TAG,
"[" + mQueueName + "] skip & discard pending app " + r);
+ r = mPendingBroadcast;
+ }
+
+ if (r != null) {
logBroadcastReceiverDiscardLocked(r);
finishReceiverLocked(r, r.resultCode, r.resultData,
r.resultExtras, r.resultAbort, false);
- reschedule = true;
- }
- if (reschedule) {
scheduleBroadcastsLocked();
}
}