Commit Graph

3655 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
c6be26e0ef Ensure wifi reconnects before waiting for metered
testGetMultipathPreference assumes that wifi will auto-reconnect after
changing its metered status, but this is not necessarily the case if the
BSSID has been blocklisted after it failed validating too many times.

Call ensureWifiConnected to force wifi to reconnect before waiting for
it to become metered.

Bug: 190913510
Test: atest ConnectivityManagerTest
Change-Id: Iafe9837b97e4d654bb0f3962d48a94c1f31bbebc
2021-07-07 10:55:39 +09:00
Maciej Żenczykowski
2aabf4138e remove obsolete/no-op NativeQtaguidTest
qtaguid is long dead - test is thus a no-op

New test logs:
  Running Tests...

  x86 CtsNativeNetTestCases
  -------------------------
  CtsNativeNetTestCases (1 Test)
  [1/1] BpfTest#bpfStructSizeTest: PASSED (0ms)

  Summary
  -------
  x86 CtsNativeNetTestCases: Passed: 1, Failed: 0, Ignored: 0, Assumption Failed: 0,

  All tests passed!

Test: atest CtsNativeNetTestCases, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9ff784dbfda0ce981904d53eacb7bc831cbe81da
2021-07-06 22:15:44 +00:00
Treehugger Robot
cba9f66098 add test for /system/etc/bpf/{netd,clatd}.o using correct struct sizes
This test is required to ensure that the system is compatible
with future updates of the tethering mainline module, which
updates BPF .o files on device.

This test must already be passing on OEM devices because otherwise
the offload.o program in the Tethering mainline module would bootloop
the device.

Bug: 190519702
Test: atest CtsNativeNetTestCases, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Original-Change: https://android-review.googlesource.com/1756440
Merged-In: Ibaedb8fcb28591ffba1506514f2305d55712a26b
Change-Id: Ibaedb8fcb28591ffba1506514f2305d55712a26b
2021-07-06 21:13:24 +00:00
Treehugger Robot
58a4324397 Merge "add test for /system/etc/bpf/{netd,clatd}.o using correct struct sizes" am: 464d0b2bdd am: b2817e8e31
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1756440

Change-Id: I4b57219491ad0fef352ea0d834f402fb429b67a2
2021-07-06 21:12:19 +00:00
Maciej Żenczykowski
bbc4ea32bc add test for /system/etc/bpf/{netd,clatd}.o using correct struct sizes
This test is required to ensure that the system is compatible
with future updates of the tethering mainline module, which
updates BPF .o files on device.

This test must already be passing on OEM devices because otherwise
the offload.o program in the Tethering mainline module would bootloop
the device.

Bug: 190519702
Test: atest CtsNativeNetTestCases, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibaedb8fcb28591ffba1506514f2305d55712a26b
2021-07-06 02:50:47 -07:00
Remi NGUYEN VAN
00407b0c1b Add retries for WifiManager#connect
Connect can error with BUSY if the framework is busy when connect is
called. Add retries so that if this happens, the connection can succeed
after the framework stops being busy.

Also log the level of scan results when several configurations are
available, and clarify the legacy broadcast assert.

Bug: 188077861
Test: atest CtsNetTestCases
Change-Id: I99ce72bd2604489cb419ea9984643b6985728461
2021-07-06 17:53:48 +09:00
Remi NGUYEN VAN
e687d5844e Fix flake in testMobileDataAlwaysOn
The internal structure backing getAllNetworks is updated after
invoking lost callbacks, so the test needs to wait for the handler
to be idle before calling getAllNetworks.

Also avoid assertions in finally clauses, as it causes confusing
error messages.

Bug: 185081944
Change-Id: I8ad5ab45a3e65b0031672e6f594b1a6d6ad5abcb
Test: atest ConnectivityServiceTest
2021-07-06 06:09:17 +00:00
Remi NGUYEN VAN
1f210f792a Fix flake in testConnectivityDiagnosticsCallbackOnConnectivityReported
The test relied on waitForIdle to ensure diagnostics callbacks were called,
but as this may require several iterations in the handler queue, this makes
the test unreliable.

Use mockito timeouts on the verify() calls instead.

