Fix testRegisterUsageCallback
noteOp (introduced in go/ag/3897834) checks that the calling uid matches the calling package, which is not correct when using a fake calling package. Use the real package of the test so permissions are checked properly. The test currently only fails this way in pi-dev as noteOp is only used in pi-dev. Change-Id: I9ac3717af9335ba9efa0b8842a2df0d7b69ec9ab Test: Fixed test now passes in pi-dev Bug: b/78487385
This commit is contained in:
@@ -963,7 +963,6 @@ public class NetworkStatsServiceTest {
|
||||
|
||||
// verify service has empty history for wifi
|
||||
assertNetworkTotal(sTemplateWifi, 0L, 0L, 0L, 0L, 0);
|
||||
String callingPackage = "the.calling.package";
|
||||
long thresholdInBytes = 1L; // very small; should be overriden by framework
|
||||
DataUsageRequest inputRequest = new DataUsageRequest(
|
||||
DataUsageRequest.REQUEST_ID_UNSET, sTemplateWifi, thresholdInBytes);
|
||||
@@ -983,7 +982,7 @@ public class NetworkStatsServiceTest {
|
||||
|
||||
// Register and verify request and that binder was called
|
||||
DataUsageRequest request =
|
||||
mService.registerUsageCallback(callingPackage, inputRequest,
|
||||
mService.registerUsageCallback(mServiceContext.getOpPackageName(), inputRequest,
|
||||
messenger, mBinder);
|
||||
assertTrue(request.requestId > 0);
|
||||
assertTrue(Objects.equals(sTemplateWifi, request.template));
|
||||
|
||||
Reference in New Issue
Block a user