Commit Graph

43918 Commits

Author SHA1 Message Date
Lorenzo Colitti
cebdfba1bb Merge changes from topic "ms52-movenetstats"
* changes:
  Update API files to unhide MATCH_PROXY.
  Update tests for NetworkStats code move.
  Add setPollForce to module API
  Add JNI stats libraries to apex Android.bp
  Add JNI stats libraries to connectivity
  [MS62.2] Add NetworkStatsService into service initializer
  [MS54.8] Add hiddenapi-unsupported-t.txt to apex Android.bp
  [MS54.3] Move NetworkStats to updatable sources
2022-02-28 05:32:23 +00:00
Lorenzo Colitti
9e066c9faf Update API files to unhide MATCH_PROXY.
Bug: 204830222
Test: m
Ignore-AOSP-First: part of topic with internal-only code
  (cherry-picked from ag/16786006)
Change-Id: I9e11eea30ea9c988498e005c33f173ba2d0a32ec
Merged-In: I9e11eea30ea9c988498e005c33f173ba2d0a32ec
2022-02-28 04:17:19 +00:00
Lorenzo Colitti
3d52172838 Update tests for NetworkStats code move.
NetworkStatsFactory is moving from services.core to
service-connectivity-tiramisu. Update FrameworksNetSmokeTests and
FrameworksNetIntegrationTests to depend on the latter instead of the
former.

Test: atest FrameworksNetSmokeTests FrameworksNetIntegrationTests
Ignore-AOSP-First: part of large internal topic to avoid merge conflicts
  (cherry-picked from ag/16786005)
Change-Id: Ie48dac421decf83440b7c88adea18152e05f03bb
Merged-In: Ie48dac421decf83440b7c88adea18152e05f03bb
2022-02-28 04:17:13 +00:00
Remi NGUYEN VAN
73a61e7c28 Add setPollForce to module API
The API was test API in S, but this is not supported in module API
surfaces. Make it module API instead.

Ignore-AOSP-First: Avoiding merge conflicts. Cherry-pick will follow
Bug: 197717846
Test: Tests already using this API
  (cherry-picked from ag/16780903)
Change-Id: I53959f0ad4c7a41950e9349d539be82b9166b707
Merged-In: I53959f0ad4c7a41950e9349d539be82b9166b707
2022-02-28 04:17:06 +00:00
junyulai
6187e7c79a Add JNI stats libraries to apex Android.bp
This is separated from ag/16766427 to avoid merge
conflict at downstream branches. For some downstream branches,
the library does not exist and this part is commented out.

Bug: 197717846
Test: atest FrameworksNetTests
Merged-In: Idb6da7ce678fbb3f4839604726cbdbdf223144c1
Merged-In: Iae44344701a3267110e5cbf271120201134d59e5
Change-Id: I9d7f6cea1cdb3c8117e677d8c204e3985295ada0
2022-02-28 04:16:58 +00:00
Remi NGUYEN VAN
d95048929c Add JNI stats libraries to connectivity
Add new symbols to libservice-connectivity loaded on T only, and the
framework libraries to apex and tests.

Bug: 197717846
Test: atest FrameworksNetTests
  (cherry-picked and splitting apex Android.bp to aosp/1994130)
Change-Id: Iae44344701a3267110e5cbf271120201134d59e5
Merged-In: Iae44344701a3267110e5cbf271120201134d59e5
2022-02-28 04:16:17 +00:00
Junyu Lai
e764686003 [MS62.2] Add NetworkStatsService into service initializer
NetworkStatsService is going to be moved into Connectivity mainlne
module and it will be not visible to SystemServiceResistry after
migration done. Thus, register service in
NetworkStatsServiceInitialalizer and register manager in
ConnectivityFrameworkInitializerTiramisu instead.

Ignore-AOSP-First: Avoiding conflicts; cherry-pick will follow
Test: FrameworksNetTests
      CtsNetTestCases
Bug: 204830222
  (cherry-picked from ag/16727131)
Change-Id: I03d947cc54dd995f6b5b4544ee3bf03cf029d143
Merged-In: I03d947cc54dd995f6b5b4544ee3bf03cf029d143
2022-02-28 04:16:07 +00:00
junyulai
4eccfdec89 [MS54.8] Add hiddenapi-unsupported-t.txt to apex Android.bp
This is separated from ag/16657723 to avoid merge
conflict at downstream branches. For some downstream branches,
the library does not exist and this part is commented out.

