Commit Graph

3501 Commits

Author SHA1 Message Date
Junyu Lai
092ddbf46a Temporarily disable the test since prebuilt module is not updated am: c42a54f2a7 am: 3ebf903321
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15328937

Change-Id: If65a0bd3a29611df767caa03fc888411172fd2a8
2021-07-21 03:14:55 +00:00
Junyu Lai
3ebf903321 Temporarily disable the test since prebuilt module is not updated am: c42a54f2a7
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15328937

Change-Id: Ic9e6ca1fbbca65e324afa0079e6eaf2ed78fb147
2021-07-21 03:06:13 +00:00
Junyu Lai
fa9babada5 Consider NetworkOffer is unneeded if it cannot satisfy the request am: 135f50679f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/14730722

Change-Id: Ie6e029f4cb7a2e80120d216973ea2718dfb66661
2021-07-21 03:06:11 +00:00
Junyu Lai
c42a54f2a7 Temporarily disable the test since prebuilt module is not updated
This CL is subject to be reverted in a few days when the prebuilt
Connectivity module is updated.

Ignore-AOSP-First: This is for sc-dev and its downstreams only
Test: android.net.NetworkProviderTest
Bug: 189074532
Change-Id: I512552400960668c0ba91a8d997d1e2747209538
2021-07-20 05:58:08 +00:00
Junyu Lai
135f50679f Consider NetworkOffer is unneeded if it cannot satisfy the request
Currently, to prevent from network connect-teardown-loops that
caused by inaccurate reports, e.g. the provider always provides
a better network than the offer, the NetworkOffer is considered
needed if its provider is currently serving the request. This
is because there is no accurate way to know whether the offer is
corresponding to the network that is currently serving the
request.

However, if the offer cannot even satisfies the request, consider
the offer is needed does not make any sense. Since it can
never be the one that currently serving the request, nor be
the one that might beat current satisfier.

Test: android.net.NetworkProviderTest
Bug: 189074532
Original-Change: https://android-review.googlesource.com/1731452
Merged-In: Ie3ea59f980c3767782b8e6b03e401c02f664f9bd
Change-Id: Ie3ea59f980c3767782b8e6b03e401c02f664f9bd
2021-07-20 05:43:44 +00:00
Chiachang Wang
02c385adca Merge "Specify which callback is unexpected in tests" am: 5251171b75 am: 12a042be77 am: 795d0c3574
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1769289

Change-Id: I106b65532268b78a378b7d280578426c79c21110
2021-07-20 01:58:45 +00:00
Chiachang Wang
f01fb10e41 Merge "Deflake test to ensure system default network as expected" am: 575fa2f103 am: 250cf2af8a am: c79dce9599
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764308

Change-Id: I62c4b92e83c5f87e7f53ab2db0c88e9aed3ab859
2021-07-20 01:58:29 +00:00
Chiachang Wang
795d0c3574 Merge "Specify which callback is unexpected in tests" am: 5251171b75 am: 12a042be77
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1769289

Change-Id: I48948a8f04a2053cd24f153e1322df00fcedbf64
2021-07-20 01:49:11 +00:00
Chiachang Wang
c79dce9599 Merge "Deflake test to ensure system default network as expected" am: 575fa2f103 am: 250cf2af8a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764308

Change-Id: I34d1a75250faed18b734c68d9a0326ac46c645b4
2021-07-20 01:49:05 +00:00
Chiachang Wang
5251171b75 Merge "Specify which callback is unexpected in tests" 2021-07-20 01:20:16 +00:00
Chiachang Wang
575fa2f103 Merge "Deflake test to ensure system default network as expected" 2021-07-20 01:20:07 +00:00
Treehugger Robot
db8421e29d Merge "Fix a flake with mocking." am: 527f040944 am: ec050a37ab am: 19eaa44e9f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1762391

Change-Id: I5b1fc23ad5dc36af7cdc39d07ada95fd099412bc
2021-07-19 13:03:09 +00:00
Treehugger Robot
19eaa44e9f Merge "Fix a flake with mocking." am: 527f040944 am: ec050a37ab
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1762391

Change-Id: Ie146448d14695a88688a37e5993504d527de9404
2021-07-19 12:51:20 +00:00
Remi NGUYEN VAN
e5772017be Merge "Wait for next network in waitForAvailable" am: e9f65535e0 am: f38d076a83 am: 0e526cd506
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760698

Change-Id: Ib0cb160c285495e0c8f4ad85fca2d29785d0cc02
2021-07-19 12:24:20 +00:00
Treehugger Robot
527f040944 Merge "Fix a flake with mocking." 2021-07-19 12:16:18 +00:00
Chiachang Wang
6c80c3806d Specify which callback is unexpected in tests
Tests may be flaky due to the usage for assertNoCallback().
The method expects no any callback received. Based on the usage,
tests expect to not to receive certain callback, such as
onAvailable(). The network may update its linkproperties during
the test and trigger onLinkPropertiesChanged(). These callbacks
are ignorable in the tests. They should not fail the tests.

