Loading services/core/java/com/android/server/am/ActivityManagerService.java +2 −7 Original line number Diff line number Diff line Loading @@ -13598,13 +13598,8 @@ public class ActivityManagerService extends IActivityManager.Stub } if (brOptions.getIdForResponseEvent() > 0) { // STOPSHIP (206518114): Temporarily check for PACKAGE_USAGE_STATS permission as // well until the clients switch to using the new permission. if (checkPermission(android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS, callingPid, callingUid) != PERMISSION_GRANTED) { enforceUsageStatsPermission(callerPackage, callingUid, callingPid, "recordResponseEventWhileInBackground()"); } enforcePermission(android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS, callingPid, callingUid, "recordResponseEventWhileInBackground"); } } services/usage/java/com/android/server/usage/UsageStatsService.java +9 −36 Original line number Diff line number Diff line Loading @@ -2768,18 +2768,9 @@ public class UsageStatsService extends SystemService implements throw new IllegalArgumentException("id needs to be >=0"); } final int result = getContext().checkCallingOrSelfPermission( android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS); // STOPSHIP (206518114): Temporarily check for PACKAGE_USAGE_STATS permission as well // until the clients switch to using the new permission. if (result != PackageManager.PERMISSION_GRANTED) { if (!hasPermission(callingPackage)) { throw new SecurityException( "Caller does not have the permission needed to call this API; " + "callingPackage=" + callingPackage + ", callingUid=" + Binder.getCallingUid()); } } getContext().enforceCallingOrSelfPermission( android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS, "queryBroadcastResponseStats"); final int callingUid = Binder.getCallingUid(); userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(), callingUid, userId, false /* allowAll */, false /* requireFull */, Loading @@ -2801,18 +2792,9 @@ public class UsageStatsService extends SystemService implements } final int result = getContext().checkCallingOrSelfPermission( android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS); // STOPSHIP (206518114): Temporarily check for PACKAGE_USAGE_STATS permission as well // until the clients switch to using the new permission. if (result != PackageManager.PERMISSION_GRANTED) { if (!hasPermission(callingPackage)) { throw new SecurityException( "Caller does not have the permission needed to call this API; " + "callingPackage=" + callingPackage + ", callingUid=" + Binder.getCallingUid()); } } getContext().enforceCallingOrSelfPermission( android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS, "clearBroadcastResponseStats"); final int callingUid = Binder.getCallingUid(); userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(), callingUid, userId, false /* allowAll */, false /* requireFull */, Loading @@ -2825,18 +2807,9 @@ public class UsageStatsService extends SystemService implements public void clearBroadcastEvents(@NonNull String callingPackage, @UserIdInt int userId) { Objects.requireNonNull(callingPackage); final int result = getContext().checkCallingOrSelfPermission( android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS); // STOPSHIP (206518114): Temporarily check for PACKAGE_USAGE_STATS permission as well // until the clients switch to using the new permission. if (result != PackageManager.PERMISSION_GRANTED) { if (!hasPermission(callingPackage)) { throw new SecurityException( "Caller does not have the permission needed to call this API; " + "callingPackage=" + callingPackage + ", callingUid=" + Binder.getCallingUid()); } } getContext().enforceCallingOrSelfPermission( android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS, "clearBroadcastEvents"); final int callingUid = Binder.getCallingUid(); userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(), callingUid, userId, false /* allowAll */, false /* requireFull */, Loading Loading
services/core/java/com/android/server/am/ActivityManagerService.java +2 −7 Original line number Diff line number Diff line Loading @@ -13598,13 +13598,8 @@ public class ActivityManagerService extends IActivityManager.Stub } if (brOptions.getIdForResponseEvent() > 0) { // STOPSHIP (206518114): Temporarily check for PACKAGE_USAGE_STATS permission as // well until the clients switch to using the new permission. if (checkPermission(android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS, callingPid, callingUid) != PERMISSION_GRANTED) { enforceUsageStatsPermission(callerPackage, callingUid, callingPid, "recordResponseEventWhileInBackground()"); } enforcePermission(android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS, callingPid, callingUid, "recordResponseEventWhileInBackground"); } }
services/usage/java/com/android/server/usage/UsageStatsService.java +9 −36 Original line number Diff line number Diff line Loading @@ -2768,18 +2768,9 @@ public class UsageStatsService extends SystemService implements throw new IllegalArgumentException("id needs to be >=0"); } final int result = getContext().checkCallingOrSelfPermission( android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS); // STOPSHIP (206518114): Temporarily check for PACKAGE_USAGE_STATS permission as well // until the clients switch to using the new permission. if (result != PackageManager.PERMISSION_GRANTED) { if (!hasPermission(callingPackage)) { throw new SecurityException( "Caller does not have the permission needed to call this API; " + "callingPackage=" + callingPackage + ", callingUid=" + Binder.getCallingUid()); } } getContext().enforceCallingOrSelfPermission( android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS, "queryBroadcastResponseStats"); final int callingUid = Binder.getCallingUid(); userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(), callingUid, userId, false /* allowAll */, false /* requireFull */, Loading @@ -2801,18 +2792,9 @@ public class UsageStatsService extends SystemService implements } final int result = getContext().checkCallingOrSelfPermission( android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS); // STOPSHIP (206518114): Temporarily check for PACKAGE_USAGE_STATS permission as well // until the clients switch to using the new permission. if (result != PackageManager.PERMISSION_GRANTED) { if (!hasPermission(callingPackage)) { throw new SecurityException( "Caller does not have the permission needed to call this API; " + "callingPackage=" + callingPackage + ", callingUid=" + Binder.getCallingUid()); } } getContext().enforceCallingOrSelfPermission( android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS, "clearBroadcastResponseStats"); final int callingUid = Binder.getCallingUid(); userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(), callingUid, userId, false /* allowAll */, false /* requireFull */, Loading @@ -2825,18 +2807,9 @@ public class UsageStatsService extends SystemService implements public void clearBroadcastEvents(@NonNull String callingPackage, @UserIdInt int userId) { Objects.requireNonNull(callingPackage); final int result = getContext().checkCallingOrSelfPermission( android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS); // STOPSHIP (206518114): Temporarily check for PACKAGE_USAGE_STATS permission as well // until the clients switch to using the new permission. if (result != PackageManager.PERMISSION_GRANTED) { if (!hasPermission(callingPackage)) { throw new SecurityException( "Caller does not have the permission needed to call this API; " + "callingPackage=" + callingPackage + ", callingUid=" + Binder.getCallingUid()); } } getContext().enforceCallingOrSelfPermission( android.Manifest.permission.ACCESS_BROADCAST_RESPONSE_STATS, "clearBroadcastEvents"); final int callingUid = Binder.getCallingUid(); userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(), callingUid, userId, false /* allowAll */, false /* requireFull */, Loading