summaryrefslogtreecommitdiff
path: root/framework-t/src/android/net/NetworkStatsCollection.java
Commit message (Collapse)AuthorAgeFilesLines
* Don't clobber existing history entries.Lorenzo Colitti2022-05-181-1/+16
| | | | | | | | | | | | | | | | | | Currently, adding a history to a NetworkStatsCollection.Builder will overwrite any history that was previously passed in with the same key. This breaks the importer (which is the primary/only caller of this code), because the importer re-uses the same NetworkStatsCollection object to import multiple files. Instead, simply add any passed-in entries after the ones that were already there. Require the caller to pass in entries in order, because NetworkStatsHistory internally assumes that entris are always sorted. Ignore-AOSP-First: in a topic with internal-only changes Bug: 230289468 Test: manually verified this unbreaks the importer Change-Id: Ic8647ff28fca78d579d5f759f96a864877f8158b
* [MS81] Support remove history before cutoff timestampJunyu Lai2022-05-161-0/+20
| | | | | | | | | | | This is needed to ensure corrupted data can be clean up if the data migration process dones't go well. Test: NetworkStatsCollectionTest Bug: 197717846 Change-Id: Ic76ad6f3e96f03791b48988fb2622c9c647ffc7c (cherry picked from commit 306a00316cac03a0c61f995316c9c5682bec2a19) Merged-In: Ic76ad6f3e96f03791b48988fb2622c9c647ffc7c
* Fix NullPointerException happens in dumpCheckinAaron Huang2022-04-191-1/+1
| | | | | | | | | | | | | | | Currently dumpCheckin passes a null object to create the contructor of NetworkStatsCollection.Key but the constructor requires non-null object. Thus, it caused the NPE in dumpCheckin. To fix this exception, create an NetworkIdentitySet() object instead of using an null object. Bug: 225131008 Bug: 226539404 Test: dumpsys netstats --checkin is fine FrameworksNetTests Change-Id: I7f2dadf0647b3f42e0f667d96291d2ae37e23faf
* Merge "Fix proto invalid write type"Aaron Huang2022-03-221-7/+7
|\
| * Fix proto invalid write typeAaron Huang2022-03-071-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While dumpProtoLocked is called, InvalidProtocolBufferException occurred because types are mismatched between platform side and module side. netstats.proto was moved into connectivity module, both the platform(incident.proto) and the module uses protoc-gen-javastream to generate the Java classes from it. It should be fine since platform includes the source of the proto, and jarjar the generated classess in the module to avoid conflict with platform. Bug: 218566849 Test: adb shell incident 3001 adb shell dumpsys netstats --proto atest CtsIncidentHostTestCases:IncidentdTest#testIncidentReportDumpAuto Change-Id: I4654350a59dc1ca1a925785ad37f34aa7b481235 Merged-In: I4654350a59dc1ca1a925785ad37f34aa7b481235
* | [DU09-2]Modify the NetworkStatsCollection Builder APIFrank2022-03-071-22/+24
|/ | | | | | | | | | 1. Adding the bucketDuration with unit as bucketDurationmillis 2. make the Key class be final 3. The Key set parameter be marked with an IntDef Bug: 220153505 Test: atest NetworkStatsCollectionTest Change-Id: Iab32b8fc129b77d6786c2f1f2339e515f2eb55f7
* [MS54.1] Move NetworkStats to updatable sourcesJunyu Lai2022-02-181-7/+7
| | | | | | | | | | | | | | | | This CL builds NetworkStats related code with the connectivity module instead of platform. This includes: 1. Add netstats.proto to the module. 2. Add lib dependencies for all callers. 3. Include several source files in platform and add jarjar rule to it. Modify callers accordingly. Test: TH Bug: 197717846 Change-Id: I244693aebe1782d9e67502638ff8145c51462e1e Merged-In: I244693aebe1782d9e67502638ff8145c51462e1e
* [DU09-0]Adding the NetworkStatsCollection BuilderFrank2022-01-251-1/+71
| | | | | | | | | The purpose is provide NetworkStatsCollection.Builder as public API for adding the stats {@link NetworkStatsHistory} Bug: 215862801 Test: atest NetworkStatsCollectionTest Change-Id: I65ad589473cbb7785cbe8297f793ce9f18a55c35
* [MS58] Expose Apis which will be used by data migration utilityJunyu Lai2022-01-241-10/+17
| | | | | | | | | | | | | This includes: 1. NetworkIdentity 2. NetworkIdentitySet 3. NetworkStatsHistory NetworkStatsCollection Apis will be exposed in a separate CL. Test: TH Bug: 204830222 Change-Id: I47b2d3ac3b86cb4e6879afaae34326ca3c050ffa
* [MS57.1] Prepare APIs for data migration utilityJunyu Lai2022-01-201-7/+64
| | | | | | | | | | | | | | This includes: 1. Move PREFIX_* constants to NetworkStatsManager to expose in later changes. 2. Rename networkId to wifiNetworkKey. 3. Rename subType to ratType. 4. Replace SUBTYPE_COMBINED with NETWORK_TYPE_ALL 5. Fix lint errors when exposing system api. Test: TH Bug: 204830222 Change-Id: I2b7c34958bc59c3225c96f12abba008b83101585
* Revert "Pivot network statistics to use DataInput/Output."Junyu Lai2022-01-151-10/+4
| | | | | | | | | | This reverts commit daa23607be92b5effab9587ff2b28f610b225057. Reason for revert: FastDataInput/Output is hidden and cannot be used in mainline module. Test: TH Bug: 204830222 Change-Id: I8cfa435bb6233818adb9cc99dadeeb06a03443d5
* [MS19.1] Fix several hidden API dependenciesJunyu Lai2021-12-281-18/+15
| | | | | | | | | | | | | | | | This includes: 1. Use android.util.IndentingPrintWriter instead of the deprecated internal one. 2. Replace usages of IntArray with CollectionUtils and ArrayList. 3. Replace usages of ArrayUtils with CollectionUtils. 4. Refactor MathUtils.constrain functions into NetworkStatsUtils. 5. Replace Maps.newHashMap and Lists.newArrayList with public class constructors. 6. Replace Slog with Log. Test: FrameworksNetTests NetworkStaticLibTests Bug: 204830222 Change-Id: If009194ad5668a6d48dd341ea6d325028ce56d42
* [MS10.1] Move multiplySafeByRational to NetworkStatsUtilsJunyu Lai2021-12-201-1/+1
| | | | | | | | | | | | Since NetworkStats related code will be moved to the module. multiplySafeByRational in the NetworkUtilsInternal cannot be accessed after that. Thus, create another utils class that will be moved with NetworkStats code and put the function into it. Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.NetworkStatsUtilsTest Bug: 204830222 Change-Id: I96f3ac02e57b7325ed53988285770f478dee529e
* [MS07.1] Move NetworkStatsCollection/IdentitySet into frameworksJunyu Lai2021-12-101-0/+829
These files are needed for the data migration util system Api interfaces to allow OEMs to construct NetworkStats* objects. Thus, they need to be moved into android.net package, and some of them will be exposed as @SystemApi in T. Eventually these classes will be moved into the Connectivity module, but in the mean time they will be temporarily moved to f/b/package/ConnectivityT for the preparation stage. However, the tests are already in the module. Therefore for the S-derived branch, the test cannot see the renamed classes since any framework CLs will not be auto-merged into this branch. Thus, the tests need to stay disabled on the S-derived branch, and will be re-enabled after all files are moved into the module. Test: TH Bug: 197717846 Change-Id: I95278a99cf2437ada28001161ceea17a1d32f2a4