[MS35] Remove getNetwork[Total|Uid]Bytes dependencies from NPMS

1. getNetworkTotalBytes was used for querying overall statistics
   that regards of the NetworkPolicy to calculate the remaining
   data warning/limit quota that needs to be send to the lower layer.
2. getNetworkUidBytes was used for querying overall statistics of
   apps to find out the rapid traffic that caused by an abnormal
   app behavior.

This change replaces getNetwork[Total|Uid]Bytes with APIs that are
about to expose, and introduces a dependencies object for better
unit test injection.

Test: atest NetworkPolicyManagerServiceTest
Bug: 204830222

Change-Id: I802d2316fb22886e951456df0941c09176c981f8
This commit is contained in:
Junyu Lai
2021-12-24 02:00:54 +00:00
parent 4c0b80f6f1
commit 638f6667e9

View File

@@ -142,7 +142,15 @@ public class NetworkStatsManager {
setAugmentWithSubscriptionPlan(true);
}
/** @hide */
/**
* Set poll on open flag to indicate the poll is needed before service gets statistics
* result. This is default enabled. However, for any non-privileged caller, the poll might
* be omitted in case of rate limiting.
*
* @param pollOnOpen true if poll is needed.
* @hide
*/
// @SystemApi(client = MODULE_LIBRARIES)
public void setPollOnOpen(boolean pollOnOpen) {
if (pollOnOpen) {
mFlags |= FLAG_POLL_ON_OPEN;