Bug: 192651465
Change-Id: Iae1704af7ae3649eae301c6aee223ac753629d55
Test: atest ConnectivityServiceTest
2021-07-06 06:05:38 +00:00
Remi NGUYEN VAN
0f956db686 Merge changes from topic "am-cc17cb7d48ea4bd7adc9183dc0c381e3-sc-dev" into sc-dev
* changes:
  Apply jarjar rules on coverage tests
  Re-skip connectivity unit tests before S
  Move ConnectivityCoverageTests to general-tests
  Fix ConnectivityManagerTest initialization on Q
  Move test_mainline_modules to AndroidTest.xml
  Add ConnectivityCoverageTests to postsubmit
  Add connectivity coverage tests
  Make tests compatible with mockito-extended
  Fix KeepalivePacketDataUtilTest crash on eng build
  Update connectivity TEST_MAPPING
2021-07-06 02:42:51 +00:00
Remi NGUYEN VAN
3676ffb9af Use WifiManager.connect to reconnect wifi
Address a TODO to use WifiManager#connect to reconnect wifi, instead of
WifiManager#reconnect. #connect also clears the BSSID denylist; that
list has caused flakyness due to tests that cause the network not to
validate such as captive portal or invalid private DNS behavior tests,
causing wifi to ignore the access point in reconnect attempts.

Bug: 188077861
Test: atest CtsNetTestCasesLatestSdk

Change-Id: I5a11a802db8a4881c161e6038c1c183d2ac23a05
2021-07-06 11:30:51 +09:00
Junyu Lai
8b1a98ff38 Merge "Consider NetworkOffer is unneeded if it cannot satisfy the request" am: b028fc7cf1 am: ce077a3ad0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1731452

Change-Id: Iaff7fca5582c454e651e1ca8042d28968a0148c1
2021-07-05 09:27:16 +00:00
Junyu Lai
b028fc7cf1 Merge "Consider NetworkOffer is unneeded if it cannot satisfy the request" 2021-07-05 08:57:07 +00:00
Remi NGUYEN VAN
5f01d1d538 Merge "Move BitUtils, RingBuffer test to coretests" am: 6be4ebcb0a am: b65aea1772
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1754897

Change-Id: Ic1a8f779daf2d36dd07b1ce0a84392c74e251263
2021-07-05 05:31:16 +00:00
Remi NGUYEN VAN
aeb54b3cf8 Fix testSocketKeepaliveLimitTelephony on R
DEVICE_INITIAL_SDK_INT does not exist in older SDKs: use the pre-rename
field, FIRST_SDK_INT instead.

Fixes: 185731191
Test: atest ConnectivityManagerTest#testSocketKeepaliveLimitTelephony
Change-Id: I1fbc0f714d539a664c053cb9cf1f86c3e651c5a2
Merged-In: I1fbc0f714d539a664c053cb9cf1f86c3e651c5a2
2021-07-05 14:18:27 +09:00
paulhu
bee1c6d9cd Replace FIRST_SDK_INT to DEVICE_INITIAL_SDK_INT in Connectivity
Replace all FIRST_SDK_INT usage in Connectivity because it has
been renamed to DEVICE_INITIAL_SDK_INT.

Bug: 184735771
Test: m CtsNetTestCases
Merged-In: I2f155592b08cdbf259a00b035cacb37ca9847e72
(clean cherry-pick)

Change-Id: I2f155592b08cdbf259a00b035cacb37ca9847e72
2021-07-05 14:18:26 +09:00
Remi NGUYEN VAN
6be4ebcb0a Merge "Move BitUtils, RingBuffer test to coretests" 2021-07-05 05:05:34 +00:00
Remi NGUYEN VAN
0b3f20a64d Apply jarjar rules on coverage tests
Apply their respective jarjar rules on tethering and general
connectivity tests, then merge both into the coverage tests suite.
This is necessary to ensure that classes covered by tests have names
matching classes used in code.

Also fix IpConnectivityLogTest to use the module utility instead of the
hidden BitUtils, as the test would fail after internal utils are
jarjared.

Bug: 187935317
Test: atest ConnectivityCoverageTests TetheringCoverageTests
Original-Change: https://android-review.googlesource.com/1749680
Merged-In: Ib95b58dab93f7adebc445b662a6d15db1ce0e7c2
Change-Id: Ib95b58dab93f7adebc445b662a6d15db1ce0e7c2
2021-07-05 05:02:05 +00:00
Remi NGUYEN VAN
fda49a5f17 Re-skip connectivity unit tests before S
The tests are packaged together with other tests in a common coverage
suite, so need to be individually annotated so that they are skipped
before S.

