UsageStatsService - call PermissionEnforcer helper on methods annotated with @EnforcePermission

Migrates all existing java methods annotated with @EnforcePermission
such that they call the super.<methodName>_enforcePermission
method provided by PermissionEnforcer.

This required by the @EnforcePermission annotation, but is currently a
no-op, and will be switched on with ag/20325484.

Bug: 234083358
Test: TH
Change-Id: I44f229a9f9b3483e638d2fe7ce49d7093f1fa5db
This commit is contained in:
mattgilbride
2022-11-05 19:50:38 +00:00
committed by Matt Gilbride
parent 25e1ad5ef3
commit d84a0bd79d

View File

@@ -2392,6 +2392,8 @@ public class UsageStatsService extends SystemService implements
@Override
public void setAppStandbyBucket(String packageName, int bucket, int userId) {
super.setAppStandbyBucket_enforcePermission();
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
final long token = Binder.clearCallingIdentity();
@@ -2442,6 +2444,8 @@ public class UsageStatsService extends SystemService implements
@Override
public void setAppStandbyBuckets(ParceledListSlice appBuckets, int userId) {
super.setAppStandbyBuckets_enforcePermission();
final int callingUid = Binder.getCallingUid();
final int callingPid = Binder.getCallingPid();
final long token = Binder.clearCallingIdentity();
@@ -2493,6 +2497,8 @@ public class UsageStatsService extends SystemService implements
public void setEstimatedLaunchTime(String packageName, long estimatedLaunchTime,
int userId) {
super.setEstimatedLaunchTime_enforcePermission();
final long token = Binder.clearCallingIdentity();
try {
UsageStatsService.this
@@ -2506,6 +2512,8 @@ public class UsageStatsService extends SystemService implements
@Override
public void setEstimatedLaunchTimes(ParceledListSlice estimatedLaunchTimes, int userId) {
super.setEstimatedLaunchTimes_enforcePermission();
final long token = Binder.clearCallingIdentity();
try {
UsageStatsService.this