Replace the assertNoCallback to new assertNoCallbackThat with
callback type specified to deflake tests.

Bug: 192239030
Test: atest android.net.cts.ConnectivityManagerTest\
      --iterations 20
Change-Id: I1643c1ff15215c07e174dbcb664cfac2a38d5840
2021-07-19 18:41:53 +08:00
Chiachang Wang
ac059de6ad Deflake test to ensure system default network as expected
CtsNetUtils.toggleWifi() expects to receive a CONNECTIVITY_ACTION
broadcast after disconnecting from wifi if wifi is enabled.
The wifi may be connected but not validated since wifi just
turns back to connected from the previous test. In this case,
the system default netwok will not be wifi, so there is no
CONNECTIVITY_ACTION broadcast after disconnecting wifi. It
should ensure the wifi is system default network first before
proceeding with other verifications.

Bug: 192213759
Test: atest CtsNetTestCases --iterations 20
Change-Id: I82f0634883362e35b88854aae28e61b75a3cd7cc
2021-07-19 18:38:31 +08:00
Remi NGUYEN VAN
0e526cd506 Merge "Wait for next network in waitForAvailable" am: e9f65535e0 am: f38d076a83
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760698

Change-Id: Iafeca4e8049214af7871da406c2e2ddfe1c18df8
2021-07-19 10:25:11 +00:00
Remi NGUYEN VAN
1b7753d680 Merge "Skip BatteryStatsManagerTest on Q" am: e2067816e9 am: 4bcefe111a am: 354f5cf7d0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764310

Change-Id: I2ddf45299974c4016388a80d37c11f4d4a939bc8
2021-07-19 09:52:31 +00:00
Remi NGUYEN VAN
800eff01d0 Merge changes from topic "sdk_int_cp"
* changes:
  Fix testSocketKeepaliveLimitTelephony on R
  Replace FIRST_SDK_INT to DEVICE_INITIAL_SDK_INT in Connectivity
2021-07-19 09:47:21 +00:00
Remi NGUYEN VAN
e9f65535e0 Merge "Wait for next network in waitForAvailable" 2021-07-19 09:47:12 +00:00
Remi NGUYEN VAN
354f5cf7d0 Merge "Skip BatteryStatsManagerTest on Q" am: e2067816e9 am: 4bcefe111a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764310

Change-Id: I4168b127b63517c80aebbf270ecd0ec0b2f122cb
2021-07-19 09:39:21 +00:00
Remi NGUYEN VAN
e2067816e9 Merge "Skip BatteryStatsManagerTest on Q" 2021-07-19 09:11:54 +00:00
Treehugger Robot
97979c9e90 Merge "No-op cleanup" am: 21592b0d93 am: 866b9c4480 am: fa45b598d5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1769285

Change-Id: Id826a9b4659d9d10d7477e107c3cf640322f484c
2021-07-16 16:51:35 +00:00
Treehugger Robot
fa45b598d5 Merge "No-op cleanup" am: 21592b0d93 am: 866b9c4480
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1769285

Change-Id: Ib19a5d93e0b4e2f305a80ccf8841a36a5e7bda74
2021-07-16 16:38:19 +00:00
Chalard Jean
6d8f2fbf99 No-op cleanup
Test: atest ConnectivityServiceTest
Change-Id: Ic07c94785d97bd654ffce960e8bc2652c2dbc3d6
2021-07-16 12:02:22 +09:00
Remi NGUYEN VAN
cb671b6082 Merge "Fix jarjar-related failures in coverage tests" am: e9f7f1e3d4 am: c6bf1e19a4 am: c595c6461c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764731

Change-Id: Ia2b8025bcd43abae9c856626b4a150ac5a89c363
2021-07-15 09:31:40 +00:00
Remi NGUYEN VAN
ff23b67a3b Merge "Use TRANSPORT_USB from the SDK" am: ca688d62d3 am: 048ef34b88 am: 1e79e9322b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764734

Change-Id: I19c424de0b48733accf46965fabc615913f4b1d7
2021-07-15 09:29:32 +00:00
Remi NGUYEN VAN
c595c6461c Merge "Fix jarjar-related failures in coverage tests" am: e9f7f1e3d4 am: c6bf1e19a4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764731

Change-Id: If9fb707bf6e80b8937a41eb6306b2e2e0589a626
2021-07-15 09:28:55 +00:00
Remi NGUYEN VAN
1e79e9322b Merge "Use TRANSPORT_USB from the SDK" am: ca688d62d3 am: 048ef34b88
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1764734

