Commit Graph

319 Commits

Author SHA1 Message Date
Junyu Lai
75d28bee27 Merge "Fix CTS test failed on R device" 2021-02-26 07:17:47 +00:00
junyulai
d69d7c815c Fix CTS test failed on R device
The test failed since the API is not available on R device.
Add conditions to ignore it.

Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideVpnTests
      on R device
Bug: None
Change-Id: I05a1f63adec72e89382cb095db714bccbdff0058
2021-02-25 08:39:28 +08:00
Bob Badour
f5b346ed1d Merge "[LSC] Add LOCAL_LICENSE_KINDS to packages/modules/Connectivity" 2021-02-19 06:23:22 +00:00
Sudheer Shanka
ddcfa071ab Merge "Add TEST_MAPPING to run CtsHostsideNetworkTests in presubmit." 2021-02-19 00:33:15 +00:00
Sudheer Shanka
be82d7d77a Add TEST_MAPPING to run CtsHostsideNetworkTests in presubmit.
We already run these tests when platform code affecting these tests
change. Now enabling these too to also run when these tests are being
changed.

Fixes: 154344933
Test: atest --test-mapping packages/modules/Connectivity/tests/cts/hostside
Change-Id: Ie3ea67670ccd028815936d30189146c25ba87e28
2021-02-18 11:39:09 +00:00
Bob Badour
97e6be27f6 [LSC] Add LOCAL_LICENSE_KINDS to packages/modules/Connectivity
Added SPDX-license-identifier-Apache-2.0 to:
  Tethering/Android.bp
  Tethering/apex/Android.bp
  Tethering/bpf_progs/Android.bp
  Tethering/common/TetheringLib/Android.bp
  Tethering/tests/Android.bp
  Tethering/tests/integration/Android.bp
  Tethering/tests/mts/Android.bp
  Tethering/tests/privileged/Android.bp
  Tethering/tests/unit/Android.bp
  tests/cts/hostside/Android.bp
  tests/cts/hostside/aidl/Android.bp
  tests/cts/hostside/app/Android.bp
  tests/cts/hostside/app2/Android.bp
  tests/cts/hostside/certs/Android.bp
  tests/cts/net/Android.bp
  tests/cts/net/api23Test/Android.bp
  tests/cts/net/appForApi23/Android.bp
  tests/cts/net/jni/Android.bp
  tests/cts/net/native/dns/Android.bp
  tests/cts/net/native/qtaguid/Android.bp
  tests/cts/net/util/Android.bp
  tests/cts/tethering/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I8534c580f0e2a17be146300b67b3604817b64507
2021-02-16 04:09:58 -08:00
Lorenzo Colitti
fd710547b2 Merge changes I71a37663,Ib2010b38
* changes:
  Improve testing of registerSystemDefaultNetworkCallback.
  Remove buggy ConnectivityManagerTest#ensureWifiConnected.
2021-02-12 02:45:02 +00:00
Sudheer Shanka
37c10a2252 Update the way we change meteredness of cellular networks in tests.
SubscriptionManager.setSubscriptionOverrideUnmetered() has been updated
to add NET_CAPABILITY_TEMPORARILY_NOT_METERED instead of
NET_CAPABILITY_NOT_METERED. So, we can't rely on that for changing the
meteredness.

Bug: 179664982
Test: atest tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Test: atest tests/cts/hostside/src/com/android/cts/net/HostsideNetworkCallbackTests.java
Change-Id: I4163b2f9c6f80b4e639d9977ef7e2b444ab12e81
Merged-In: I4163b2f9c6f80b4e639d9977ef7e2b444ab12e81
2021-02-10 14:05:09 +00:00
Lorenzo Colitti
baea700554 Improve testing of registerSystemDefaultNetworkCallback.
Addresses comments on aosp/1570840.

Bug: 179774433
Test: test-only change
Change-Id: I71a376631503e5b50ada3f7bb3dca6dbae9ebc27
2021-02-10 22:41:48 +09:00
Lorenzo Colitti
98d23e7d02 Accept both pre-S and post-S errors in getConnectionOwnerUid.
On R and below, when an app that is not the active VPN app calls
getConnectionOwnerUid, a SecurityException is thrown. On S and
above, the method just returns INVALID_UID, which is what would
happen if the app was the active VPN app but was not authorized
to find that particular socket.

Accept both behaviours.

