Commit Graph

571 Commits

Author SHA1 Message Date
Lorenzo Colitti
004cbbcdad Merge "Support ignoring validation failures after roam." 2022-03-18 03:15:49 +00:00
he_won.hwang
881307a834 Support ignoring validation failures after roam.
In some scenarios, Wi-Fi connectivity is disrupted after roam. If an application reacts to network errors by calling reportNetworkConnectivity(false), validation will immediately fail and the device will switch to cell data.

Add a way to ignore these validation failures for up to 10 seconds after Wi-Fi roams.

Bug: 216567577
Test: new unit tests

Change-Id: I58de486533bcc7c6e32b23536ae15bccb779e394
2022-03-18 10:30:28 +09:00
Patrick Rohr
1b13af010a Merge changes from topic "nullable-ipconfig"
* changes:
  Add test for nullable IpConfiguration
  Add Nullable IpConfiguration to ethernet update request
  Replace assertParcelSane with assertParcelingIsLossless
2022-03-17 06:17:02 +00:00
Patrick Rohr
fb82c3f702 Add test for nullable IpConfiguration
Test: atest EthernetNetworkUpdateRequestTest
Change-Id: Ibf565d46cfac0d44976ee6187db7234bb082da41
2022-03-16 20:29:10 +01:00
Chalard Jean
de665266cd Rename setAccessUids to setAllowedUids
Bug: 217725769
Test: ConnectivityServiceTest CtsNetTestCases
Change-Id: Ic8a3f91553d1462b7f54259c467fb90a950bdd59
Merged-In: I8860fbb353eedf5d01e9dc248e4d765046bd562c
2022-03-16 17:58:20 +00:00
Sooraj Sasindran
2ccbfe9d8f Merge "Use int array for included and excluded uids" 2022-03-16 17:56:08 +00:00
Patrick Rohr
ceae88da2d Replace assertParcelSane with assertParcelingIsLossless
Per review comment on aosp/2012897.

Test: atest EthernetNetworkUpdateRequestTest
Change-Id: Ie2f21d821709cc82af9294d70826f153506fda4f
2022-03-16 17:20:36 +01:00
Patrick Rohr
6dde8ac532 Merge changes from topic "ethernet_mainline"
* changes:
  Fix the NPE thrown when starting Ethernet service in OS lower than T.
  Remove the stub ethernet service from Connectivity module.
  Update hidden API files for EthernetManager API move.
  Provide a stub ethernet service to build in sc-mainline-prod.
  Build ethernet framework source into framework-connectivity-tiramisu
2022-03-16 16:03:30 +00:00
Sooraj Sasindran
4904176454 Use int array for included and excluded uids
Use int array for included and excluded uids so that uses
same data type as in PreferentialNetworkServiceConfig

Bug: 217365439
Test: ran connectivity service unit tests
Change-Id: I9ac7e6498df2fd20b8397b2c110296e019c7389e
2022-03-16 07:19:11 +00:00
Lorenzo Colitti
8b7896b51a Merge "Rename setUidForeground to noteUidForeground" 2022-03-15 23:33:26 +00:00
Xiao Ma
0a171c006c Build ethernet framework source into framework-connectivity-tiramisu
- move ethernet APIs, build it into framework-connectivity-tiramisu
- start ethernet service from ConnectivityServiceInitializer
- fix EthernetManager dependnecy in Tethering module
- fix EthernetNetworkSpecifier dependency in framework-connectivity
- fix the ethernet related config resource

Bug: 210586283
Test: m
Test: atest FrameworksNetTests EthernetServiceTests
Change-Id: I54857b8517649048a343c72797668394d5225766
Merged-In: I54857b8517649048a343c72797668394d5225766
2022-03-14 14:06:35 +00:00
Aaron Huang
5417280f17 Rename setUidForeground to noteUidForeground
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
2022-03-10 18:33:50 +08:00
Patrick Rohr
6758a5dfff Merge "Add test for EthernetNetworkUpdateRequest" 2022-03-09 09:16:29 +00:00
Mark Chien
cc29690fc1 Merge "Split updateMeteredNetwork{Allow, Deny}List into add and remove" 2022-03-09 05:00:58 +00:00
markchien
e46042b833 Split updateMeteredNetwork{Allow, Deny}List into add and remove
Split the updateXXX methods into an addXXX and removeXXX instead of using
a boolean parameter to indicate whether the uid should be added or removed