Change-Id: I7ff0480df0d7997ea68422d1fe315fa94c5a0556
2021-07-15 09:02:04 +00:00
Remi NGUYEN VAN
e9f7f1e3d4 Merge "Fix jarjar-related failures in coverage tests" 2021-07-15 05:19:18 +00:00
Remi NGUYEN VAN
732584bcb8 Use TRANSPORT_USB from the SDK
Stop using the stopgap TRANSPORT_USB from NetworkCapabilitiesUtil, which
is being removed.

Bug: 184158327
Test: atest NetworkCapabilitiesTest
Change-Id: I6bbb35d39ff67d6f53b389689dc9f1067e64f962
2021-07-14 16:35:11 +09:00
lucaslin
eadb0add66 Ignore checking TRANSPORT_USB when Android version is older than S
There is a new transport type - TRANSPORT_USB(8) in Android S,
so when the test tries to add this new transport type in older
Android version, it cannot pass the transport type validation and
make test fail.

(clean cherry-pick of change in downstream branch history)
Original change ID before project move:
I38816173b04ea198d99f64f45e9271ac2641e4ac

Bug: 184158327
Test: run CtsNetTestCasesLatestSdk on Android R & Q
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ib0368241771d287c09c0e4463f91122533f85a27
2021-07-14 16:28:58 +09:00
Remi NGUYEN VAN
ed8efa75b4 Fix jarjar-related failures in coverage tests
Instead of jarjaring the whole com.android.internal.util package, apply
the jarjar rules per-class. Jarjaring the whole package causes problems
in tests, as for example ConnectivityServiceTest depends on Vpn that
uses other internal utils as hidden API, and these should not be
jarjared.

Also avoid jarjaring INetdUnsolicitedEventListener which is used by
NetdEventListenerServiceTest, and ensure KeepalivePacketDataUtilTest
expects the right package name in toString.

Generally the problems appear because ConnectivityCoverageTests also
includes tests for classes that are not part of the connectivity module,
and use hidden APIs that refer to classes that should not be jarjared.
Some of the tests could be excluded from the coverage suite instead, but
keeping them is helpful for future modularization efforts.

Test: Build service-connectivity, dexdump classes and verify jarjared
      atest ConnectivityCoverageTests
Change-Id: Id6b7e6833d49fa03d9442d7c1c3e4dc16fb48dfc
2021-07-14 15:22:56 +09:00
Remi NGUYEN VAN
4ba3adc4e5 Skip BatteryStatsManagerTest on Q
BatteryStatsManager did not exist on Q, so it cannot and should not be
tested there.

Bug: 193586822
Test: atest CtsNetTestCasesLatestSdk on Q
Change-Id: Ia9bef7c3438c25e1a4cb403b27cb0084bbd4f824
2021-07-14 12:06:51 +09:00
Remi NGUYEN VAN
30311abb87 Wait for next network in waitForAvailable
Tests using CtsNetUtils.TestNetworkCallback would generally assume that
waitForAvailable would return a non-null Network if onAvailable was
called after it was registered. However this is not true if a network
was available, then lost before waitForAvailable is called. This
can typically happen if wifi was disconnected just before calling
ensureWifiConnected (so wifi is being toggled).

In case onUnavailable was called, always wait for the next onAvailable
callback, so that waitForAvailable always waits for a network to be
available. So:

Old behavior:
 1) registerNetworkCallback called
 2) onAvailable called
 3) onLost called
 4) waitForAvailable called -> returns null immediately
 5) onAvailable called -> unused

New behavior:
 1) registerNetworkCallback called
 2) onAvailable called
 3) onLost called
 4) waitForAvailable called -> blocks
 5) onAvailable called -> waitForAvailable returns the network

Bug: 190913510
Test: atest CtsNetTestCases
Change-Id: I6bde82ad787371ecffd6caa950b52d90a29ab20b
2021-07-14 10:08:45 +09:00
Remi NGUYEN VAN
7c9f83b244 Jarjar all classes in service-connectivity am: b240e2a86e
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/15261893

Change-Id: I764011af0667ca401be07b42086118954c953c2d
2021-07-13 12:46:30 +00:00
Remi NGUYEN VAN
b240e2a86e Jarjar all classes in service-connectivity
This ensures classes are used from the service-connectivity jar, instead
of using classes from the system_server bootclasspath when there is a
name conflict.
Any developer adding a future class should do so in a subpackage of
com.android.connectivity (such as com.android.connectivity.server).
Otherwise, jarjar rules need to be added manually until b/180995093 is
fixed.

