Fix issue #29006049: Add logging for implicit broadcasts
We now have stats on broadcasts. We collect them over a day and
then reset, retaining the last days stats. When a checkin happens,
we return either the last day or the current stats and then clear
them. Not bothing to persist anything to storage, this data is
not that critical.
Change-Id: I1c3b331bcd03f79fa5e10575d9bc2ad7d9104f6f
diff --git a/services/core/java/com/android/server/am/BroadcastQueue.java b/services/core/java/com/android/server/am/BroadcastQueue.java
index 8ffc6f3..88645c1 100644
--- a/services/core/java/com/android/server/am/BroadcastQueue.java
+++ b/services/core/java/com/android/server/am/BroadcastQueue.java
@@ -898,6 +898,12 @@
// ... and on to the next...
addBroadcastToHistoryLocked(r);
+ if (r.intent.getComponent() == null && r.intent.getPackage() == null
+ && (r.intent.getFlags()&Intent.FLAG_RECEIVER_REGISTERED_ONLY) == 0) {
+ // This was an implicit broadcast... let's record it for posterity.
+ mService.addBroadcastStatLocked(r.intent.getAction(), r.callerPackage,
+ r.manifestCount, r.manifestSkipCount, r.finishTime-r.dispatchTime);
+ }
mOrderedBroadcasts.remove(0);
r = null;
looped = true;
@@ -1083,6 +1089,11 @@
skip = true;
}
}
+ if (!skip) {
+ r.manifestCount++;
+ } else {
+ r.manifestSkipCount++;
+ }
if (r.curApp != null && r.curApp.crashing) {
// If the target process is crashing, just skip it.
Slog.w(TAG, "Skipping deliver ordered [" + mQueueName + "] " + r