They do not need to pass on platforms older than S, because such
platforms will not updated with the code that is tested.

This applies a previous change, this time using DevSdkIgnoreRunner,
as SdkSuppress does not work as expected in branches that have a
codename 2 versions above the SDK version, as is the case in AOSP.

Bug: 187935317
Test: atest ConnectivityCoverageTests on R
      atest FrameworksNetTests on S
Original-Change: https://android-review.googlesource.com/1749684
Merged-In: I5808d34459a4c19238baf8873afa7cf942828460
Change-Id: I5808d34459a4c19238baf8873afa7cf942828460
2021-07-05 05:01:54 +00:00
Treehugger Robot
bd01bbaa92 Move ConnectivityCoverageTests to general-tests
The test suite is not signed with any particular key so
can be in general-tests. This is also required for TEST_MAPPING.

Bug: 187935317
Original-Change: https://android-review.googlesource.com/1749025
Merged-In: I9dbf98eaa28172a172e707091ea75ffdddd4971b
Change-Id: I9dbf98eaa28172a172e707091ea75ffdddd4971b
Test: TH for test mapping
2021-07-05 05:01:42 +00:00
Remi NGUYEN VAN
a6c016a65d Fix ConnectivityManagerTest initialization on Q
The test can't have TetheringManager as an argument to methods or a
field, otherwise the test runner will crash when scanning the class for
tests because TetheringManager did not exist in Q. Although
testFactoryReset is already skipped on Q, the test runner would fail
at initialization time, before starting the run.

Use CtsTetheringUtils instead. This ensures that TetheringManager does
not have method signatures or members that reference classes that do not
exist on Q, so the test runner can scan the class successfully before
starting the run.

Bug: 188851796
Test: atest ConnectivityManagerTest on Q
Original-Change: https://android-review.googlesource.com/1740779
Merged-In: I87488d0f23628a1ef2d7af0242513fcc5401d598
Change-Id: I87488d0f23628a1ef2d7af0242513fcc5401d598
2021-07-05 05:01:28 +00:00
Treehugger Robot
fb34c5861a Move test_mainline_modules to AndroidTest.xml
When an AndroidTest.xml is used, configuration needs to be in the
AndroidTest.xml file, not in the Android.bp.

This currently causes tests not to be run in TEST_MAPPING as they should
be.

Test: TH needs to test
Bug: 187935317
Original-Change: https://android-review.googlesource.com/1748157
Merged-In: Ie0aca0c64646825175769cd375bcecf65de4b4c8
Change-Id: Ie0aca0c64646825175769cd375bcecf65de4b4c8
2021-07-05 05:01:16 +00:00
Remi NGUYEN VAN
1c45a8a623 Add ConnectivityCoverageTests to postsubmit
Add the tests to both postsubmit and mainline-postsubmit.

This should allow moving the tests to presubmit in the near future,
after they have been verified to pass in postsubmit.

Bug: 187935317
Test: treehugger needs to test
Original-Change: https://android-review.googlesource.com/1736506
Merged-In: I9a05d6a300c5f777497e867d0456bc59b06eee80
Change-Id: I9a05d6a300c5f777497e867d0456bc59b06eee80
2021-07-05 05:01:02 +00:00
Remi NGUYEN VAN
168b3d19f1 Add connectivity coverage tests
The coverage tests will allow measuring code coverage for all
Connectivity+Tethering code.

This is a combination of the current TetheringCoverageTests, and
FrameworksNetTests.

Adding min_sdk_version to the test prevents it from using deprecated
IoUtils utilities. Replace it with the non-deprecated alternative.

Bug: 187935317
Test: atest ConnectivityCoverageTests
Original-Change: https://android-review.googlesource.com/1731232
Merged-In: I5366e1cc9cd6ddb41f24718246381cc2b1cc1383
Change-Id: I5366e1cc9cd6ddb41f24718246381cc2b1cc1383
2021-07-05 05:00:36 +00:00
Benedict Wong
6dd0516b56 Add tests for in-kernel VPN/VCN dataplane
This change adds relevant tests for the migrateTun functionality in
NetworkStats.