Test: TH
Bug: 197717846
Merged-In: I4eeb7ea9cfc3139991caf0fc22474e0052a0391c
Merged-In: I33e0d699086c87ce8e940036c9a52908bbbcf6c5
Change-Id: I031e5687fa47594b50ca1b40570e01cdec356827
2022-02-28 04:15:51 +00:00
Junyu Lai
eb6f4bef96 [MS54.3] Move NetworkStats to updatable sources
This CL builds NetworkStats related codes with the
connectivity module instead of platform.

Test: TH
Bug: 197717846
Change-Id: I4eeb7ea9cfc3139991caf0fc22474e0052a0391c
Merged-In: I4eeb7ea9cfc3139991caf0fc22474e0052a0391c
2022-02-28 03:24:19 +00:00
Taras Antoshchuk
116bd6e1a2 Merge "Fix HostsideVpnTests flakyness" 2022-02-25 12:02:13 +00:00
Mark Chien
cc0dc24205 Merge "Notify linkproperties change in all scenarios" 2022-02-25 11:13:12 +00:00
Pavan Kumar M
68e96aba07 Notify linkproperties change in all scenarios
In scenarios where linkproperties event is received on default internet
callback, linkproperties are cached and network state is updated with
new link properties but Tethering class is notified about the change.
Later when event is received on mobile request or listen all cb, since
the network state is already updated with these linkproperties, change
in link properties will not be notified. This results in tethering
failures where the ip addresses of the tethering interface will not be
updated.

This change handles this issue by triggering the link properties change
in all scenarios.

Update the correponding test case as well.

Tests: Builds, Boots, TetheringTests
Bug: 216281561
Change-Id: I7452ed07d2665843c86141764b71aab0c00417fe
2022-02-25 12:29:10 +05:30
Treehugger Robot
894912c85e Merge "Make sure the right NetworkMonitor start method is called on S-/T+" 2022-02-25 02:23:09 +00:00
Maciej Żenczykowski
333c34c434 Merge "only account for ingress packets addressed to us" 2022-02-24 22:45:52 +00:00
Patrick Rohr
148aea8e69 only account for ingress packets addressed to us
Test: builds && boots
Change-Id: I06c537dc1488e7f36e474760ab49dc299347003d
2022-02-24 14:12:32 +01:00
Treehugger Robot
da5e11c95f Merge "Fix a flake where network caps change innocuously." 2022-02-24 11:53:04 +00:00
Patrick Rohr
a45195924e Merge "Fix rate limit API review comments" 2022-02-23 18:39:23 +00:00
Patrick Rohr
3dd5cc1631 Merge "Add proper kernel support assumption to RateLimitTest" 2022-02-22 20:43:22 +00:00
Chalard Jean
c46c3b55da Fix a flake where network caps change innocuously.
Caps are changing before the code is checking for no callback,
but the network is not validating ; something like RSSI or
link speed has been updated, which is fine as long as the
network doesn't validate.

Test: ConnectivityManagerTest
Change-Id: Ie9a167d3599b0157cc1cf6e93c36e9689e9cc2e0
2022-02-23 04:52:04 +09: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
Patrick Rohr
2140575fce Add proper kernel support assumption to RateLimitTest
As it turns out, /proc/config.gz can be accessed via shell command from
within a CTS test. This adds a proper kernel support check for the
RateLimitTest.

Bug: 220801455
Test: atest RateLimitTest
Change-Id: I4d3a6848c1c05c313cb74b235294cee982eecf57
2022-02-22 15:55:30 +01:00
Treehugger Robot
7a195e16c6 Merge "Run CTS EthernetNetworkSpecifier in 12" 2022-02-22 12:47:12 +00:00
Treehugger Robot
d6a5303cd8 Merge changes Ie68356a4,I2b63c24b
* changes:
  Attempt to deflake NetworkAgentTest#testRejectedUpdates.
  Fix a couple of JavaDoc errors in NetworkAgentInfo.
2022-02-22 10:41:37 +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
e3ef5a8024 Attempt to deflake NetworkAgentTest#testRejectedUpdates.
This test is highly flaky in presubmit with error messages that
look like:

java.lang.AssertionError: Did not receive callback after 200ms

The test itself looks correct, so it's possible that 200ms just
isn't enough time for the callbacks to be delivered. Set the
timeout to DEFAULT_TIMEOUT_MS like most of the other
TestableNetworkCallbacks in this class.

Fix: 218389790
Test: test-only change
Change-Id: Ie68356a48e9618e5fea3865aa06bfbfc457b89c4
2022-02-22 18:04:31 +09:00
Treehugger Robot
fa017ea2e4 Merge "Remove redundant "using" statement" 2022-02-22 08:23:24 +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
38bbdbd1aa Fix a couple of JavaDoc errors in NetworkAgentInfo.
These don't break compilation because NetworkAgentInfo doesn't
expose any APIs and thus doesn't generate javadoc, but they
are flagged by the IDE.

