The NetworkStatsService.getUidStats() currently doesn't have any
permission check to make sure unpriviledged apps cannot read the stats
of a different uid. It will protentially have security problem since
apps with ACCESS_NETWORK_STATS permission can directly calling into
NetworkStatsService and bypass the check in TrafficStats. Move the uid
check from TrafficStats to NetworkStatsService to fix the problem.
Bug: 129151407
Test: atest AppSecurityTests#testAppFailAccessPrivateData_full
Test: atest AppSecurityTests#testAppFailAccessPrivateData_instant
Test: atest android.app.usage.cts.NetworkUsageStatsTest
Test: atest NetworkStatsBinderTest
Change-Id: Iae85676cfe5f114da69ec278afc2c904bc907234
am skip reason: Change-Id I45c3aa9046b316c8cd0943543d620a22e4afefd1 with SHA-1 f0fcc339c3 is in history
Change-Id: I286546740d259790e5153d8e9c565762fd46dda1
am skip reason: Change-Id I45c3aa9046b316c8cd0943543d620a22e4afefd1 with SHA-1 f0fcc339c3 is in history
Change-Id: I65040c118cde06339e9b221c557b314d205aa60e
am skip reason: Change-Id I45c3aa9046b316c8cd0943543d620a22e4afefd1 with SHA-1 ab1eb887a6 is in history
Change-Id: I019d6fa102815a24711aea617a51aca2364b6a6d
am skip reason: Change-Id I45c3aa9046b316c8cd0943543d620a22e4afefd1 with SHA-1 f0fcc339c3 is in history
Change-Id: I8af177e7714eeed230a0781016e240ebce6e95eb
am skip reason: Change-Id I45c3aa9046b316c8cd0943543d620a22e4afefd1 with SHA-1 f0fcc339c3 is in history
Change-Id: Iac21e8421c0de2ef41edd1ac82488c352029631a
am skip reason: Change-Id I45c3aa9046b316c8cd0943543d620a22e4afefd1 with SHA-1 f0fcc339c3 is in history
Change-Id: Idade28f3ca80b48d8d56d3584cbf195c2f250c40
This method is used in TrafficStats to obtain the snapshot for the
calling UID, so narrow it to only return data for that specific case.
We might be tempted to throw an exception or adjust the method
signature, but apps are using the raw AIDL in the greylist, so we
return them an empty NetworkStats if they ask about other UIDs.
Bug: 119672472
Test: manual
Change-Id: I3064630039f1d8473d6425dd663f17813a4ae3a1
am skip reason: Change-Id I0055f6b55c209a073ce997fc7a144477f9db7069 with SHA-1 5d0d638f54 is in history
Change-Id: I9ef4ca14953da43f4ac8c96c2e9d0f64d2265b46
am skip reason: Change-Id I0055f6b55c209a073ce997fc7a144477f9db7069 with SHA-1 5d0d638f54 is in history
Change-Id: Ifc2215c9893e017f41b0eb40b56cf9fd721f3df8
am skip reason: Change-Id I0055f6b55c209a073ce997fc7a144477f9db7069 with SHA-1 5d0d638f54 is in history
Change-Id: I767a4965451d5304f41ba0033ecffdbcb42f6a1f
am skip reason: Change-Id I0055f6b55c209a073ce997fc7a144477f9db7069 with SHA-1 5d0d638f54 is in history
Change-Id: I7ebe73a3ffffaae14a1f557a9f15136e460b2969
In current design, Rat type change in NSS is only for default
subscription. This is only correct for single sim project.
However, it does not correct for multi-sim scenarios such as
CBRS or DSDS, given that all data usage will be attributed
to the Rat type of default sub.
Thus, add a helper class to monitor subscription change event,
and register/unregister dynamically for Rat type change for
every subscription.
Note that unit test of the helper class will be addressed
in follow-up patch.
Test: m -j
Bug: 146415925
Change-Id: I0055f6b55c209a073ce997fc7a144477f9db7069
Merged-In: I0055f6b55c209a073ce997fc7a144477f9db7069
(cherry picked from ag/10977156 and fixed conflict)
am skip reason: Change-Id I0055f6b55c209a073ce997fc7a144477f9db7069 with SHA-1 5d0d638f54 is in history
Change-Id: I7c942a04814bb0938bc0aff8ba4699004dee8f15
am skip reason: Change-Id I0055f6b55c209a073ce997fc7a144477f9db7069 with SHA-1 3693a4c1ef is in history
Change-Id: I0e1175c00a3ba5a6ca3afd065b51d767534efd41
am skip reason: Change-Id I0055f6b55c209a073ce997fc7a144477f9db7069 with SHA-1 5d0d638f54 is in history
Change-Id: I5249d1f1cec8cdeb9dfdf650c7c6d868bae68fec