Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f01e810 authored by Sudheer Shanka's avatar Sudheer Shanka
Browse files

Verify PACKAGE_USAGE_STATS permission of broadcast source uid.

If the caller of the broadcast indicates that the broadcast
response event should be recorded, then verify they have the
PACKAGE_USAGE_STATS permission.

Bug: 206518114
Test: atest tests/tests/app.usage/src/android/app/usage/cts/UsageStatsTest.java
Change-Id: I7b33d806fd7536ae1644e16eae86c39e1c44521a
parent 4bfadd57
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -13389,10 +13389,8 @@ public class ActivityManagerService extends IActivityManager.Stub
                }
            }
            // TODO (206518114): We need to use the "real" package name which sent the broadcast,
            // in case the broadcast is sent via PendingIntent.
            if (brOptions.getIdForResponseEvent() > 0) {
                enforceUsageStatsPermission(callerPackage, realCallingUid, realCallingPid,
                enforceUsageStatsPermission(callerPackage, callingUid, callingPid,
                        "recordResponseEventWhileInBackground()");
            }
        }
+0 −2
Original line number Diff line number Diff line
@@ -1858,8 +1858,6 @@ public final class BroadcastQueue {
    }

    private void maybeReportBroadcastDispatchedEventLocked(BroadcastRecord r, int targetUid) {
        // TODO (206518114): Only allow apps with ACCESS_PACKAGE_USAGE_STATS to set
        // getIdForResponseEvent.
        // TODO (217251579): Temporarily use temp-allowlist reason to identify
        // push messages and record response events.
        useTemporaryAllowlistReasonAsSignal(r);