From 86ef571dab6a4e3644cce9fa4e67fe3550ab55d9 Mon Sep 17 00:00:00 2001 From: Sudheer Shanka Date: Mon, 11 Apr 2022 14:44:39 -0700 Subject: [PATCH] Fix the @RequiresPermission annotation. We initially were using PACKAGE_USAGE_STATS permission to guard the API BroadcastOptions.recordResponseEventWhileInBackground() but changed it's implementation to use the new ACCESS_BROADCAST_RESPONSE_STATS permission later but didn't update the annotation to specify the new permission. Bug: 228894230 Test: treehugger Change-Id: I5142e2d2f754e8014c0c291d56b5ec2254449e77 --- core/api/system-current.txt | 2 +- core/java/android/app/BroadcastOptions.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 650de2e00c3bd..66af50c24db2d 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -762,7 +762,7 @@ package android.app { method public void clearRequireCompatChange(); method public boolean isPendingIntentBackgroundActivityLaunchAllowed(); method public static android.app.BroadcastOptions makeBasic(); - method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public void recordResponseEventWhileInBackground(@IntRange(from=0) long); + method @RequiresPermission(android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS) public void recordResponseEventWhileInBackground(@IntRange(from=0) long); method @RequiresPermission(android.Manifest.permission.START_ACTIVITIES_FROM_BACKGROUND) public void setBackgroundActivityStartsAllowed(boolean); method public void setDontSendToRestrictedApps(boolean); method public void setPendingIntentBackgroundActivityLaunchAllowed(boolean); diff --git a/core/java/android/app/BroadcastOptions.java b/core/java/android/app/BroadcastOptions.java index 8b3c9fa73798d..56f8760f60599 100644 --- a/core/java/android/app/BroadcastOptions.java +++ b/core/java/android/app/BroadcastOptions.java @@ -532,7 +532,7 @@ public class BroadcastOptions extends ComponentOptions { * @hide */ @SystemApi - @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) + @RequiresPermission(android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS) public void recordResponseEventWhileInBackground(@IntRange(from = 0) long id) { mIdForResponseEvent = id; }