Relax permissions around NetworkStatsManager APIs.
Currently, access to network usage history and statistics requires a signature|privileged permission, an AppOps bit (associated with the PACKAGE_USAGE_STATS permission), or device/profile ownership. Once access is granted via one of these mechanisms, it generally applies to any UID running in the same user as the caller. This CL expands access as follows: -Any app can access its own usage history with no extra requirements. -Carrier-privileged applications can access usage history for the entire device. -Device owners can access per-UID breakdowns for usage. Previously they could access the summary for the whole device, but not the individual breakdowns. We simplify the permission model by defining three access levels - DEFAULT (own app only), USER (all apps in the same user), and DEVICE (all apps on the device), and propagate these levels throughout. Finally, this CL fixes an apparent bug in NetworkStatsSerice#hasAppOpsPermissions - if the AppOp bit was in MODE_DEFAULT, hasAppOpsPermission would always return false instead of falling back to the PackageManager permission check. Bug: 25812859 Bug: 25813856 Change-Id: Ic96e0776e2a4215a400163872acea1ededfaced9
Loading
Please register or sign in to comment