summaryrefslogtreecommitdiff
path: root/framework-t/src/android/net/TrafficStats.java
Commit message (Collapse)AuthorAgeFilesLines
* [MS83.1] Make some APIs module-lib instead of system currentjunyulai2022-03-161-8/+8
| | | | | | | | | | | | | Some of the internal classes are not available for priv-apps. Thus, make them module-lib instead. This change also adds some nullability annotations for existing APIs according to go/android-api-guidelines. Test: m Test: m frameworks-base-api-system-current-compat Fix: 217479745 Change-Id: I18de46b11df7232ab82b9465856fdde621283156
* Move socket tagging implementation to mainline.Lorenzo Colitti2022-01-301-12/+74
| | | | | | | | | | | | | | | | | | | | | Currently, socket tagging is implemented in the framework. The Java code is in NetworkManagmentSocketTagger.java and the JNI is in libandroid and loaded by the general framework JNI loader. - Move the Java implementation to TrafficStats, which is the only caller of NetworkManagmentSocketTagger. This simplifies the code a bit because a number of methods can be deleted. - Move the JNI code to a new JNI library in the APEX. The library depends only on the NDK and statically links the NDK-only version of libnativehelper. Its size is only 5k on ARM and 10k on ARM64. - Temporarily make the framework depend on this library until the rest of the T connectivity code moves to the APEX. Test: atest NetworkUsageStatsTest CtsNetTestCases:TrafficStatsTest Change-Id: I050c7c515237f68b78d08987bc443f50a7949c06
* [MS69.1] Fix TrafficStats.init crashs for supplemental processJunyu Lai2022-01-251-0/+8
| | | | | | | | | | | | | | Supplemental apps has limited capabilities and service discovery is restricted. Hence, calling TrafficStats.init would result in crash. This change includes: 1. Print log instead of crashing process when running into any unexpected cases. Test: atest SupplementalProcessManagerTests Bug: 216062904 Change-Id: I7f827ccc485c997745779053b5936a6cb30e8219
* [MS61] Remove NetworkManagementSocketTagger#install dependencyJunyu Lai2022-01-221-0/+14
| | | | | | | | | Expose TrafficStats#attachSocketTagger and use it instead. Test: atest TrafficStatsTest Bug: 204830222 CTS-Coverage-Bug: 214979748 Change-Id: I1748d349b499053ad08bd62202325fa759ad8da5
* [MS66] Initialize TrafficStats with contextJunyu Lai2022-01-221-19/+23
| | | | | | | | | | | | | | | | | | | | | TrafficStats has static methods created in API level 8 that need access to NetworkStatsManager but doesn't take a context. Previously this was achieved by using ServiceManager, but with TrafficStats moving to the connectivity module, this is no longer possible. Instead, make sure TrafficStats has an appropriate context by the time any client code can call the relevant methods. • In app code, this achieved by passing the application context from ActivityThread#handleBindApplication, before any app code can run. • In the system server, this is achieved by passing the context right after creating service. Test: atest TrafficStatsTest CtsWebkitTestCases Bug: 204830222 Change-Id: I251bb8a4431ad12ff61929879ef1363cf06b9244
* [MS63.1] Remove TrafficStats.TAG_SYSTEM_DOWNLOAD dependencyJunyu Lai2022-01-181-0/+12
| | | | | | | | | Replace with system Api. Test: TH Bug: 204830222 CTS-Coverage-Bug: 215043101 Change-Id: Ic14b26d2862f6fe8bee18fe0c9eaf183052452ee
* [MS30] Remove ServiceManager#getService dependencyJunyu Lai2022-01-171-3/+20
| | | | | | | | | | | | | | | | Since TrafficStats is moving into the mainline module, ServiceManager#getService can no longer be accessed. This change use reflection to access getService, since there is no offical way to get the service binder, and TrafficStats is a static utility that doesn't have the context to invoke Context#getSystemService. This change also fixes minor lint errors. Test: atest CtsNetTestCases:TrafficStatsTest Bug: 204830222 Change-Id: I5caec42a71431b39f747fc791b8511d92e5cf7cc
* [MS21] Remove DataUnit dependencyJunyu Lai2021-12-291-6/+5
| | | | | | | | | | DataUnit is a hidden class, remove the references to it from files that about to be moved into the module. Test: TH Bug: 204830222 Change-Id: Ibfb82ab74f283686fb2af6c3a550d541440c890d
* [MS08] Move NetworkStats files to f/b/package/ConnectivityTJunyu Lai2021-12-101-0/+1032
NetworkStatsService is going to be moved into ConnectivityService module. Move all related files to packages/ConnectivityT so that it can be easily migrate these files to connectivity module after clearing the hidden API usages. Bug: 197717846 Test: TH Change-Id: Iead00832b5eb7b1dc40a92027c5a14ae8316b16c