diff options
| author | 2021-06-30 20:53:49 -0700 | |
|---|---|---|
| committer | 2021-07-01 12:49:03 -0700 | |
| commit | 7839d2d844c6b031c2c63df4108f210c96e68efa (patch) | |
| tree | 278263865f09a05de3c42ef5e26feb69052aeb08 | |
| parent | 3835717ff99e1b477333cb8fb9815a1478498cd7 (diff) | |
Actually count explicit broadcasts as usage
Explicit broadcasts do actually still have the
FLAG_EXCLUDE_STOPPED_PACKAGES flag even though explicit broadcasts DO go
to stopped packages (and unstop them). This means checking for the flag
does not actually help to differentiate explicit broadcasts from
implicit broadcasts for the purpose of package usage.
Instead, we just check if there is a specific component name set for the
broadcast.
Bug: 192585331
Test: "am broadcast" an explicit broadcast to test app
"adb shell dumpsys usagestats" to check last time component used
Change-Id: Ib04a4398f15084d7a96daf0a621cfc468174187f
| -rw-r--r-- | services/core/java/com/android/server/am/BroadcastQueue.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/am/BroadcastQueue.java b/services/core/java/com/android/server/am/BroadcastQueue.java index de2c11b9fc2e..503b3a93b31f 100644 --- a/services/core/java/com/android/server/am/BroadcastQueue.java +++ b/services/core/java/com/android/server/am/BroadcastQueue.java @@ -1652,7 +1652,7 @@ public final class BroadcastQueue { maybeScheduleTempAllowlistLocked(receiverUid, r, brOptions); // Report that a component is used for explicit broadcasts. - if (!r.intent.isExcludingStopped() && r.curComponent != null + if (r.intent.getComponent() != null && r.curComponent != null && !TextUtils.equals(r.curComponent.getPackageName(), r.callerPackage)) { mService.mUsageStatsService.reportEvent( r.curComponent.getPackageName(), r.userId, Event.APP_COMPONENT_USED); |