summaryrefslogtreecommitdiff
path: root/tests/unit/java/com/android/server/net
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Disable comparison in user release builds" into tm-devRemi NGUYEN VAN2022-06-211-5/+20
|\
| * Disable comparison in user release buildsJunyu Lai2022-06-211-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL disable the comparison mechanism introduced in previous beta releases to stop receiving log.wtf signals from beta users. This CL only affects logging on user release builds. Ignore-AOSP-First: Parent CLs are not in aosp yet Test: 1. NetworkStatsServiceTest 2. manual test with script Bug: 233752318 Change-Id: I7047106b1019c29460d6633b148f501ffa62f139
* | Add wipeOnError flag to NetworkStatsRecorderAaron Huang2022-06-171-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If reading data happens exception while doing data migration, the file will be deleted by legacy recorders. This would cause legacy persistent data being lost and cannot be retrieved by any method. To avoid the files being deleted, add a wipeOnError flag to recorder which indicates this recorder will wipe on error or not . If the flag is set to true then deletes all files when it throws, otherwise keeps all files. Ignore-AOSP-First: urgent fix and will cherry-pick immediately after. Bug: 233828210 Test: FrameworksNetTests:NetworkStatsRecorderTest Change-Id: Id7a3d8bebf8a00d814f9e84bf4c10d927e6ff749
* | Merge "Revert "Temporarily disable testUidStatsForTransport"" into tm-devTreeHugger Robot2022-06-161-1/+1
|\ \ | |/ |/|
| * Revert "Temporarily disable testUidStatsForTransport"Remi NGUYEN VAN2022-06-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | This reverts commit 87a9bc7edba09fe74241cdf20232d05fd27a6b31. Reason for revert: Prebuilts are updated and tests should pass now Change-Id: I6dd793e124a2781b9d74d28b7da7ac9f15f41d89 Merged-In: Ib1d180cc799dde94ada642ce752623b4b65f1e31 Merged-In: I44dda14cae265e600010c6f8efe1471ac481c6ea Merged-In: I702a75e91be0bb582f9cbd7b4a23e1286f8252cf
* | Disable fallback when comparison result is differentJunyu Lai2022-06-151-0/+111
|/ | | | | | | | | | | | | | | | | | | | Follow-up from ag/18452103, where we add fallback code that runs with the importer to make sure they are identical. When the result is different, we'll take the result from fallback code to minimize the rollout risk. However, since the OEMs might change the importer implementation. The fallback code would no longer valid and that makes OEM modified code not working. Hence the fallback code must be disabled before release. This change keeps comparison enabled for all cases to keep getting signals from beta users. And will switch it to read overlay value for OEM to debug their solution. Ignore-AOSP-First: Parent CLs are not in aosp yet Test: 1. NetworkStatsServiceTest 2. Test all datasets with script Bug: 233752318 Change-Id: I869ff05297149bde6e13a204bd8c5a4fece75de0
* Temporarily disable testUidStatsForTransportRemi NGUYEN VAN2022-06-031-1/+1
| | | | | | | | | | | | The test cannot pass in branches that use an old prebuilt tethering module. Bug: 234099453 Test: atest NetworkStatsServiceTest Merged-In: Ib1d180cc799dde94ada642ce752623b4b65f1e31 Merged-In: I44dda14cae265e600010c6f8efe1471ac481c6ea Merged-In: I702a75e91be0bb582f9cbd7b4a23e1286f8252cf Change-Id: I7ce44dac1b5d730f84f882ba8ae1b741a633e765
* Hold wifi and mobile interfaces since boot in NetworkStatsServiceAaron Huang2022-06-031-0/+3
| | | | | | | | | | | | | | | In current design, the interface will be removed from the list if the network disconnected which will cause getUidStatsForTransport() returns unexpected snapshot to caller since the list is empty. This change also remove interface name from all entries before the method returns the result. Ignore-AOSP-First: non-AOSP CL is included in the same topic Bug: 231514741 Test: FrameworksNetTests manual test Change-Id: Ie60829a65d0d9b5b63ad353695a820c0586e3665
* Fix get summary does not include the latest bucketJunyu Lai2022-06-011-0/+37
| | | | | | | | | | | | | | | | | | | | | In internalGetSummaryForNetwork, the history object will not include the latest bucket because of the logic in NetworkStatsHistory#recordHistory would only include buckets that atomically occur in the inclusive time range. This makes querySummaryForDevice callers who are also sensitive to the latest bucket fails. This CL revert the behavior back to S, in T this is temporarily changed after aosp/1937268. Also, for test purpose, this CL change System.currentTimeMillis to use mClock when querying. Ignore-AOSP-First: Urgent fix Test: NetworkStatsServiceTest#testGetLatestSummary Bug: 233733267 Change-Id: I55e2a5d953622b68da36a9b8d3e57c88d57543b0
* Merge "Fix crash when decrementing data usage request" into tm-devTreeHugger Robot2022-05-241-1/+5
|\
| * Fix crash when decrementing data usage requestJunyu Lai2022-05-241-1/+5
| | | | | | | | | | | | | | | | | | | | | | When unregistering, if the caller process is dead. The system can unregsiter for the caller. But the request decrement should be counted onto the caller uid instead of system uid. Ignore-AOSP-First: Urgent fix Test: NetworkStatsObserversTest#testUnregister_knownRequest_invalidUid_doesNotUnregister Bug: 233580307 Change-Id: I85aee8f395739929bc7086883ace81ac1ecd0730
* | Address comment at ag/18491259 and ag/18486388Junyu Lai2022-05-251-15/+16
| | | | | | | | | | | | | | Ignore-AOSP-First: in a topic with internal-only changes Test: TH Bug: 230289468 Change-Id: Id91fabb47b542d8526d6aa787b5947238c3934fb
* | Persisting status int on the device if fallback happenedJunyu Lai2022-05-231-1/+8
|/ | | | | | | | | | This CL also stop from incresing "successes" counter if the importer finishes with fallback. Ignore-AOSP-First: in a topic with internal-only changes Test: manual Bug: 230289468 Change-Id: I88fce1b2d0dea3772a8b31df8f8fa93bf13bffad
* Merge changes from topic "stats-migration" into tm-devJunyu Lai2022-05-192-16/+304
|\ | | | | | | | | | | | | | | | | * changes: Skip PersistentIntTest on S- device Don't clobber existing history entries. Ensure NetworkStats migrated snapshot is identical [MS82.1] Support network stats data migration process Add a PersistentInt class.
| * Skip PersistentIntTest on S- deviceJunyu Lai2022-05-191-1/+7
| | | | | | | | | | | | | | | | | | | | | | This class is only used in the service runs on T+ devices. Thus run this test on S- device does not make senses. Ignore-AOSP-First: in a topic with internal-only changes Bug: 230289468 Test: atest ConnectivityCoverageTests:PersistentIntTest on S device Change-Id: I97a29df17ef9ee9ab373655f045cdb5c820e06ef
| * Ensure NetworkStats migrated snapshot is identicalRemi NGUYEN VAN2022-05-181-32/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Read migration snapshot both from the platform API and the legacy method, and Log.wtf if they are different. Use the legacy method data if they are. This ensures that using the migration API is a no-op, and that errors are reported (through Log.wtf) if it would not have been if used as-is. Ignore-AOSP-First: in a topic with internal-only changes Test: NetworkStatsServiceTest Bug: 230289468 Change-Id: I857ad18183d63d1aa16e89f89eb24009648720a2
| * [MS82.1] Support network stats data migration processJunyu Lai2022-05-181-9/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This includes: 1. Provide NetworkStatsRecorder#importCollectionLocked to allow caller to write a NetworkStatsCollection object to a standalone file. 2. Do not clear the collection in NetworkStatsRecorder# CombiningRewriter, this is safe since pending set will still be cleared during forcePersistLocked. 3. Implement the migration process, including recovery and safety measures. Test: NetworkStatsServiceTest NetworkStatsCollectionTest Test: manual test with adb shell device_config put tethering \ netstats_store_files_in_apexdata true adb shell device_config put tethering \ netstats_import_legacy_target_attempts 1 Ignore-AOSP-First: in a topic with internal-only changes Bug: 230289468 Change-Id: Ic2002cbfd5a6b3c2226fa8dab22481f8ce656574
| * Add a PersistentInt class.Lorenzo Colitti2022-05-181-0/+127
| | | | | | | | | | | | | | | | | | | | This implements a simple integer written to disk backed by AtomicFile. Bug: 230289468 Test: new unit test Ignore-AOSP-First: in a topic with internal-only changes Change-Id: I1c73c8ac2429f92153cfba3b006b4374e75e65df
* | Limit data usage request per uidJunyu Lai2022-05-131-0/+47
|/ | | | | | | | | | | | | Currently, there is no limtation for an app to request data usage callback, which is dangerous if the app fire hundreds of thousands requests and potientially this might cause OOM if the apps don't free them. Test: atest NetworkStatsObserversTest#testRegister_limit Bug: 229103088 Change-Id: I8299f46fd47a82ec9b25ba2e0d3c95db5512c331 (cherry picked from commit f3c946278c83ab07ec18b5eb258a54865fc0993f) Merged-In: I8299f46fd47a82ec9b25ba2e0d3c95db5512c331
* Improve logging for NetworkStatsObserversJunyu Lai2022-05-101-14/+23
| | | | | | | | | | | | | | | | | | | In order to have better logging to gather information about the callers. This change includes: 1. Add pid and package name into RequestInfo for better logging. 2. Print current observers in dumpsys section. 3. Enable register/unregister usage request logging by default. The log added in the dumpsys section looks like: Stats Observers: RequestInfo from pid/uid:2001/1000(android) for DataUsageRequest [...] accessLevel:3 ... Test: NetworkStatsObserversTest Bug: 229103088 Change-Id: Ide68776dc279610e8dee0efd924b59a1fac2b7b6 (cherry picked from commit c259e615e68aacc3bc47b729de03449b5798a1b4) Merged-In: Ide68776dc279610e8dee0efd924b59a1fac2b7b6
* Use Sources.bp for buildingRemi NGUYEN VAN2022-03-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Reference Sources.bp from Android.bp, so that they are used as build files. Sources.bp is separate from Android.bp as it was migrated from the Android.bp files in the old code location. They can be merged into the main Android.bp file (or removed by removing the filegroups) after the migration is done. Also remove references to the AIDL filegroups, as files are now merged into the common framework/aidl-export directory which is used as include directory for aidl source generation already, so they do not need to be referenced separately. framework/aidl-export can contain AIDLs for S- API classes that became updatable API in T (the contents of framework-t), as they are the same as any other API class for the purposes of AIDL code generation: it's OK for any S+ code to reference S+ API classes. Finally, fix reference to mByteStream in IpConfigStoreTest. It was already wrong but did not break the build because the test was not being built in the old location. Bug: 222234190 Test: TH Merged-In: I1fe5091361c7766dc7b6b4fb8c7b62d403e950bb Change-Id: If738f607be84b3d7e2045a83a4d2976ed0d4e188
* Merge history of ConnectivityTRemi NGUYEN VAN2022-03-241-0/+159
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Renamed files/directories: ConnectivityT/service/Android.bp --> service-t/Sources.bp ConnectivityT/framework-t/Android.bp --> framework-t/Sources.bp ConnectivityT/framework-t/aidl-export --> framework/aidl-export ConnectivityT/service --> service-t ConnectivityT/framework-t --> framework-t ConnectivityT/tests --> tests ConnectivityT/OWNERS --> (removed) BUG: 222234190 TEST: TH Merged-In: I1fe5091361c7766dc7b6b4fb8c7b62d403e950bb Change-Id: Ib592434ff50c06e25894f6ed7d7e3e8e1e3ea67b
| * Split out the ethernet API surface and use framework-connectivity-tXiao Ma2022-03-101-0/+159
| | | | | | | | | | | | | | | | | | | | | | | | | Ethernet framework and service source code is going to be moved to Connectivity mainline module, this CL contains below corresponding changes to adapt the migration in f/b side: 1. Split out ethernet module-lib APIs to Connectivity module. Add the ethernet resource filegroup to tiramisu-updatable-sources filegroup as well, build them together. Also update the module-lib and system api txt to reflect the APIs change. Remove the hidden APIs which are moved to Connectivity module. This removal fixes the api inconsistent issue with Tethering/apex/hidden/. 2. Remove EthernetService from SystemServer which will be registered from ConnectivityServiceInitializer. 3. Replace the BackgroundThread class(imported from f/b/core/java) with the one in the modules-utils-backgroundthread lib, which is visible to Connectivity module. Bug: 210586283 Test: m Test: atest FrameworksNetTests EthernetServiceTests Change-Id: I1956848d3248cc56e9841d221e5e4c160bed65a4
* Rename setUidForeground to noteUidForegroundAaron Huang2022-03-101-3/+3
| | | | | | | | | | | Addresses API review feedback. Both setUidForeground in NetworkStatsManager and NetworkStatsService are renamed to noteUidForeground. Thus, the caller in test should be also modified. Bug: 222291301 Test: atest FrameworksNetTests Change-Id: Ifa1e1af3d9fd8b1dc75a8f37947a5958f60ed415
* Remove ConnectivityManager swapActiveStatsMap APImarkchien2022-03-071-7/+0
| | | | | | | | | | | | swapActiveStatsMap is temporary added for the NetworkStatsFactory to call BpfNetMaps#swapActiveStatsMap in tethering mainline module. Now NetworkStatsFactory already be mainlined, calling BpfNetMaps#swapActiveStatsMap directly. Bug: 218494448 Test: atest ConnectivityCoverageTests atest FrameworksNetTests Change-Id: I3358e4ac5fb7ed0964273afdbccd1b4128ca7645
* Merge "[MS68.4] Address comments at aosp/1958144"Frank Li2022-03-031-16/+18
|\
| * [MS68.4] Address comments at aosp/1958144Frank2022-03-021-16/+18
| | | | | | | | | | | | | | | | | | | | | | Test: atest TrafficStatsTest NetworkUsageStatsTest FrameworksNetTests Bug: 204830222 Ignore-AOSP-First: merge conflict (cherry-picked from ag/16811186) Change-Id: I2578e13e2844591adac1d1902f2454ec7079ceea Merged-In: I2578e13e2844591adac1d1902f2454ec7079ceea
* | [SUBID01-1]Grow NetworkIdentity to include a new mSubId fieldlifr2022-03-011-1/+2
|/ | | | | | | | | | | | | | | | | | | In the previous design of NSS and NPMS, those only had IMSI to identify the cell network. Now the telephony has created the "subId" handle, which is the preferred mechanism for identifying subscribers. This commit adds NetworkStats support for subscriberId as a part of the network identity key Bug: 80526261 Test: atest NetworkTemplateTest NetworkStatsCollectionTest NetworkStatsServiceTest NetworkIdentityTest Ignore-AOSP-First: merge conflict resolutions (cherry-picked from ag/16826535) Change-Id: I8549b11d0fcfc5a9426724d6b90de27b707cb77c Merged-In: I8549b11d0fcfc5a9426724d6b90de27b707cb77c
* Merge "Skip NetworkStatsServiceTest before T"Maciej Żenczykowski2022-02-191-2/+3
|\
| * Skip NetworkStatsServiceTest before TPatrick Rohr2022-02-181-2/+3
| | | | | | | | | | | | | | | | NetworkStatsService was mainlined in T, so the test does not need to be run on previous Android versions. Test: atest CtsNetTestCases:NetworkStatsServiceTest Change-Id: I8e69746a03ef029b1121cc8fa71e299ac12c2905
* | Add tests for deleteKernelTagDataPatrick Rohr2022-02-161-5/+81
|/ | | | | Test: atest NetworkStatsServiceTest Change-Id: I6db6b79314868271f877acf2a0b21699cbf02df5
* Fix NetworkStatsServiceTest after adding deleteKernelTagDataPatrick Rohr2022-02-161-5/+21
| | | | | Test: atest NetworkStatsServiceTest Change-Id: I667a5d86e0df8505fef549e598f3b4141637fb90
* Merge "Fix kernelToTag import in NetworkStatsFactoryTest."Lorenzo Colitti2022-01-311-1/+1
|\
| * Fix kernelToTag import in NetworkStatsFactoryTest.Lorenzo Colitti2022-01-291-1/+1
| | | | | | | | | | | | | | | | NetworkManagementSocketTagger#kernelToTag is moving to NetworkStatsFactory. Fix the import path in the test. Test: atest FrameworksNetTest Change-Id: I8797d9e589e68b4980ff5b38ba09d091420d30fd
* | Adjust NetworkStatsServiceTest to mock out the JNI.Lorenzo Colitti2022-01-281-0/+8
|/ | | | | Test: atest NetworkStatsServiceTest Change-Id: Icdea9f871199f1e859aef647e5ba3dec7ac02d73
* Merge "Test UidCounterSetMap in NetworkStatsServiceTest"Mark Chien2022-01-271-0/+16
|\
| * Test UidCounterSetMap in NetworkStatsServiceTestmarkchien2022-01-271-0/+16
| | | | | | | | | | Test: atest FrameworksNetTests Change-Id: I1ae720fcc3192712b3dcbe69619f97f7df1a1f5e
* | Change NETWORK_TYPE_5G_NSA reference packageAaron Huang2022-01-261-2/+2
|/ | | | | | | | NETWORK_TYPE_5G_NSA is moved to NetworkStatsManager Bug: 210073043 Test: builds, FrameworksNetTests Change-Id: I9226119ee4f67688a1b4ffdab7e5a86ec0b8e974
* Merge "[MS68.2] Adapt NetworkPolicyManagerService to use registerUsageCallback"Junyu Lai2022-01-253-28/+47
|\
| * [MS68.2] Adapt NetworkPolicyManagerService to use registerUsageCallbackjunyulai2022-01-243-28/+47
| | | | | | | | | | | | | | | | This change also address comments at aosp/1958145. Test: atest FrameworksNetTests Bug: 204830222 Change-Id: I415d74df34caa91b1e1160478ebff30fbd1c7b6f
* | Merge "Replace INetd#trafficSwapActiveStatsMap with ConnectivityManager API"Mark Chien2022-01-251-4/+10
|\ \
| * | Replace INetd#trafficSwapActiveStatsMap with ConnectivityManager APImarkchien2022-01-211-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | This is the corresponding test change with INetd#trafficSwapActiveStatsMap usage replacement. Bug: 209935649 Test: atest NetworkStatsFactoryTest Change-Id: Ic5e29f6a928c4230322ed658fe8ddbd71d7ea56a
* | | Merge "[MS67.2] Modify tests for registerUsageCallback"Junyu Lai2022-01-253-79/+108
|\ \ \ | | |/ | |/|
| * | [MS67.2] Modify tests for registerUsageCallbackjunyulai2022-01-243-79/+108
| | | | | | | | | | | | | | | | | | Test: atest FrameworksNetTests Bug: 204830222 Change-Id: Ia4ff535cd703807516d65b582727684cbb670360
* | | Merge "Add unit test for BpfInterfaceMapUpdate"Maciej Żenczykowski2022-01-242-0/+125
|\ \ \ | |/ / |/| |
| * | Add unit test for BpfInterfaceMapUpdatemarkchien2022-01-212-0/+125
| |/ | | | | | | | | | | | | Bug: 215095957 Test: atest FrameworkNetTests Change-Id: I92d45e5a606f466ce42504629cb3f87fd9e25d22
* | wifi data usage: Update calling API nameLes Lee2022-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | Bug: 213387087 Test: atest -c NetworkTemplateTest Test: atest -c NetworkStatsServiceTest Test: atest -c FrameworksWifiApiTests Test: atest -c NetworkPolicyManagerServiceTest Change-Id: I6f65af5e2ff121a2fe5b2429d3eead01e434f8be Merged-In: I6f65af5e2ff121a2fe5b2429d3eead01e434f8be
* | Merge "[DU03-2]Remove INetworkStatsService from BatteryStatsImpl"Frank Li2022-01-211-67/+2
|\ \
| * | [DU03-2]Remove INetworkStatsService from BatteryStatsImplFrank2022-01-201-67/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Correct the NetworkStatsServiceTest BatteryStatsImpl is using INetworkStatsService APIs, which cannot be accessed after moving into the mainline module. So, replace and remove those hidden API usages. Bug: 210066922 Test: atest BatteryStatsImplTest WifiPowerCalculatorTest MobileRadioPowerCalculatorTest NetworkStatsServiceTest CTS-Coverage-Bug: 213437796 Change-Id: I47dc377a5cce7d8a0029dc808ad0f46e651764b1
* | | Merge "Update the SDK for the tests with intended target in T+"Chiachang Wang2022-01-211-2/+3
|\ \ \ | |_|/ |/| |