Bug: 218494748
Test: atest FrameworksNetTests
Change-Id: I868cf35c8f51b25d8719e618c6c48a5cd642da7f
2022-03-09 11:17:27 +08:00
Patrick Rohr
30d33f4ee3 Add test for EthernetNetworkUpdateRequest
Test: atest EthernetNetworkUpdateRequest
Change-Id: I2aeacca81f07cf2d73814d20fc9e63e9f1a65843
2022-03-08 16:29:43 +01:00
Xin Li
e6953d54a5 Merge "Merge Android 12L" 2022-03-08 06:55:42 +00:00
Treehugger Robot
5635d505e0 Merge "Remove ConnectivityManager swapActiveStatsMap API" 2022-03-08 06:31:23 +00:00
Maciej Żenczykowski
984c39992c Merge changes Id5f5bdfc,I67b9f30b
* changes:
  [CLATJ#32] ClatCoordinator: untag clat raw socket
  [CLATJ#31] ClatCoordinator: tag raw socket to uid AID_CLAT
2022-03-08 00:47:17 +00:00
Treehugger Robot
23037308c6 Merge "Don't attempt to enable rate-limiting before T." am: 33f4e14073
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2010337

Change-Id: If26026f57421c51eb34f38c82229fd524b734299
2022-03-07 16:17:40 +00:00
Treehugger Robot
33f4e14073 Merge "Don't attempt to enable rate-limiting before T." 2022-03-07 15:51:32 +00:00
Mark Chien
1e048b4432 Merge "Remove dead code in BpfNetMaps." am: e06458378d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2008696

Change-Id: I1d44c652972e43f6598fcb231bdc538e3836a046
2022-03-07 15:44:27 +00:00
Lorenzo Colitti
f79dcecf9b Don't attempt to enable rate-limiting before T.
Rate-limiting cannot work because the BPF program is in the
mainline version of netd.c, which is placed into net_shared
and thus cannot run pre-T.

Disable it entirely to ensure no impact on S.

Test: atest ConnectivityCoverageTests:com.android.server.ConnectivityServiceTest on AOSP
Test: atest ConnectivityCoverageTests:com.android.server.ConnectivityServiceTest on S
Change-Id: I47521a100f8287ecdece25e810db8f3cade46778
2022-03-07 12:21:40 +00:00
Lorenzo Colitti
82244fd16c Remove dead code in BpfNetMaps.
Most of the methods in BpfNetMaps are only used on T+ devices,
where BpfNetMaps never calls into netd. Remove the code in these
methods that calls into netd, because that code can never run.
The code was only written in the first place because it was
necessary when TrafficController had not yet moved to mainline.

The list of methods is:
- addNaughtyApp
- removeNaughtyApp
- addNiceApp
- removeNiceApp
- setChildChain
- replaceUidChain
- setUidRule

Test: treehugger
Change-Id: Ie7d210be2f7983178f5aa550370b9476de66e988
2022-03-07 12:56:18 +08:00
markchien
49e944cc1c Remove ConnectivityManager swapActiveStatsMap API
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
2022-03-07 12:25:47 +08:00
Hungming Chen
1c257cdb8d [CLATJ#32] ClatCoordinator: untag clat raw socket
Untag clat raw socket while stopping clatd.

Bug: 218407445
Test: atest FrameworksNetTests
Test: connect and disconnect to/from IPv6 only network
Check dumpsys tag map and logging for tagging/untagging socket
03-04 16:29:17.247  1330  1714 I jniClatCoordinator: tag uid AID_CLAT to socket fd 420, cookie 16524
03-04 16:29:31.343  1330  1714 I jniClatCoordinator: untag socket cookie 16524

Change-Id: Id5f5bdfc97a15abfa1a49b06dcb3c2c25743c74f
2022-03-07 11:38:40 +08:00
Hungming Chen
89d12060e1 [CLATJ#31] ClatCoordinator: tag raw socket to uid AID_CLAT
Tag socket as uid AID_CLAT to avoid duplicated data usage counting by
bpf program.

Test: atest FrameworksNetTests
Test: check dumpsys for tag mapping and check logging for socket cookie

$ adb shell dumpsys connectivity trafficcontroller
  mCookieTagMap:
    cookie=28831 tag=0x0 uid=1029

03-02 22:43:13.201  1719  1921 I jniClatCoordinator: tag uid AID_CLAT to socket fd 609, cookie 28831
03-02 22:43:13.217  5496  5496 I clatd   : tunnel.write_fd6 609, cookie 28831, flags 0x0 (debug only)

Bug: 218407445
Change-Id: I67b9f30b143e791ddf59d5627e068ec3107e3328
2022-03-07 11:37:41 +08:00
Frank Li
51b0fdc3b9 Merge "[MS68.4] Address comments at aosp/1958144" am: 481c0cd100
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1973859

Change-Id: Ic7f55abed077e1dbbc2fd11489bc8b701d9a58ad
2022-03-03 02:54:44 +00:00
Frank Li
481c0cd100 Merge "[MS68.4] Address comments at aosp/1958144" 2022-03-03 02:26:53 +00:00
Patrick Rohr
2d3a6696ba Do not enable ingress rate limit until clsact qdisc exists am: f1fe8ee928
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2003978

Change-Id: I81ef8189ca04738b16a584e079e73ffa92e31a9f
2022-03-02 20:15:09 +00:00
Patrick Rohr
f1fe8ee928 Do not enable ingress rate limit until clsact qdisc exists
The tc police filter attaches to the clsact qdisc, so the rate limit
cannot be enabled before the qdisc is added to the interface.
The clsact qdisc is added as part of INetd#networkAddInterface, which is
called from inside updateLinkProperties.

Test: atest FrameworksNetTests:ConnectivityServiceTest
Change-Id: I0713605ff3684f8271eb3f0e29ab7116561963f1
2022-03-02 20:41:13 +01:00
Frank Li
77e18cd8ad Merge "[SUBID01-1]Grow NetworkIdentity to include a new mSubId field" am: 8039c85336
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1895196

Change-Id: I708e1b7db095cbe7c505ea81af64e712bebc6a33
2022-03-02 12:55:30 +00:00
Frank
eeeb76d3bb [MS68.4] Address comments at aosp/1958144
Test: atest TrafficStatsTest NetworkUsageStatsTest FrameworksNetTests
Bug: 204830222
Ignore-AOSP-First: merge conflict

(cherry-picked from ag/16811186)

Change-Id: I2578e13e2844591adac1d1902f2454ec7079ceea
Merged-In: I2578e13e2844591adac1d1902f2454ec7079ceea
2022-03-02 03:09:09 +08:00
lifr
8ba46d804f [SUBID01-1]Grow NetworkIdentity to include a new mSubId field
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
2022-03-01 16:43:28 +08:00
Treehugger Robot
f046baa63a Merge "Make sure the right NetworkMonitor start method is called on S-/T+" am: 894912c85e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1995390

Change-Id: I9f8c6d3c9e61ab08a0a858b6af0899940ff57091
2022-02-25 02:58:39 +00:00
Treehugger Robot
894912c85e Merge "Make sure the right NetworkMonitor start method is called on S-/T+" 2022-02-25 02:23:09 +00:00
Jean Chalard
dfe53cdcef Merge "Fix : recent Connectivity module with old NetworkStack module" am: b30e957777
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1991623

Change-Id: I94804c1ed4a0facb8e806b29afded7a0ec2a3f80
2022-02-22 19:59:17 +00:00
Jean Chalard
b30e957777 Merge "Fix : recent Connectivity module with old NetworkStack module" 2022-02-22 19:32:54 +00:00
Chalard Jean
cd8210843f Make sure the right NetworkMonitor start method is called on S-/T+
Test: ConnectivityServiceTest
Change-Id: I6a7f0143082236e30d2e3878147df2c921ff5539
2022-02-23 04:31:26 +09:00
Treehugger Robot
f105588f91 Merge changes Ib1cd342a,Iab23d414 am: 1c5ce5542a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1991622

Change-Id: I3aab26bc9351e7dd065071b11d58ef9be7224a92
2022-02-22 09:35:16 +00:00
Lorenzo Colitti
dfabefac82 Merge "Mock more resources for VPNs." am: 16040b1833
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1993950

Change-Id: I759556591492205a783a7207322fde1b9a3e857d
2022-02-22 09:34:59 +00:00
Treehugger Robot
1c5ce5542a Merge changes Ib1cd342a,Iab23d414
* changes:
  Add an IS_DESTROYED flag to FullScore.
  Use MessageUtils instead of hardcoded strings in policyNameOf.
2022-02-22 09:26:38 +00:00
Lorenzo Colitti
16040b1833 Merge "Mock more resources for VPNs." 2022-02-22 09:10:42 +00:00
Lorenzo Colitti
8c7a8860f9 Add an IS_DESTROYED flag to FullScore.
This is being added as the lowest priority score factor, just
above the tie-breakers. It ensures that a network that has been
destroyed will lose to another identical network that has not
been destroyed, but will otherwise be scored identically.

The flag is a CS-managed flag that is stored in NetworkAgentInfo.
Currently it is always false, but it will be populated in
future CLs.

Bug: 216567577
Test: atest FrameworksNetTests
Change-Id: Ib1cd342ab7dfc4df45715da19b743d711fe8d605
2022-02-22 16:39:44 +09:00
Lorenzo Colitti
8627c0eeda Merge "Mock resources used directly by LockdownVpnTracker." am: 2606d9c862
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1991628

Change-Id: I2f4adda347ed2a8b6a0d108f5a71e3b6c38aaf4a
2022-02-22 02:29:39 +00:00
Lorenzo Colitti
2606d9c862 Merge "Mock resources used directly by LockdownVpnTracker." 2022-02-22 01:59:20 +00:00
Lorenzo Colitti
93a72d22a5 Mock more resources for VPNs.
These also cause ConnectivityCoverageTests to fail when built
from master and run on S. They are used in Vpn.java, not
LockdownVpnTracker.

They were not addressed in the previous CL because running this
test locally is difficult.

Test: forrest
Change-Id: I7d687338fd6bc7468b1abcae58898322554e647b
2022-02-22 10:17:09 +09:00
Lorenzo Colitti
19e6171926 Mock resources used directly by LockdownVpnTracker.
LockdownVpnTracker directly uses resources from
com.android.internal.R. This is acceptable because it's platform
code. But ConnectivityServiceTest uses the LockdownVpnTracker
built from the module source tree, and when that code fetches
resources on a previous Android release, it crashes because the
resource IDs don't exist; non-public resource IDs aren't stable.

Fix this by mocking the resources used by LockdownVpnTracker.

Test: atest ConnectivityCoverageTests
Change-Id: I239a18a38d4f1082f76f5ff1b831c15ee753bdfd
2022-02-22 10:13:24 +09:00
Maciej Żenczykowski
44a4bb6d45 Merge "Skip NetworkStatsServiceTest before T" am: fc67ee8c71
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1990891

Change-Id: I50f114e07afb4ea84d5ca4c4623f79940f5d8703
2022-02-19 20:42:21 +00:00
Maciej Żenczykowski
e6fd9ce504 Merge "Add tests for deleteKernelTagData" am: 8bf31e8061
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1972803

Change-Id: I63927a2cf20ba448ff316ffd01bc409ff8b6a28b
2022-02-19 20:42:17 +00:00