Respect metered filter in matchesMobile*
In old design, only metered mobile network would be matched, which means that only metered stats could be read if callers query the mobile stats. Currently, the caller in NetworkPolicyManagerService was updated to use the NetworkTemplate constructor with metered parameter in aosp/1563312 which means that the template will be created by a given meteredness. Thus, the hardcode metered can be removed. Remove the metered check from matches method will cause a different behavior. Therefore, to keep the original behavior, if the match rule is MATCH_MOBILE or MATCH_MOBILE_WILDCARD, it should pass METERED_YES to the constructor to build a metered template. Also, if a caller creates a template by calling the constructor with metered as a parameter, the behavior will also be changed. Therefore, if the caller expects to get metered stats then it should change to pass METERED_YES. If the caller expects to get both metered and unmetered stats then it should remain METERED_ALL and it would be a bug that been fixed by this patch. Bug: 183776809 Bug: 202092687 Test: atest FrameworksNetTests:NetworkStatsServiceTest manually test by generating traffic and check the data counts from "adb shell dumpsys netstats --uid" almost equal to the result from "adb shell cmd stats pull-source 10082" Change-Id: I66dd51b020f6d895cd002acc05bef6b6315cd447
Loading
Please register or sign in to comment