Commit graph android_packages_modules_Co.../tests/unit/java/com/android
Message SHA1
Merge "Split updateMeteredNetwork{Allow, Deny}List into add and remove"
Mark Chien   authored and   Gerrit Code Review   commited 2022-03-09 05:00:58 +00:00
cc29690fc1
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

markchien   commited 2022-03-09 11:17:27 +08:00
e46042b833
Merge "Merge Android 12L"
Xin Li   authored and   Gerrit Code Review   commited 2022-03-08 06:55:42 +00:00
e6953d54a5
Merge "Remove ConnectivityManager swapActiveStatsMap API"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-03-08 06:31:23 +00:00
5635d505e0
Merge changes Id5f5bdfc,I67b9f30b
* changes:
  [CLATJ#32] ClatCoordinator: untag clat raw socket
  [CLATJ#31] ClatCoordinator: tag raw socket to uid AID_CLAT

Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-03-08 00:47:17 +00:00
984c39992c
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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2022-03-07 16:17:40 +00:00
23037308c6
Merge "Don't attempt to enable rate-limiting before T."
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-03-07 15:51:32 +00:00
33f4e14073
Merge "Remove dead code in BpfNetMaps." am: e06458378d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2008696

Change-Id: I1d44c652972e43f6598fcb231bdc538e3836a046

Mark Chien   authored and   Automerger Merge Worker   commited 2022-03-07 15:44:27 +00:00
1e048b4432
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

Lorenzo Colitti   commited 2022-03-07 12:21:40 +00:00
f79dcecf9b
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

Lorenzo Colitti   authored and   markchien   commited 2022-03-07 12:56:18 +08:00
82244fd16c
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

markchien   commited 2022-03-07 12:25:47 +08:00
49e944cc1c
[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

Hungming Chen   commited 2022-03-07 11:38:40 +08:00
1c257cdb8d
[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

Hungming Chen   commited 2022-03-07 11:37:41 +08:00
89d12060e1
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

Frank Li   authored and   Automerger Merge Worker   commited 2022-03-03 02:54:44 +00:00
51b0fdc3b9
Merge "[MS68.4] Address comments at aosp/1958144"
Frank Li   authored and   Gerrit Code Review   commited 2022-03-03 02:26:53 +00:00
481c0cd100
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

Patrick Rohr   authored and   Automerger Merge Worker   commited 2022-03-02 20:15:09 +00:00
2d3a6696ba
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

Patrick Rohr   commited 2022-03-02 20:41:13 +01:00
f1fe8ee928
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

Frank Li   authored and   Automerger Merge Worker   commited 2022-03-02 12:55:30 +00:00
77e18cd8ad
[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

Frank   commited 2022-03-02 03:09:09 +08:00
eeeb76d3bb
[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

lifr   authored and   Frank   commited 2022-03-01 16:43:28 +08:00
8ba46d804f
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

Treehugger Robot   authored and   Automerger Merge Worker   commited 2022-02-25 02:58:39 +00:00
f046baa63a
Merge "Make sure the right NetworkMonitor start method is called on S-/T+"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-02-25 02:23:09 +00:00
894912c85e
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

Jean Chalard   authored and   Automerger Merge Worker   commited 2022-02-22 19:59:17 +00:00
dfe53cdcef
Merge "Fix : recent Connectivity module with old NetworkStack module"
Jean Chalard   authored and   Gerrit Code Review   commited 2022-02-22 19:32:54 +00:00
b30e957777
Make sure the right NetworkMonitor start method is called on S-/T+
Test: ConnectivityServiceTest
Change-Id: I6a7f0143082236e30d2e3878147df2c921ff5539

Chalard Jean   commited 2022-02-23 04:31:26 +09:00
cd8210843f
Merge changes Ib1cd342a,Iab23d414 am: 1c5ce5542a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1991622

Change-Id: I3aab26bc9351e7dd065071b11d58ef9be7224a92

Treehugger Robot   authored and   Automerger Merge Worker   commited 2022-02-22 09:35:16 +00:00
f105588f91
Merge "Mock more resources for VPNs." am: 16040b1833
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1993950

Change-Id: I759556591492205a783a7207322fde1b9a3e857d

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2022-02-22 09:34:59 +00:00
dfabefac82
Merge changes Ib1cd342a,Iab23d414
* changes:
  Add an IS_DESTROYED flag to FullScore.
  Use MessageUtils instead of hardcoded strings in policyNameOf.

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-02-22 09:26:38 +00:00
1c5ce5542a
Merge "Mock more resources for VPNs."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2022-02-22 09:10:42 +00:00
16040b1833
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

Lorenzo Colitti   commited 2022-02-22 16:39:44 +09:00
8c7a8860f9
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

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2022-02-22 02:29:39 +00:00
8627c0eeda
Merge "Mock resources used directly by LockdownVpnTracker."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2022-02-22 01:59:20 +00:00
2606d9c862
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

Lorenzo Colitti   commited 2022-02-22 10:17:09 +09:00
93a72d22a5
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

Lorenzo Colitti   commited 2022-02-22 10:13:24 +09:00
19e6171926
Merge "Skip NetworkStatsServiceTest before T" am: fc67ee8c71
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1990891

Change-Id: I50f114e07afb4ea84d5ca4c4623f79940f5d8703

Maciej Żenczykowski   authored and   Automerger Merge Worker   commited 2022-02-19 20:42:21 +00:00
44a4bb6d45
Merge "Add tests for deleteKernelTagData" am: 8bf31e8061
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1972803

Change-Id: I63927a2cf20ba448ff316ffd01bc409ff8b6a28b

Maciej Żenczykowski   authored and   Automerger Merge Worker   commited 2022-02-19 20:42:17 +00:00
e6fd9ce504
Merge "Skip NetworkStatsServiceTest before T"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-02-19 20:20:24 +00:00
fc67ee8c71
Fix : recent Connectivity module with old NetworkStack module
This patch adjusts the behavior of the NetworkMonitor mock
to behave the same way as the real one – accept either
notifyNetworkConnected or notifyNetworkConnectedParcel as
a signal a network is connected. This is necessary because
the Connectivity module will call either of these depending
on versions of other software it finds on the device.

Test: ConnectivityServiceTest
      NetworkMonitorTest
Change-Id: I5900a019b3b033f4365d8a82b1e522336012064e

Chalard Jean   commited 2022-02-19 20:43:14 +09:00
a14b3f2184
Use MessageUtils instead of hardcoded strings in policyNameOf.
This makes the code easier to maintain because we do not need to
manually add string representations, and because it will throw at
static initialization time if the clas contains duplicate
POLICY_xxx values. The memory overhead is likely negligible.

Bug: 216567577
Test: new coverage in FullScoreTest
Change-Id: Iab23d414c8e28ff7f26060ad44fa996f277d361f

Lorenzo Colitti   commited 2022-02-19 19:45:43 +09:00
c6d3f3cf25
Skip NetworkStatsServiceTest before T
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

Patrick Rohr   commited 2022-02-18 09:18:20 +01:00
e3b067f523
Merge "Fix NetworkStatsServiceTest after adding deleteKernelTagData" am: 3226bfb631
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1968682

Change-Id: I26bc260ae6727e4e7d1a6053851681e0cee48631

Patrick Rohr   authored and   Automerger Merge Worker   commited 2022-02-16 20:35:23 +00:00
a0f346958f
Add tests for deleteKernelTagData
Test: atest NetworkStatsServiceTest
Change-Id: I6db6b79314868271f877acf2a0b21699cbf02df5

Patrick Rohr   authored and   markchien   commited 2022-02-16 14:23:30 +08:00
f9888898e3
Fix NetworkStatsServiceTest after adding deleteKernelTagData
Test: atest NetworkStatsServiceTest
Change-Id: I667a5d86e0df8505fef549e598f3b4141637fb90

Patrick Rohr   authored and   markchien   commited 2022-02-16 14:01:29 +08:00
7c52b69b3e
Merge sc-v2-dev-plus-aosp-without-vendor@8084891
Bug: 214455710
Merged-In: I5894450f3089b2ea105722a18ddf8f1eed1c28a0
Change-Id: If2045705da821c90705f7dd1e6944c0bb92e3289

Xin Li   commited 2022-02-11 06:57:49 +00:00
a459e6a12d
Merge "Add Low Power Standby test to NetworkManagementServiceTest"
Robert Horvath   authored and   Gerrit Code Review   commited 2022-02-10 11:17:44 +00:00
3a33495992
Merge changes from topic "bandwidth-limiting"
* changes:
  Add bandwidth limiting to CS
  Add setting that controls network rate limit

Patrick Rohr   authored and   Gerrit Code Review   commited 2022-02-09 18:00:04 +00:00
6b5b7b40d8
Add bandwidth limiting to CS
Adds ingress rate limiting functionality to ConnectivityService. The tc
rate limit is installed before we tell netd about the interface, and
removed after the network is removed from netd. When the setting
changes, the old rate limit needs to be removed before a new one can be
added (unfortunately, we cannot use NLM_F_REPLACE when configuring the
tc-police filter).

Currently, this functionality is always enabled, but may or may not work
based on kernel support.

Bug: 157552970
Test: atest FrameworksNetTests:ConnectivityServiceTest
Change-Id: I4e64b2c40490f061e42b40a1b1b3a6618c3d1a87

Patrick Rohr   commited 2022-02-09 14:46:26 +01:00
2857ac4dd0
Pass the NetworkAgentConfig to NetworkMonitor.
When the network is a VPN, NetworkMonitor needs to know whether
the VPN requests validation, and that information is stored in
NetworkAgentConfig. Pass it.

Test: FrameworksNetTests
Change-Id: I3616f0796b69ce054d92213aafdef43ba7041596

Chalard Jean   commited 2022-02-09 15:19:38 +09:00
d490072cd6
Add and implement API for VpnManagers to request validation
This adds a new API that lets VPN apps using VpnManager request
that the platform run its basic validation check on the resulting
network.

Bug: 184750836
Test: atest FrameworksNetTests
Change-Id: I00092eee857d3e33529b19461cfd5dd060a0fe20

Chiachang Wang   authored and   Chalard Jean   commited 2022-02-08 22:47:26 +09:00
865511a8c4
Merge "Use RECEIVER_NOT_EXPORTED in CarrierPrivilegeAuthenticator."
Jean Chalard   authored and   Gerrit Code Review   commited 2022-02-04 16:40:30 +00:00
d262e71965