Bug: 173331190
Test: atest HostsideVpnTests#testGetConnectionOwnerUidSecurity passes on R and S
Change-Id: Ie6de2ef505b0d7bc253c55215a698aeaa210785c
2021-02-10 15:14:31 +09:00
Lorenzo Colitti
e9aeb3c1c5 Add CTS coverage for VpnTransportInfo.
Bug: 173331190
Test: FrameworksNetTests HostsideVpnTests CtsNetTestCases
Change-Id: I77d866270c63f1078a2a01941b2271d4338aa178
2021-02-10 15:14:26 +09:00
Lorenzo Colitti
1e5cdd3187 Add test coverage for registerSystemDefaultNetworkCallback.
Bug: 173331190
Test: atest CtsNetTestCases:NetworkAgentTest
Change-Id: I3ce51ca253a8bd06408137f6f9ed4056a832cb43
2021-02-09 20:10:36 +09:00
Sudheer Shanka
8247993e00 Update meteredness of cellular networks for tests.
This would allow us to run both metered and unmetered networkpolicy
related tests when the device is on a cellular network.

Bug: 165343126
Test: atest CtsHostsideNetworkTests:HostsideRestrictBackgroundNetworkTests
Test: atest CtsHostsideNetworkTests:HostsideNetworkCallbackTests
Change-Id: Id70856dffc920e74bda28583dba4dd851a832397
Merged-In: Id70856dffc920e74bda28583dba4dd851a832397
2021-02-07 23:29:08 +00:00
Patrick Rohr
4df8a7aef1 Add CTS test for Restricted Networking Mode
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Bug: 175281879
Bug: 170323671
Change-Id: Ic69e7e029debeea1f131242fb2baad2796d4768c
2021-01-11 09:47:04 +01:00
Sudheer Shanka
796f29c09e Increase the wait timeout for meteredness to change.
Bug: 170241174
Bug: 174808291
Test: atest CtsHostsideNetworkTests:HostsideRestrictBackgroundNetworkTests
Change-Id: I3af17819a403958d88a30af7f6346e5bb96b2828
2021-01-05 06:37:56 +00:00
Remi NGUYEN VAN
d01761e07f Set noparent in connectivity CTS owners
Also reorganize the files to have one toplevel CTS owners file, and only
additional owners in subdirectories.

Change-Id: I28ce193896e1ade2034589327805870774a4d608
Test: m
2020-12-03 08:07:32 +00:00
xiamengsen
05c8a1ddd0 Verify network state of apps hosting fg-service and in idle state.
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java

Signed-off-by: xiamengsen <xiamengsen@xiaomi.com>
Change-Id: I0e6e40b714483e51cfee45c155d8ac8b2b356494
2020-10-12 18:42:00 +00:00
Dan Shi
d65405de4b Remove vts10 suite setting
Bug: 169583551
Test: build
Change-Id: I42d38bd2f9e8b1e932571a38c2ebe72861d18fca

Exempt-From-Owner-Approval: This CL remove vts10 from test_suites setting.
Change-Id: I42d38bd2f9e8b1e932571a38c2ebe72861d18fca
2020-10-07 02:31:26 +00:00
Treehugger Robot
accaf62b80 Merge "Skip unsupported hardware for testB141603906" 2020-10-02 02:53:35 +00:00
paulhu
01f9b00e88 Add CTS to verify DownloadManager permission
If DownloadManager doesn't have
CONNECTIVITY_USE_RESTRICTED_NETWORKS permission, it can't bind
socket to VPN when it is in VPN disallowed list but requested
downloading app is in VPN allowed list. Add a new CTS test to
verify that DownloadManager can do the download successfully via
VPN network.

Bug: 165774987
Test: atest HostsideVpnTests
Change-Id: Iba9e2f26ad325d0fdb34ab9a06faaaf9cb623166
2020-09-24 10:47:19 +08:00
Josh Yang
ae3412405d Skip unsupported hardware for testB141603906
Bug: 168748249
Fix: 168748249
Test: local cts passed.
Change-Id: I8af0d5f9716a510322b2bfb0cdf6f05f94b12604
2020-09-17 00:27:59 +00:00
Xin Li
77065af37d Merge "Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)" into stage-aosp-master 2020-09-01 20:03:43 +00:00
Tse Ho Lin
243c42a9b9 Don't require WiFi in CtsHostsideNetworkTests.
Skip test for non-WiFi connections.

