Commit Graph

305 Commits

Author SHA1 Message Date
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
Dominic Lemire
cae5079d9d Fix error message in RestrictBackgroundNetworkTest
Fixed the error message when the expected number of broadcasts is exceeded.

Bug: 147139427

Change-Id: I7e69dca81abdb29a9eb7d110266edbe483e17a01
2020-04-30 05:47:29 +00:00
Sudheer Shanka
0ac91b4737 Ensure location is enabled before getting SSID.
When location is disabled, Wi-Fi scan results and SSID are not available
to apps.

Fixes: 153850762
Fixes: 153396893
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: I05285811d7131e116d5e1d072137ed2cf9576d05
Merged-In: I05285811d7131e116d5e1d072137ed2cf9576d05
2020-04-22 14:37:45 -07:00
Hai Zhang
59b9da9907 Declare MANAGE_EXTERNAL_STORAGE for test apps.
That has requested legacy external storage and targets R or
beyond. TestDevice automatically grants the app op during test app
installation but the permission declaration should still be there.

Also added some other missing app op permission declarations according
to test failure.

Fixes: 149765004
Test: Ensure the same set of tests pass with the following command:
Test: atest ExternalStorageHostTest StorageHostTest
Test: Ensure apps printed in the following command targets below R:
Test: find . -type f -exec grep -q 'android:requestLegacyExternalStorage' {} \; -not -exec grep -q 'MANAGE_EXTERNAL_STORAGE' {} \; -print
Test: presubmit
Exempt-From-Owner-Approval: This CL just adds a <uses-permission> line
                            across a number of test apps. Storage team
                            and most owners have approved this change.
Change-Id: I839a23b28b29118baae7a8c309f7bd4de698419b
2020-04-22 21:20:40 +00:00
Sudheer Shanka
a6a1ad183e Fix a regression in how required properties are collected.
+ Enable app standby mode before running the tests.

Fixes: 147459100
Fixes: 117169751
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Test: cts-tradefed run singleCommand cts-on-gsi --skip-device-info \
      --skip-preconditions -m CtsHostsideNetworkTests \
      -t com.android.cts.net.HostsideRestrictBackgroundNetworkTests

Change-Id: I782f8a06922622d28f9a9d5c9f2afa2b12f8aa80
Merged-In: I782f8a06922622d28f9a9d5c9f2afa2b12f8aa80
2020-04-22 13:59:46 -07:00
Sudheer Shanka
39cc315273 Fix Error Prone errors
Soong wasn't including android_app or android_test sources in the
javac-check target used for the Error Prone build, which allowed
some Error Prone errors to get in.  Fix them so Error Prone can be
re-enabled for these targets.

Fixes:
cts/hostsidetests/net/app/src/com/android/cts/net/hostside/RequiredPropertiesRule.java:61: error: [CollectionIncompatibleType] Argument '~requiredProperty.getValue()' should not be passed to this method; its type int is not compatible with its collection's type argument Property

Bug: 146455923
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I7c5bf823bf371902285ce3ee3929796fa40c653b
Merged-In: I48b1ccb61c807d0b41a165298ef5981258d6656e
2020-04-22 13:52:12 -07:00
Sudheer Shanka
1206400ccf Reland "Pull service dumps to help debug test failures."
+ Convert tests to use Junit4
+ Add annotations to specify required conditions for the test to run.

This reverts commit 89099548f8.

Bug: 137859686
Change-Id: I7bb2a7e4b2dca3696761e7c030f3380b9226b676
Merged-In: I93317c201a0ea06732e29154ab7e140735381f59
2020-04-22 12:27:50 -07:00
Tony Huang
89099548f8 Revert "Pull service dumps to help debug test failures."
This reverts commit e3711ae317.

Reason for revert: Might cause build break on errorprone branch

Change-Id: Iddece3edf4b1e96fafb8b36282f58410a2476025
2020-04-22 04:31:43 +00:00
Sudheer Shanka
e3711ae317 Pull service dumps to help debug test failures.
+ Convert tests to use Junit4
+ Add annotations to specify required conditions for the test to run.

Bug: 137859686
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideNetworkCallbackTests.java
Change-Id: I93317c201a0ea06732e29154ab7e140735381f59
Merged-In: I93317c201a0ea06732e29154ab7e140735381f59
2020-04-21 14:29:19 +00:00
Sudheer Shanka
643abc73d9 Ensure location is enabled before getting SSID.
When location is disabled, Wi-Fi scan results and SSID are not available
to apps.

Fixes: 153850762
Fixes: 153396893
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: I05285811d7131e116d5e1d072137ed2cf9576d05
2020-04-14 21:31:40 +00:00
Dan Shi
d24f495dc4 Remove tests from vts suite
After vts-core is renamed to vts, the CTS tests won't be needed in vts
suite.

Bug: 151896491
Test: local build
Exempt-From-Owner-Approval: This CL removes all CTS tests in vts suite,
as vts is renamed to vts10. This CL won't change test logic or behavior.

Change-Id: Idc9e9cc1d1080ff689823671a736bbb78bd7a740
Merged-In: Idc9e9cc1d1080ff689823671a736bbb78bd7a740
2020-04-07 17:00:46 -07:00
Sudheer Shanka
9eb1424bcf Merge "Dump debug logs after a test failure before running tearDown()s." into rvc-dev 2020-04-06 19:20:19 +00:00
Sudheer Shanka
1f4e465b5a Dump debug logs after a test failure before running tearDown()s.
Bug: 145420790
Test: atest hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Change-Id: I19516046f05bd4564c57542ae82a82a1cc362f48
2020-04-05 01:57:55 -07:00
Dan Shi
d4bff6cd28 Remove tests from vts suite
After vts-core is renamed to vts, the CTS tests won't be needed in vts
suite.

Bug: 151896491
Test: local build
Exempt-From-Owner-Approval: This CL removes all CTS tests in vts suite,
as vts is renamed to vts10. This CL won't change test logic or behavior.

Change-Id: Idc9e9cc1d1080ff689823671a736bbb78bd7a740
2020-04-01 13:30:00 -07:00
Dan Shi
210a4a7e55 Add vts10 suite to existing vts tests
This is to prepare renaming vts to vts10.

Bug: 151896491
Test: local build
Exempt-From-Owner-Approval: This CL adds all tests in vts to a new
suite vts10. vts10 will be the new name of existing vts suite. This CL
won't change test logic or behavior.

Change-Id: Ic250f04f0424d0a586c183d571b0ad57c56a03d0
Merged-In: Icfbc0ef0d40b908dc9ef664bedf3ead563ff9855
Merged-In: Ibb8ca5e3b9d1cc7247f57d0d89bd15b9f52fec92
Merged-In: Ia9af1fbddc66d3c94976a58c36d274425f1fe461
2020-03-26 05:20:00 +00:00