Bug: 190620024
Test: atest NetworkStatsTest
Original-Change: https://android-review.googlesource.com/1749069
Merged-In: I33f14f2d0f71013a594fd4c8c3914a590d30ea06
Change-Id: I33f14f2d0f71013a594fd4c8c3914a590d30ea06
2021-07-02 19:29:06 +00:00
Benedict Wong
f95947b96f Merge "Add tests for in-kernel VPN/VCN dataplane" am: 64619cabc1 am: 4793a34212
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1749069

Change-Id: I503c883fd61679862563abea9264d1806a59be62
2021-07-02 19:12:24 +00:00
TreeHugger Robot
0868536de9 Merge "Allow non-VPNs to have underlying networks." into sc-dev 2021-07-02 18:56:30 +00:00
Benedict Wong
64619cabc1 Merge "Add tests for in-kernel VPN/VCN dataplane" 2021-07-02 18:42:15 +00:00
Treehugger Robot
321558ffe8 Merge "Listen EXTERNAL_APPLICATIONS_AVAILABLE intent" 2021-07-02 16:56:12 +00:00
paulhu
8a4ce40acb Listen EXTERNAL_APPLICATIONS_AVAILABLE intent
- Some applications are installed on external storage and they
  are unavailable until exernal storage installed them
  completely. And their permission need update after becoming
  available. Thus, listen EXTERNAL_APPLICATIONS_AVAILABLE intent
  and update those package whose is listed in chaged package
  list.
- Remove user argument on buildPackageInfo() because the uid on
  ApplicationInfo is based uid.

Bug: 145234989
Test: atest FrameworksNetTests
Merged-In: Ia11ca4a7ba6fc1b87c27c0c40e36c91d9cdb322a

Change-Id: Ia11ca4a7ba6fc1b87c27c0c40e36c91d9cdb322a
2021-07-02 22:35:26 +08:00
Paul Hu
cedfba2e89 Merge "Listen EXTERNAL_APPLICATIONS_AVAILABLE intent" into sc-dev am: 790d3eb079
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14772860

Change-Id: Ic9f4d305099262efb2ce8f7506cc0b06151717b5
2021-07-02 14:31:31 +00:00
Paul Hu
790d3eb079 Merge "Listen EXTERNAL_APPLICATIONS_AVAILABLE intent" into sc-dev 2021-07-02 14:17:17 +00:00
Treehugger Robot
4703a8c392 Allow non-VPNs to have underlying networks.
Certain network types, like the VCN, have underlying
networks for the purpose of data usage, but do not want to
propagate the underlying network capabilities.

Allow these networks to set underlying networks, but continue
not to propagate the capabilities.

Bug: 190620024
Test: new unit test
Original-Change: https://android-review.googlesource.com/1753619
Merged-In: I53d6080f48707ff3c37fbfbef534284ba77a7432
Change-Id: I53d6080f48707ff3c37fbfbef534284ba77a7432
2021-07-02 13:56:28 +00:00
Treehugger Robot
8d1e3166cd Merge "Allow non-VPNs to have underlying networks." am: 5903d5646c am: 9a7c9c3c06
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1753619

Change-Id: Ic2188f15ce354e44436d4edc7500859e4eb09308
2021-07-02 13:55:33 +00:00
Treehugger Robot
47202851ec Merge "Force only system uid can set uids allowed on restricted networks" 2021-07-02 13:52:50 +00:00
Treehugger Robot
5903d5646c Merge "Allow non-VPNs to have underlying networks." 2021-07-02 13:28:01 +00:00
Paul Hu
39828864dd Merge "Use Netd new added/removed uid range methods" into sc-dev am: 29194db12f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14911836

Change-Id: Ie2a855902fd4ad04624a714c71bfaede6f0098e3
2021-07-02 12:20:24 +00:00
Paul Hu
29194db12f Merge "Use Netd new added/removed uid range methods" into sc-dev 2021-07-02 12:08:35 +00:00
paulhu
92f128c51c Force only system uid can set uids allowed on restricted networks
- Check whether calling UID/PID is system_server.
- For CTS test, enforce NETWORK_SETTINGS permission otherwise if
  it's a debug build.