Bug: 162192335
Test: run cts -m CtsHostsideNetworkTests -t com.android.cts.net.HostsideNetworkCallbackTests#testOnBlockedStatusChanged_dataSaver
Change-Id: I7c20e3454a2fe81671162e0a50f90d64ed7516d0
2020-09-01 05:20:44 +00:00
Xin Li
9d04ab0a42 Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: Id9ba142af9d2da12bda66d0c376d4b8c13f1503b
Change-Id: I1a1bdaabd06f43b695ac94172a6f46d00b7f5b84
2020-08-29 01:22:07 -07:00
Sudheer Shanka
d0f158204f Merge "Update language to comply with Android’s inclusive language guidance." 2020-07-30 21:19:38 +00:00
Sudheer Shanka
2d4d72bc31 Update language to comply with Android’s inclusive language guidance.
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 161896447
Test: n/a
Change-Id: I466bcd05d1cb5a5ba271bd4a7513c0e7dfa5145c
2020-07-29 20:09:33 +00:00
Sudheer Shanka
0a0d161fb3 Merge "Force the app idle state again after whitelisting it." into rvc-dev am: 2008be86fd
Original change: https://googleplex-android-review.googlesource.com/c/platform/cts/+/12171299

Change-Id: Ifc7ac3392d0edcdc870b0ab72863a087dcf0b440
2020-07-17 22:56:01 +00:00
Sudheer Shanka
7c4bb75e1b Force the app idle state again after whitelisting it.
Whitelisting the app resets forced idle state of an app, so
forcing idle state again.

Bug: 161477606
Test: atest ./hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: Ib57202a68071cc02d6071e0dc2c4780f026ad90b
2020-07-16 14:00:27 -07:00
Chalard Jean
b6f64fb76c Ignore non-matching callbacks to fix flakiness
This is a host-side tests that receives its network callbacks
through a custom AIDL that proxies them to this host-side
process. As this runs of the real callbacks from a real network,
this test receives unrelated callbacks – in particular calls to
onCapabilitiesUpdated to warn the process of updates of the
signal strength.
This skips these callbacks across the board by only matching
the expected callback. This will fix flakiness in the test.

Also, as a drive-by fix, this also checks the network in
the onBlockedStatusChanged callback. If the network object
is not the expected one, the test should not pass.

Bug: 160270536
Test: NetworkCallbackTests
Original-Change: https://android-review.googlesource.com/1318219
Merged-In: I67c685ebfb2c5e2ee6f7615196eedea8292ca3ff
Change-Id: I67c685ebfb2c5e2ee6f7615196eedea8292ca3ff
2020-07-10 04:34:04 +00:00
Chalard Jean
a4ad47a46b Merge "Ignore non-matching callbacks to fix flakiness" am: 2e2642f909 am: b02ea3ecdd
Original change: https://android-review.googlesource.com/c/platform/cts/+/1318219

Change-Id: Id29544f27c6ede9f08354d630933083d1d21ef03
2020-07-09 06:40:18 +00:00
Chalard Jean
f70d762a55 Ignore non-matching callbacks to fix flakiness
This is a host-side tests that receives its network callbacks
through a custom AIDL that proxies them to this host-side
process. As this runs of the real callbacks from a real network,
this test receives unrelated callbacks – in particular calls to
onCapabilitiesUpdated to warn the process of updates of the
signal strength.
This skips these callbacks across the board by only matching
the expected callback. This will fix flakiness in the test.

Also, as a drive-by fix, this also checks the network in
the onBlockedStatusChanged callback. If the network object
is not the expected one, the test should not pass.

Bug: 160270536
Test: NetworkCallbackTests
Change-Id: I67c685ebfb2c5e2ee6f7615196eedea8292ca3ff
2020-07-08 13:07:24 +09:00
Chalard Jean
8742267b94 Let testB141603906 run over ADB-over-network
This test (added in R) failed to take the adb-over-network
case into account like most other tests in the same file. As
such it erroneously fails when tested over such a test setup.
This patch exempts the shell from being subject to the VPN,
like other similar tests do, to avoid the adb connections
being killed.

