OP_GET_USAGE_STATS should be noted, not checked.

Per email feedback, we should be using "noteOp" instead of "checkOp"
when testing if caller holds OP_GET_USAGE_STATS, so that we record
that caller used the operation.

Bug: 77662908
Test: builds, boots
Exempt-From-Owner-Approval: keep tests passing
Change-Id: I3a60345d590534fdbc2c1248e0d30dc85a5d6772
This commit is contained in:
Jeff Sharkey
2018-04-13 13:29:59 -06:00
committed by Jeff Sharkey
parent c32440ba66
commit b1296e58da

View File

@@ -176,7 +176,7 @@ public class NetworkStatsAccessTest {
}
private void setHasAppOpsPermission(int appOpsMode, boolean hasPermission) {
when(mAppOps.checkOp(AppOpsManager.OP_GET_USAGE_STATS, TEST_UID, TEST_PKG))
when(mAppOps.noteOp(AppOpsManager.OP_GET_USAGE_STATS, TEST_UID, TEST_PKG))
.thenReturn(appOpsMode);
when(mContext.checkCallingPermission(Manifest.permission.PACKAGE_USAGE_STATS)).thenReturn(
hasPermission ? PackageManager.PERMISSION_GRANTED