Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19de0f85 authored by Chalard Jean's avatar Chalard Jean
Browse files

Allow the network stack to read network stats history

Identical to ag/12843161

Bug: 168984229
Test: testNetworkStatsProvider
Change-Id: I7ad72c3b2b95f26ceec1371e7e0fdb92fa88920c
Merged-In: Ibb6342b0f263c874bb1f7ab4031a639778bad37e
parent 09893737
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.app.admin.DeviceAdminInfo;
import android.app.admin.DevicePolicyManagerInternal;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Process;
import android.os.UserHandle;
import android.telephony.TelephonyManager;

@@ -113,10 +114,11 @@ public final class NetworkStatsAccess {
                        TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS;
        boolean isDeviceOwner = dpmi != null && dpmi.isActiveAdminWithPolicy(callingUid,
                DeviceAdminInfo.USES_POLICY_DEVICE_OWNER);
        final int appId = UserHandle.getAppId(callingUid);
        if (hasCarrierPrivileges || isDeviceOwner
                || UserHandle.getAppId(callingUid) == android.os.Process.SYSTEM_UID) {
            // Carrier-privileged apps and device owners, and the system can access data usage for
            // all apps on the device.
                || appId == Process.SYSTEM_UID || appId == Process.NETWORK_STACK_UID) {
            // Carrier-privileged apps and device owners, and the system (including the
            // network stack) can access data usage for all apps on the device.
            return NetworkStatsAccess.Level.DEVICE;
        }