Merge "Enforce permission check in getUidStats function" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
0f3164c79d
@@ -47,6 +47,7 @@ import static android.net.NetworkTemplate.buildTemplateMobileWildcard;
|
||||
import static android.net.NetworkTemplate.buildTemplateWifiWildcard;
|
||||
import static android.net.TrafficStats.KB_IN_BYTES;
|
||||
import static android.net.TrafficStats.MB_IN_BYTES;
|
||||
import static android.net.TrafficStats.UNSUPPORTED;
|
||||
import static android.os.Trace.TRACE_TAG_NETWORK;
|
||||
import static android.provider.Settings.Global.NETSTATS_AUGMENT_ENABLED;
|
||||
import static android.provider.Settings.Global.NETSTATS_COMBINE_SUBTYPE_ENABLED;
|
||||
@@ -1031,6 +1032,10 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
||||
|
||||
@Override
|
||||
public long getUidStats(int uid, int type) {
|
||||
final int callingUid = Binder.getCallingUid();
|
||||
if (callingUid != android.os.Process.SYSTEM_UID && callingUid != uid) {
|
||||
return UNSUPPORTED;
|
||||
}
|
||||
return nativeGetUidStat(uid, type, checkBpfStatsEnable());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user