Test: VpnTest
Bug: 159761399
Original-Change: https://android-review.googlesource.com/1349862
Merged-In: I0bc14d4d2cade7618c59b2cb88638bdf608d43d3
Change-Id: I0bc14d4d2cade7618c59b2cb88638bdf608d43d3
2020-07-01 23:16:54 +00:00
Chalard Jean
db4f75ebeb Merge "Let testB141603906 run over ADB-over-network" am: 3cded8dc20 am: eb4d8b4fab
Original change: https://android-review.googlesource.com/c/platform/cts/+/1349862

Change-Id: Ie54c911ca55be520d20b582a67bb2bf36259b91c
2020-07-01 13:57:56 +00:00
Chalard Jean
3cded8dc20 Merge "Let testB141603906 run over ADB-over-network" 2020-07-01 13:31:26 +00:00
Jiyong Park
616e299222 Drop .stubs from android.test.[base|runner|mock].stubs
The .stubs library refer to the stub library of a java_sdk_library.
Since the name of the stub library is the implementation detail of the
build system, direct use of the name should be prohibited. Actually,
clients don't need to use the stub name directly because the build
system automatically redirects <name> to <name>.stubs.

Exempt-From-Owner-Approval: too many owners are involved. This is a
simple build script change.

Bug: 157007292
Test: m
Merged-In: I32502de3d87c5cfdbbcfe5545dd7db5e9bb551a7
(cherry picked from commit 89c4e06853f7ea4b5a62a3b02b4f5113617b2c60)
Change-Id: I32502de3d87c5cfdbbcfe5545dd7db5e9bb551a7
2020-07-01 17:17:28 +09:00
Jiyong Park
82bb526062 Drop .stubs from android.test.[base|runner|mock].stubs
The .stubs library refer to the stub library of a java_sdk_library.
Since the name of the stub library is the implementation detail of the
build system, direct use of the name should be prohibited. Actually,
clients don't need to use the stub name directly because the build
system automatically redirects <name> to <name>.stubs.

Exempt-From-Owner-Approval: too many owners are involved. This is a
simple build script change.

Bug: 157007292
Test: m
Merged-In: I32502de3d87c5cfdbbcfe5545dd7db5e9bb551a7
(cherry picked from commit 4072d4d5d4)
Change-Id: I32502de3d87c5cfdbbcfe5545dd7db5e9bb551a7
2020-06-29 22:56:28 +09:00
Chalard Jean
5ed6690e66 Let testB141603906 run over ADB-over-network
This test (added in R) failed to take the adb-over-network
case into account like most other tests in the same file. As
such it erroneously fails when tested over such a test setup.
This patch exempts the shell from being subject to the VPN,
like other similar tests do, to avoid the adb connections
being killed.

Test: VpnTest
Bug: 159761399
Change-Id: I0bc14d4d2cade7618c59b2cb88638bdf608d43d3
2020-06-29 02:02:35 +00:00
Lucas Lin
bac55b7eeb Enlarge the onAvailable callback timeout to 30 seconds
Sometimes the device may take a long time to connect to the wifi,
try to enlarge the timeout to lower the fail rate of test.

Bug: 157391946
Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideNetworkCallbackTests
Original-Change: https://android-review.googlesource.com/1324092
Merged-In: Ie89936ecc2d70ee22dd312067ccedd2523e81855
Change-Id: Ie89936ecc2d70ee22dd312067ccedd2523e81855
2020-06-08 03:54:48 +00:00
Lucas Lin
40e0cc42c8 Merge "Enlarge the onAvailable callback timeout to 30 seconds" am: fbf126a6f8 am: 5bf0181b36
Original change: https://android-review.googlesource.com/c/platform/cts/+/1324092

Change-Id: Id3e19e53bf62579f70dad1163fd90a3455025115
2020-06-05 09:19:38 +00:00
lucaslin
072e96ebdf Enlarge the onAvailable callback timeout to 30 seconds
Sometimes the device may take a long time to connect to the wifi,
try to enlarge the timeout to lower the fail rate of test.