Bug: 175199465
Test: atest FrameworksNetTests
Test: atest ConnectivityManagerTest#testUidsAllowedOnRestrictedNetworks
Merged-In: I175a831671d3e52460d28203b09f6c0dda56b61c

Change-Id: I175a831671d3e52460d28203b09f6c0dda56b61c
2021-07-02 20:04:50 +08:00
Paul Hu
93e9d0c1f6 Merge "Force only system uid can set uids allowed on restricted networks" into sc-dev am: 77739d37b3
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15172131

Change-Id: Ic688c1515f55de1a7f1ac784c5f6172429ac1902
2021-07-02 11:02:26 +00:00
Paul Hu
77739d37b3 Merge "Force only system uid can set uids allowed on restricted networks" into sc-dev 2021-07-02 10:46:19 +00:00
Lorenzo Colitti
bd079455f1 Allow non-VPNs to have underlying networks.
Certain network types, like the VCN, have underlying
networks for the purpose of data usage, but do not want to
propagate the underlying network capabilities.

Allow these networks to set underlying networks, but continue
not to propagate the capabilities.

Bug: 190620024
Test: new unit test
Change-Id: I53d6080f48707ff3c37fbfbef534284ba77a7432
2021-07-02 18:48:25 +09:00
TreeHugger Robot
f5f8e4e3a5 Merge "Change to REQUEST from LISTEN for mobile data preferred uids feature" into sc-dev 2021-07-02 09:27:38 +00:00
TreeHugger Robot
8d75184baf Merge "Test Entitlement when telephony is present" into sc-dev 2021-07-02 08:29:15 +00:00
Benedict Wong
1117e853f9 Add tests for in-kernel VPN/VCN dataplane
This change adds relevant tests for the migrateTun functionality in
NetworkStats.

Bug: 190620024
Test: atest NetworkStatsTest
Change-Id: I33f14f2d0f71013a594fd4c8c3914a590d30ea06
2021-07-02 00:39:32 -07:00
Remi NGUYEN VAN
a1b3f57eb8 Move BitUtils, RingBuffer test to coretests
The utilities are part of com.android.internal.util, but were
historically tested as part of the services.net tests. They were then
mistakenly moved to packages/modules/Connectivity with the rest of the
networking code, but actually belong in coretests.

Bug: 187935317
Test: atest FrameworksCoreTests
Change-Id: I74702f6a4d9bed5985d2a830dacd78129a7854a8
2021-07-02 16:24:01 +09:00
Lorenzo Colitti
a27e4fa269 Merge changes from topic "conn-diags-skipped" am: 05752a5316 am: da7f313fb4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1665082

Change-Id: I11d040232c8e24747966c7aa22a9c3bc7c3150c4
2021-07-02 06:56:58 +00:00
Cody Kesting
7efec74a37 Report result SKIPPED in ConnDiags if the network is not validated. am: f1120be78b am: c6abf3d60c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1718510

Change-Id: I499fa45099d8c2cc05797051d7853b97ed2234e8
2021-07-02 06:56:54 +00:00
Cody Kesting
c6abf3d60c Report result SKIPPED in ConnDiags if the network is not validated. am: f1120be78b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1718510

Change-Id: I4135072382e447206ef7634e6e43b7ad5186a00d
2021-07-02 06:43:20 +00:00
Lorenzo Colitti
05752a5316 Merge changes from topic "conn-diags-skipped"
* changes:
  Update ConnDiags CTS test to expect validation result SKIPPED.
  Report result SKIPPED in ConnDiags if the network is not validated.
2021-07-02 06:26:57 +00:00
Remi NGUYEN VAN
21e5140ff4 Fix CtsNetTestCases in instant mode
Skip tests that cannot run in instant mode, as WifiManager is not
available, and the test cannot bind to sockets in instant mode.

Bug: 192284219
Test: atest CtsNetTestCases -- --enable-parameterized-modules \
        --abi arm64-v8a --module-parameter instant_app
Original-Change: https://android-review.googlesource.com/1753823
Merged-In: I7a7b0169a3a495bb359dc1f72e56937dcdc5b8a8
Change-Id: I7a7b0169a3a495bb359dc1f72e56937dcdc5b8a8
2021-07-02 06:04:35 +00:00