Commit Graph

4429 Commits

Author SHA1 Message Date
Lorenzo Colitti
8b7896b51a Merge "Rename setUidForeground to noteUidForeground" 2022-03-15 23:33:26 +00:00
Lorenzo Colitti
9f6e6c4e27 Merge "Add a NetworkAgent API to indicate that a network will be replaced." 2022-03-15 04:44:16 +00:00
Lorenzo Colitti
ffa2ed3d1c Add a NetworkAgent API to indicate that a network will be replaced.
This is useful for link layers that disconnect but know they will
reconnect to a similar network soon, and do not want the device
to switch to another network until the reconnect happens. An
example is wifi switching to another network that is on a
different subnet without the device switching to cellular data.

This works by immediately destroying the network, so the link
layer can reuse the same interface name for the new network. It
would be possible to delay destroying the network until the new
network connects, but in practice this does not seem useful,
because the if the link layer reuses the interface, then the
interface will be undergoing reconfiguration, and will likely
not be usable for app traffic.

This CL also moves the call to onNetworkDestroyed into
destroyNativeNetwork. This is needed to ensure that the new
API calls onNetworkDestroyed even though most teardown
operations have not happened. This causes onNetworkDestroyed to
happen before the netId is marked free, but that shouldn't cause
any behavioural changes because netId allocation is an
implementation detail of ConnectivityService and is not
observable by apps or system components.

Bug: 216567577
Test: builds, boots
Test: atest FrameworksNetTests FrameworksNetIntegrationTests
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest
Test: atest CtsNetTestCases:android.net.cts.NetworkAgentTest#testDestroyAndAwaitReplacement
Change-Id: I9f9e022fef66b31a29cce560413321075e992756
2022-03-14 21:52:37 +09:00
Lucas Lin
ba61dca57c Merge "Rename redactNetworkCapabilitiesForPackage and update its javadoc" 2022-03-14 08:05:08 +00:00
Aaron Huang
23f5e54efa Merge "Add test coverage for NetworkStats.Bucket#getRoaming()" 2022-03-10 12:14:10 +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
Remi NGUYEN VAN
2aae895972 Merge "Add DisableConfigSyncTargetPreparer to CTS/MTS" 2022-03-10 09:34:00 +00:00
Ross Yeh
422c7dd460 Merge "cts: Re-launch the desired activity after screen-on on TVs." 2022-03-10 01:13:37 +00:00
Patrick Rohr
6758a5dfff Merge "Add test for EthernetNetworkUpdateRequest" 2022-03-09 09:16:29 +00:00
Aaron Huang
fdbe9847a9 Add test coverage for NetworkStats.Bucket#getRoaming()
Bug: 217771804
Test: CtsNetTestCases
Change-Id: I16778488540476c2d1e77378a020c548eb894f0a
Merged-In: I16778488540476c2d1e77378a020c548eb894f0a
2022-03-09 08:42:40 +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
Mark Chien
e06458378d Merge "Remove dead code in BpfNetMaps." 2022-03-07 15:19:25 +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
Sudheer Shanka
d4e250d36d Dump connectivity trafficcontroller data to diagnose test failures. am: b52c67d5d7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2008051

Change-Id: Ia507825e0b2eb00f6ee2c97184f225f09370d202
2022-03-04 19:58:52 +00:00
Sudheer Shanka
b52c67d5d7 Dump connectivity trafficcontroller data to diagnose test failures.
Bug: 218308105
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: Ifafe7c96122cf4197dd2f12569b6bd9788cfa66c
2022-03-03 22:06:52 +00: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
Chiachang Wang
0cd08c3af8 Merge "Rename getVpnRequiresValidation to isVpnValidationRequired" am: 978370cb9c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1991612