Also update current jarjar rules so that classes are jarjared to
com.android.connectivity.[original name], making it easier to find the
original source. This is consistent with the wifi module.

Bug: 193086215
Test: atest CtsNetTestCases
      dexdump on service-connectivity.jar shows no classes outside of
      com.android.connectivity and com.android.server
Original-Change: https://android-review.googlesource.com/1759589
Merged-In: I2aadeca32751267b74d4fd2fd93bb3e8c62e46c0
Change-Id: I2aadeca32751267b74d4fd2fd93bb3e8c62e46c0
2021-07-13 04:42:07 +00:00
Remi NGUYEN VAN
63a0b12501 Merge "Jarjar all classes in service-connectivity" am: 23c627b090 am: 793a4424d7 am: bfb22a0a0a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1759589

Change-Id: Ibc05406e026ddd471b1cd0e064963dae20fbc5f4
2021-07-13 00:16:06 +00:00
Remi NGUYEN VAN
bfb22a0a0a Merge "Jarjar all classes in service-connectivity" am: 23c627b090 am: 793a4424d7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1759589

Change-Id: I7a55b08af6efb311af1c5385b63a450e9c343fd7
2021-07-12 23:53:14 +00:00
Remi NGUYEN VAN
23c627b090 Merge "Jarjar all classes in service-connectivity" 2021-07-12 23:29:25 +00:00
Remi NGUYEN VAN
0755183fae Jarjar all classes in service-connectivity
This ensures classes are used from the service-connectivity jar, instead
of using classes from the system_server bootclasspath when there is a
name conflict.
Any developer adding a future class should do so in a subpackage of
com.android.connectivity (such as com.android.connectivity.server).
Otherwise, jarjar rules need to be added manually until b/180995093 is
fixed.

Also update current jarjar rules so that classes are jarjared to
com.android.connectivity.[original name], making it easier to find the
original source. This is consistent with the wifi module.

Bug: 193086215
Test: atest CtsNetTestCases
      dexdump on service-connectivity.jar shows no classes outside of
      com.android.connectivity and com.android.server
Change-Id: I2aadeca32751267b74d4fd2fd93bb3e8c62e46c0
2021-07-12 19:33:33 +09:00
Chalard Jean
6519c179bd Fix a flake with mocking.
The hypothesis here is that some other thread is using
the mock between the call to when() and the call to
.thenReturn() a few lines above the failure. It's not
clear this is really the reason, but using this syntax
is safer anyway, so whether it fixes the issue or not
this is a good change.

Test: m FrameworksNetTests
Change-Id: I501d2ec8e794c67a53d7c84e290e4cc63481472d
2021-07-12 15:30:21 +09:00
Remi NGUYEN VAN
2205be85bb Merge "Remove hidden ArrayUtils usage in test" am: 946da61e70 am: 3c5a0f7de9 am: 92b099b4e7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760689

Change-Id: I0d2477417b15a91a8cd0776e3b2d018558fed663
2021-07-12 02:59:14 +00:00
Remi NGUYEN VAN
92b099b4e7 Merge "Remove hidden ArrayUtils usage in test" am: 946da61e70 am: 3c5a0f7de9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1760689

Change-Id: I9a96b7cbef135a86d13171cd5b1edfc69b68c2e0
2021-07-12 02:50:20 +00:00
Remi NGUYEN VAN
946da61e70 Merge "Remove hidden ArrayUtils usage in test" 2021-07-12 02:21:12 +00:00
Remi NGUYEN VAN
61cc1ac9bd Remove hidden ArrayUtils usage in test
Internal utils are generally jarjared by connectivity jarjar rules, but
ArrayUtils is not actually statically linked into the tests, so this
makes the ConnectivityCoverageTests fail. FrameworksNetTests has been
fine because it does not use jarjar, but does not exercise updated code
because of that.

Remove usage of the hidden utility, as there are reasonable alternatives
with non-hidden APIs that avoid other breakages long-term.

Bug: 187935317
Test: atest ConnectivityCoverageTests:ConnectivityServiceTest
Change-Id: I8ed85b941c3d1028771a5ac33196b1509a95789d
2021-07-09 18:52:51 +09:00
Remi NGUYEN VAN
8890ead0e0 Merge "Add new network capabilities to support automotive head unit via USB" 2021-07-09 04:38:10 +00:00
Chalard Jean
278b92f6a0 Merge "Remove exclusivity restriction of multiple preferences" 2021-07-08 03:50:34 +00:00
Remi NGUYEN VAN
544872f16c Merge "Ensure wifi reconnects before waiting for metered" am: 14f0d14c14 am: 577f3e158d am: 9438d0fa5a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1757311

Change-Id: I116618f8a244902727c43e4ba529ca9826f10666
2021-07-08 01:25:44 +00:00