Test: treehugger
Change-Id: I2b63c24b2afbc98950f53c38f80d27474aab0622
2022-02-22 16:39:44 +09:00
Yi Kong
38c4cd90db Remove redundant "using" statement
Test: presubmit
Bug: 219872355
Change-Id: Ie4fc87e5231e31799644c26943bbc13000091e92
2022-02-22 13:37:51 +08:00
markchien
95cb089853 Fix EthernetTetheringTest testTestNetworkUpstream flaky
The test assume the first tethering upstream would be test network. But
if there are mutiple networks available, this is a wrong assumption
because of race condtion. If tethering choose upstream while wifi or
celluar is available but test network may not available for tethering yet
(it depend on the NetworkCallback from ConnenectivityService), the first
upstream may not be the test network.

Bug: 215224286

Test: atest EthernetTetheringTest
Change-Id: Idfa972008643f1fb5119179383b06e2c8f65c667
2022-02-22 12:42:15 +08: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
Patrick Rohr
c6cf669b8d Merge "CTS for ingress rate limiting" 2022-02-21 19:57:37 +00:00
Patrick Rohr
96c1ff4ae9 CTS for ingress rate limiting
This test creates a TUN interface and registers it with
ConnectivityService. For 15 seconds, it continuously writes data to that
interface and measures at what rate it is received.

Data accounting is currently not covered by this test.

Test: atest RateLimitTest
Bug: 172053704
Change-Id: I74f891f3b7113855375c48a10cefbfe47221931b
2022-02-21 18:05:21 +01:00
Lorenzo Colitti
85c1765b01 Remove out-of-date comment.
Test: m
Change-Id: I1575c85c382b4fb9e9e3c04b5e70dab55cef4c60
2022-02-21 12:50:11 +09:00
Lorenzo Colitti
b81abf3abe Merge "Run bpf_existence_test in presubmit." 2022-02-21 03:45:33 +00:00
Treehugger Robot
4b654c9038 Merge "Rename one of the two EVENT_NETWORK_TESTED messages." 2022-02-21 00:22:11 +00:00
Treehugger Robot
19ce06b05f Merge "reduce log level when no interface is present for rate limiting" 2022-02-19 21:31:05 +00:00
Maciej Żenczykowski
fc67ee8c71 Merge "Skip NetworkStatsServiceTest before T" 2022-02-19 20:20:24 +00:00
Maciej Żenczykowski
8bf31e8061 Merge "Add tests for deleteKernelTagData" 2022-02-19 20:20:24 +00:00
Chalard Jean
a14b3f2184 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
2022-02-19 20:43:14 +09:00
Lorenzo Colitti
c6d3f3cf25 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
2022-02-19 19:45:43 +09:00
Lorenzo Colitti
0261ced634 Rename one of the two EVENT_NETWORK_TESTED messages.
Currently, there are two EVENT_NETWORK_TESTED message types in
ConnectivityService. One is used by the ConnectivityService
handler to process validation results, and one is used by
ConnectivityDiagnosticsHandler to send connectivity reports.

The two messages have different contents so it is confusing that
they have the same integer and the same name. Rename the second
one to CMD_SEND_CONNECTIVITY_REPORT.

Test: atest ConnectivityServiceTest
Test: atest CtsNetTestCases:android.net.cts.ConnectivityDiagnosticsManagerTest
Change-Id: I77d63dad477315e1fcc7225a5ef03aff2bed8c35
2022-02-19 02:24:02 +09:00
Lorenzo Colitti
dbb9280abc Merge "Don't check validation state in waitForAvailable(..., Network)." 2022-02-18 17:04:27 +00:00
Taras Antoshchuk
d42d1645cb Merge "Fix HostsideVpnTest#testExcludedRoutes" 2022-02-18 13:25:21 +00:00
Patrick Rohr
ca7e578f7e Fix rate limit API review comments
Follow up to aosp/1955583 to fix some review comments.

Test: builds
Bug: 219739904
Change-Id: Ie85dc72eb3bb6eda26b655a64eae0d7c0d8bf143
2022-02-18 09:47:49 +00:00
Lorenzo Colitti
98c83d0148 Run bpf_existence_test in presubmit.
This has been green for a while. On S:

https://android-build.googleplex.com/builds/tests/view?invocationId=I42200010019333308&testResultId=TR79227903031586436

On R:
https://android-build.googleplex.com/builds/tests/view?invocationId=I28900010019347533&testResultId=TR73127903058200457

Test: treehugger
Change-Id: Iece7be238e069c7a71f150893a0f6cc155e7b09b
2022-02-18 17:35:04 +09:00