Change-Id: I2f07e4ce91ea0c8cf94353d9ce52b40d0d0c7675
2022-03-03 00:41:11 +00:00
Chiachang Wang
978370cb9c Merge "Rename getVpnRequiresValidation to isVpnValidationRequired" 2022-03-03 00:10:54 +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 Li
8039c85336 Merge "[SUBID01-1]Grow NetworkIdentity to include a new mSubId field" 2022-03-02 12:26:11 +00:00
Jean Chalard
fb73190bd6 Merge "Remove unused libraries" am: e4848734a9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2005450

Change-Id: I831ada348828d28c4abcd961932bdbb7c0c4ec07
2022-03-02 08:21:36 +00:00
Jean Chalard
e4848734a9 Merge "Remove unused libraries" 2022-03-02 07:48:51 +00:00
Paul Hu
e435b5b513 Merge "Rename framework-connectivity-tiramisu to framework-connectivity-t" am: c871c08d8d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1976727

Change-Id: I1d69a7e13408a2d3bf61250b6568ea522b27880c
2022-03-02 07:27:24 +00:00
Paul Hu
c871c08d8d Merge "Rename framework-connectivity-tiramisu to framework-connectivity-t" 2022-03-02 07:11:25 +00:00
Chalard Jean
1f3e110ae6 Remove unused libraries
Test: m, TH
Change-Id: I59c0f8ecc94837635758c7667ea6413a5e6a7e81
2022-03-02 14:32:38 +09:00
lucaslin
d2b0613814 Rename redactNetworkCapabilitiesForPackage and update its javadoc
The API won't modify the passed NetworkCapabilities and
LinkProperties, but redactNetworkCapabilitiesForPackage and
redactLinkPropertiesForPackage sound like they will. To reduce
the confusion, rename the API with prefix "getRedacted".
Also modify the javadoc to describe more about what the API will
do if the given UID doesn't have location permission.

Bug: 220367512
Test: atest CtsNetTestCases
Change-Id: I964f1062da1ae96df9b369b911486da1379b8a19
2022-03-02 10:56:57 +08:00
Chiachang Wang
7ec6ae74c8 Rename getVpnRequiresValidation to isVpnValidationRequired
Update API name from getVpnRequiresValidation to
isVpnValidationRequired according to API review feedback.

Test: atest FrameworksNetTests
Bug: 220129160
Change-Id: I1025f4c35b320c14e872eaffd7ed82658a5f3d0c
2022-03-02 01:02:45 +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
Patrick Rohr
d66af86b10 Merge changes I3b7913c5,I9c1d6294 am: 4bd0f6bb2a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2002172

Change-Id: Id3a649c64d309f527b216e0404cadaace6ff8cc8
2022-03-01 07:59:41 +00:00
Patrick Rohr
4bd0f6bb2a Merge changes I3b7913c5,I9c1d6294
* changes:
  Improve error reporting in RateLimitTest
  Add null checks to RateLimitTest#tearDown improves error reporting
2022-03-01 07:36:09 +00:00
paulhu
537f72061a Rename framework-connectivity-tiramisu to framework-connectivity-t
Bug: 215434166
Test: build, flash, device boot to home.
Merged-In: I9ebedf8813cbfa30d979bc35a3b2306715be682b
Change-Id: I9ebedf8813cbfa30d979bc35a3b2306715be682b
2022-03-01 09:44:21 +08:00
Sudheer Shanka
41eed1ede2 Merge "Add some debugs to diagnose test failure." am: 87db609348
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1997537

Change-Id: I684168370c0f382af9ac93521cf134c6f5d93d47
2022-03-01 01:28:59 +00:00
Sudheer Shanka
87db609348 Merge "Add some debugs to diagnose test failure." 2022-03-01 01:05:01 +00:00
Patrick Rohr
3409b2ef6f Improve error reporting in RateLimitTest
This change moves the logic to read /proc/config.gz from the static
initializer to a function that runs the first time setUp is called. This
improves error reporting as exceptions thrown inside
ensureKernelConfigLoaded get reported as test failures.

Test: atest RateLimitTest
Change-Id: I3b7913c567507dec8ecad26602cfccdad3d6f4bd
2022-02-28 14:59:03 +01:00