summaryrefslogtreecommitdiff
path: root/service-t/src/com/android/server/net
Commit message (Collapse)AuthorAgeFilesLines
* Merge "Disable comparison in user release builds" into tm-devRemi NGUYEN VAN2022-06-211-3/+1
|\
| * Disable comparison in user release buildsJunyu Lai2022-06-211-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "Increase fallbacks counter when comparison result is different" into ↵Junyu Lai2022-06-211-0/+2
|\ \ | | | | | | | | | tm-dev
| * | Increase fallbacks counter when comparison result is differentJunyu Lai2022-06-211-0/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | In current code, the fallbacks counter does not increase when comparison result is different. This will not impact how we print log.wtf but will impact the dry run process for debugging in next every later boots. Ignore-AOSP-First: Parent CLs are not in aosp yet Test: 1. NetworkStatsServiceTest 2. manual test with script Bug: 233752318 Change-Id: Ib152cec2ee0f21d59ccfe4669b31f26b3db71a97
* / Add wipeOnError flag to NetworkStatsRecorderAaron Huang2022-06-172-14/+29
|/ | | | | | | | | | | | | | | 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
* Disable fallback when comparison result is differentJunyu Lai2022-06-151-59/+117
| | | | | | | | | | | | | | | | | | | | 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
* Hold wifi and mobile interfaces since boot in NetworkStatsServiceAaron Huang2022-06-031-15/+56
| | | | | | | | | | | | | | | 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
* Merge changes from topic "increment-crash" into tm-devJunyu Lai2022-06-011-2/+2
|\ | | | | | | | | | | * changes: Fix get summary does not include the latest bucket Add unit test for MultipathPolicyTracker
| * Fix get summary does not include the latest bucketJunyu Lai2022-06-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Use fallback method if the importer throwsJunyu Lai2022-05-261-11/+24
|/ | | | | | | | | | This prevent users from seeing empty data usage if the importer throws. Ignore-AOSP-First: in a topic with internal-only changes Test: Manual Bug: 233825704 Change-Id: Iab27e8eb6f2ed406f932507100aaf74abb997c83
* Merge "Fix crash when decrementing data usage request" into tm-devTreeHugger Robot2022-05-241-1/+1
|\
| * Fix crash when decrementing data usage requestJunyu Lai2022-05-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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-30/+15
| | | | | | | | | | | | | | Ignore-AOSP-First: in a topic with internal-only changes Test: TH Bug: 230289468 Change-Id: Id91fabb47b542d8526d6aa787b5947238c3934fb
* | Run comparison code if the data migration finished with fallbackJunyu Lai2022-05-231-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the data migration process runs finished with fallback, that means we might get some unknown data that cannot be handled by importing code. If that happens, the CL runs the problematic code whenever device boot-up but doesn't do the actual import process. This improves the debuggability since the current log disappears after device reboot, which will show up in every boot-up log after this CL. Ignore-AOSP-First: in a topic with internal-only changes Test: manual Bug: 230289468 Change-Id: I6d117032d47f21c7cb49bbab916668058060f2f8
* | Persisting status int on the device if fallback happenedJunyu Lai2022-05-231-13/+32
|/ | | | | | | | | | 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-193-54/+564
|\ | | | | | | | | | | | | | | | | * 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.
| * Ensure NetworkStats migrated snapshot is identicalRemi NGUYEN VAN2022-05-181-12/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-182-49/+306
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+108
| | | | | | | | | | | | | | | | | | | | 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
* | move netd maps and progs into /sys/fs/bpf/netd_shared/...Maciej Żenczykowski2022-05-192-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (out of current /sys/fs/bpf/net_shared/...) This will allow genfscon regexp changes in a followup selinux commit. Note that this has a hard dependency on system/bpf change 'bpfloader: add support for netd_shared and net_private subdirs' which also bumps bpfloader to v0.13. This was merged May 12, 2022 (into both aosp/master and tm-dev) and it is in Android T starting with Beta 3 release. This isn't really an issue since amusingly T Beta 2 is already incompatible with current mainline releases due to the snap reverting a previous required bpfloader system/bpf change: move net_shared bpf programs into net_shared subdirectory See: http://b/232050459#comment14 So this doesn't break T Beta1/2, since they already don't work, and Beta3 will work. Bug: 218408035 Test: TreeHugger Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: Id5f14d6e3f11cfe35d9d8a9496548a2bc4d022ec (cherry picked from commit 6d116d0f38196625d205e8c76a17b01b61fff246) Merged-In: Id5f14d6e3f11cfe35d9d8a9496548a2bc4d022ec
* | Merge "Limit data usage request per uid" into tm-devJunyu Lai2022-05-171-1/+11
|\ \ | |/ |/|
| * Limit data usage request per uidJunyu Lai2022-05-131-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | [MS81] Support remove history before cutoff timestampJunyu Lai2022-05-161-0/+67
|/ | | | | | | | | | | 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
* Merge changes from topic ↵TreeHugger Robot2022-05-131-30/+92
|\ | | | | | | | | | | | | | | "cherrypicker-L63700000954424743:N16900001262878041" into tm-dev * changes: Exclude PID for rate-limited Improve count of openSession callers in dumpsys
| * Exclude PID for rate-limitedAaron Huang2022-05-131-26/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rate-limited would include PID in current design, which means that an app can ignore the rate-limits by creating a process (a new PID) every time. Thus, maintain mOpenSessionCallsPerUid for rate-limits and OpenSessionKey for debugging. Also, there's no rate-limit for SYSTEM_UID so if the uid is SYSTEM_UID, the mLastStatsSessionPoll should not be updated. Otherwise, it may cause an app to be rate-limited to do a query after a system user polled. Test: adb shell dumpsys netstats and check the output Bug: 228081549 Change-Id: I69cc1f3990c9960347691256ed4cb500f9bb48b2 (cherry picked from commit 8d5907fc13bd6238a2eaa56c1d80488c42a2d564) Merged-In: I69cc1f3990c9960347691256ed4cb500f9bb48b2
| * Improve count of openSession callers in dumpsysAaron Huang2022-05-131-31/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, it's only uid=count in dumpsys, however, the call may also come from system but there is no such information in dumpsys. If the call came from system, it's hard to know who is the caller. So, this patch makes pid, uid and package as a key to record the count of the caller. The output will look like, Top openSession callers: {pid=1787,uid=1000,package=android}=26 {pid=2931,uid=1000,package=com.android.settings}=4 Test: adb shell dumpsys netstats and check the output Bug: 228081549 Change-Id: Id2dfdd4480aa5b1ece51e46de6efe30a46629811 (cherry picked from commit b87b5e5d0a4f08f58d85ff11d39a64e2c4e4646b) Merged-In: Id2dfdd4480aa5b1ece51e46de6efe30a46629811
* | Limit usage requests dump countJunyu Lai2022-05-101-1/+3
| | | | | | | | | | | | | | | | Test: manual Bug: 229103088 Change-Id: Id913b34a3b48b10c66eb399b28ee8702e300f568 (cherry picked from commit b889d4705a8bb2fadb1c5f313f3d023c7af34a1a) Merged-In: Id913b34a3b48b10c66eb399b28ee8702e300f568
* | Improve logging for NetworkStatsObserversJunyu Lai2022-05-102-23/+50
|/ | | | | | | | | | | | | | | | | | | 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
* adjust for new T bpfloader net_shared locationMaciej Żenczykowski2022-04-232-7/+6
| | | | | | | | | | (this is safe because on pre-T none of these maps and programs are mainlined and thus safe to access from mainline code anyway) Test: TreeHugger, manual Bug: 218408035 Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I23e565d665247f33e084978890a1ee8ffe0fe568
* Merge EthernetServiceTests into FrameworksNetTestsRemi NGUYEN VAN2022-04-011-114/+0
| | | | | | | | | | | | | | | | | As per the TODO, merge EthernetServiceTests into the larger FrameworksNetTests suite. Similarly to NetworkStats, NSD or IpSec tests, the tests are also marked as "non-connectivity-module-test", where "module" actually refers to modules being built for release (from an S-based branch) today. This is necessary as the tests and associated code cannot build without T APIs. Also add FrameworksNetTests to presubmit as non-connectivity-module tests are not run in presubmit without this. Test: TH Merged-In: Id533cdb4ac184b963f570af299dea04754ba88e9 Change-Id: I9950fcb49fdc2217134a59e993941cbe5da0b556
* Merge "Fix proto invalid write type"Aaron Huang2022-03-222-10/+10
|\
| * Fix proto invalid write typeAaron Huang2022-03-072-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Merge "[DU04-2]Appropriate changes to the NetworkPolicyManager API"Frank Li2022-03-161-3/+10
|\ \
| * | [DU04-2]Appropriate changes to the NetworkPolicyManager APIFrank2022-03-161-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Divide the NetworkPolicyManager API notifyStatsProviderWarningOrLimitReached into the following two APIs: 1. notifyStatsProviderWarningReached() 2. notifyStatsProviderLimitReached() Bug: 216474563 Test: atest NetworkStatsServiceTest NetworkPolicyManagerTest NetworkPolicyManagerServiceTest OffloadControllerTest Change-Id: Ic413eb532b5e24d4a7e2afabdcf643ab6607b1ed
* | | Merge "Rename setUidForeground to noteUidForeground"Lorenzo Colitti2022-03-151-1/+1
|\ \ \ | |/ / |/| |
| * | Rename setUidForeground to noteUidForegroundAaron Huang2022-03-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch addresses API review about the naming of NetworkStatsManager#setUidForeground and it would be more appropriate to rename it to noteUidForeground. Bug: 222291301 Test: atest FrameworksNetTests Change-Id: I952762872850889609c9808aa6e3cdfc04317806
* | | Fix log message when failing to open bpf mapsPatrick Rohr2022-03-081-5/+5
|/ / | | | | | | | | | | | | s/create/open/ Test: TH Change-Id: I7fd1b280ab15aaa0757cfb3afcc20bf377a3bcef
* | Remove ConnectivityManager swapActiveStatsMap APImarkchien2022-03-071-12/+14
| | | | | | | | | | | | | | | | | | | | | | | | 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: I25618020c078c7de3f0036c48d06d7816a431f62
* | Merge "[MS68.3] Address comments at aosp/1958144"Frank Li2022-03-032-8/+14
|\ \
| * | [MS68.3] Address comments at aosp/1958144Frank2022-03-022-8/+14
| |/ | | | | | | | | | | | | | | | | | | Test: atest TrafficStatsTest NetworkUsageStatsTest FrameworksNetTests Bug: 204830222 (cherry-picked from ag/16813003) Change-Id: I5a54b44294021d64d8506eeb570db0db8544472a Merged-In: I5a54b44294021d64d8506eeb570db0db8544472a
* | Merge "[SUBID01-0]Grow NetworkIdentity to include a new mSubId field"Frank Li2022-03-021-4/+9
|\ \
| * | [SUBID01-0]Grow NetworkIdentity to include a new mSubId fieldlifr2022-03-021-4/+9
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 NetworkStatsDataMigrationUtilsTest (cherry-picked from ag/16825721) Change-Id: Ie1fe81006555dbcca4b62457fa6c319f04b4576d Merged-In: Ie1fe81006555dbcca4b62457fa6c319f04b4576d
* / [DU03-4]Add NETWORK_STACK Permission check for NetworkStatsService APIFrank2022-03-021-1/+1
|/ | | | | | | | | | | | | 1. getUidStatsForTransport API Bug: 210066922 Test: atest BatteryStatsImplTest WifiPowerCalculatorTest MobileRadioPowerCalculatorTest NetworkStatsServiceTest (cherry-picked from ag/16816095) Change-Id: I022c34b5af87fe3ff6857ea264bac2f7098eaed4 Merged-In: I022c34b5af87fe3ff6857ea264bac2f7098eaed4
* Merge changes from topic "ms52-movenetstats"Lorenzo Colitti2022-02-284-10/+29
|\ | | | | | | | | | | | | | | | | * changes: Expose MATCH_PROXY as a module-lib API. Add setPollForce to module API Move networkstats JNI to connectivity module [MS54.1] Move NetworkStats to updatable sources [MS62.1] Start NetworkStatsService from the module
| * Move networkstats JNI to connectivity moduleRemi NGUYEN VAN2022-02-182-0/+8
| | | | | | | | | | | | | | | | | | | | Reorganize networkstats JNI so it can be included in the connectivity module. Bug: 197717846 Test: m Change-Id: I815ea379f3d9915041c80ac5e743ce62e05f4cf8 Merged-In: I815ea379f3d9915041c80ac5e743ce62e05f4cf8
| * [MS54.1] Move NetworkStats to updatable sourcesJunyu Lai2022-02-183-10/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Fix system_server crash while iterating CookieTagMapmarkchien2022-02-181-1/+7
|/ | | | | | | | | | | | | | | When uid is removed, NetworkStatsService will iterate CookieTagMap and delete the corresponded uid socketTag value. But not only NetworkStatsService would detete CookieTagMap entries. There are other threads may also delete CookieTagMap entries such as #unTagSocket in bpfHandler and desctroy socket listener in TrafficController. System server crash as NPE because the CookieTagMap entry it iterate just be removed by other threads at the same time. This is just a simple fix to prevent the crash. Will have follow up CL for formal fix. Bug: 220084230 Test: m Change-Id: I08cad87f537fb09499faf1ff5cfd443fcb8ce436
* Merge "Replace qtaguid_deleteTagData with java implementation"Patrick Rohr2022-02-161-15/+117
|\
| * Replace qtaguid_deleteTagData with java implementationmarkchien2022-02-111-15/+117
| | | | | | | | | | | | | | Copies the behavior of TrafficController::deleteTagData. Test: atest NetworkStatsServiceTest Change-Id: I436ce514108486db712b455f1b5fd8dca345c65c
* | Correct typo in the year of copyrightChiachang Wang2022-02-091-1/+1
|/ | | | | Test: m Change-Id: I68e9925b5b6deb7c5c9d57aa4a397c80f8b8d869