Bug: 157391946
Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideNetworkCallbackTests
Change-Id: Ie89936ecc2d70ee22dd312067ccedd2523e81855
2020-06-05 02:55:22 +00:00
Treehugger Robot
5df6449e3e Add logs to NetworkCallbackTest to diagnose issues
Bug: 157391946
Test: NetworkCallbackTests
Merged-In: I552a1ad05f97a2a9f83f5f7de77d2e7b64084ddc
Change-Id: Ic08df1908828f1487253a2b5dfb14e46442942b8
(cherry picked from commit 446a3ef6c2f9671dd7509906dbb647e1304ade78, aosp/1318216)
2020-05-27 13:28:22 +00:00
Treehugger Robot
530000eef0 Merge "Add logs to NetworkCallbackTest to diagnose issues" am: 89b5be1e4d am: 212fc42b22
Change-Id: I258765037afa2dc06def25b6c8b65b5b3d444f4c
2020-05-27 10:52:50 +00:00
Chalard Jean
796ccadc00 Add logs to NetworkCallbackTest to diagnose issues
Bug: 157391946
Test: NetworkCallbackTests
Change-Id: I552a1ad05f97a2a9f83f5f7de77d2e7b64084ddc
2020-05-27 15:51:53 +09:00
Kweku Adams
66c5773f79 Ensure airplane mode is off.
If the device is put into airplane mode before the network tests run,
the tests fail. This ensures that airplane mode is off before the tests
run.

Bug: 150788500
Test: atest CtsHostsideNetworkTests
Change-Id: I7a84be751e5e9efb534d48c6d8ff457875ebe716
2020-05-15 10:09:41 -07:00
lucaslin
5d57ec4a8f Refine NetworkCallbackTest
In R, to avoid data overages due to apps not detecting a
meteredness change, when a wifi network changes from unmetered
to metered the network will go down and will be replaced with a
new network. It will make NetworkCallbackTest fail because the
original design is getting the active network in setUp(). So once
the wifi reconnects, the network which is got in setUp() will be
meaningless and make the test fail due to network mismatches.
The new changes are:
1. Moving some initial pre-configurations into setUp().
2. Override the onCapabilitiesChanged() to check if network has
   changed to metered or not.
3. Add unregisterNetworkCallback() into iMyService.aidl so that
   NetworkCallbackTest can call it to unregister the network
   callback.
4. Enlarge the timeout of connecting network and receiving
   callback to prevent network cannot reconnect in time or
   callback cannot be received in a short time.

Bug: 153485744
Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideNetworkCallbackTests
Change-Id: I1aa0e107cf6797b06dee4a15896c63321d822156
Merged-In: I1aa0e107cf6797b06dee4a15896c63321d822156
2020-05-08 08:01:34 +00:00
lucaslin
63203afe0e Refine NetworkCallbackTest
In R, to avoid data overages due to apps not detecting a
meteredness change, when a wifi network changes from unmetered
to metered the network will go down and will be replaced with a
new network. It will make NetworkCallbackTest fail because the
original design is getting the active network in setUp(). So once
the wifi reconnects, the network which is got in setUp() will be
meaningless and make the test fail due to network mismatches.
The new changes are:
1. Moving some initial pre-configurations into setUp().
2. Override the onCapabilitiesChanged() to check if network has
   changed to metered or not.
3. Add unregisterNetworkCallback() into iMyService.aidl so that
   NetworkCallbackTest can call it to unregister the network
   callback.
4. Enlarge the timeout of connecting network and receiving
   callback to prevent network cannot reconnect in time or
   callback cannot be received in a short time.

Bug: 153485744
Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideNetworkCallbackTests
Change-Id: I1aa0e107cf6797b06dee4a15896c63321d822156
2020-05-08 11:02:46 +08:00
Kweku Adams
627f2b69ef Merge "Test that idle apps get network when device charges." into rvc-dev 2020-05-07 01:25:28 +00:00
Hai Zhang
9c3108c681 Merge "Declare MANAGE_EXTERNAL_STORAGE for test apps." into rvc-dev 2020-05-04 23:33:47 +00:00
Kweku Adams
efb1857443 Test that idle apps get network when device charges.
This is a partial revert of the change that removed the parole
(Icd7b6eff8777f9b53a10eca521b73988f58f2d84).

Bug: 151802309
Test: atest --rerun-until-failure 10 com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: I65f5ff20cdd342905e1afd1f4897017aa60682d3
2020-05-04 13:34:29 -07:00
Dominic Lemire
e4a9287bfe Fix error message in RestrictBackgroundNetworkTest
Fixed the error message when the expected number of broadcasts is exceeded.

Bug: 147139427
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: I7e69dca81abdb29a9eb7d110266edbe483e17a01
Merged-In: I7e69dca81abdb29a9eb7d110266edbe483e17a01
2020-04-30 19:38:34 -07:00