Merge "Allow the network stack to read network stats history" am: 7e4a864f60 am: 5ac12d9b41
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1450457 Change-Id: Ia0e0564d205ebc512db49e48c9fc3d90a581ea1b
This commit is contained in:
@@ -28,6 +28,7 @@ import android.app.admin.DeviceAdminInfo;
|
|||||||
import android.app.admin.DevicePolicyManagerInternal;
|
import android.app.admin.DevicePolicyManagerInternal;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.os.Process;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
|
|
||||||
@@ -113,10 +114,11 @@ public final class NetworkStatsAccess {
|
|||||||
TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
|
TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
|
||||||
boolean isDeviceOwner = dpmi != null && dpmi.isActiveAdminWithPolicy(callingUid,
|
boolean isDeviceOwner = dpmi != null && dpmi.isActiveAdminWithPolicy(callingUid,
|
||||||
DeviceAdminInfo.USES_POLICY_DEVICE_OWNER);
|
DeviceAdminInfo.USES_POLICY_DEVICE_OWNER);
|
||||||
|
final int appId = UserHandle.getAppId(callingUid);
|
||||||
if (hasCarrierPrivileges || isDeviceOwner
|
if (hasCarrierPrivileges || isDeviceOwner
|
||||||
|| UserHandle.getAppId(callingUid) == android.os.Process.SYSTEM_UID) {
|
|| appId == Process.SYSTEM_UID || appId == Process.NETWORK_STACK_UID) {
|
||||||
// Carrier-privileged apps and device owners, and the system can access data usage for
|
// Carrier-privileged apps and device owners, and the system (including the
|
||||||
// all apps on the device.
|
// network stack) can access data usage for all apps on the device.
|
||||||
return NetworkStatsAccess.Level.DEVICE;
|
return NetworkStatsAccess.Level.DEVICE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user