Commit Graph

235 Commits

Author SHA1 Message Date
Hui Yu
a6bb88ebc1 Merge "Make sure app_idle_constants is set during setup." into qt-dev
am: dc7e2bb71c

Change-Id: Id524c3206efbc09ecf422b837b92891c8baafde5
2019-05-03 09:34:37 -07:00
Kweku Adams
eb7b9bab13 Merge "Testing Data Saver changed broadcast on unsupported devices." into qt-dev
am: 42f325acb9

Change-Id: If94305b8d2a8b877af585f0c209538b2b2827a7a
2019-05-03 07:52:00 -07:00
Hui Yu
dc7e2bb71c Merge "Make sure app_idle_constants is set during setup." into qt-dev 2019-05-02 22:51:17 +00:00
Sasha Smundak
153173af0b Merge "Convert hostsidetests/net/**/Android.mk file to Android.bp" am: 9bca8f5c35
am: 69de989faf

Change-Id: I9a37e90afe4f6682187f9c5937cc552067ab9f7c
2019-04-30 10:36:46 -07:00
Sasha Smundak
b3af5c95b2 Convert hostsidetests/net/**/Android.mk file to Android.bp
See build/soong/README.md for more information.

Bug: 122332514
Test: atest CtsHostsideNetworkTests
(same failures as in baseline)
Change-Id: I5b6a22263331b19570b42f156d7ad5d59f8208b4
2019-04-29 13:18:42 -07:00
Kweku Adams
3a88dd4732 Testing Data Saver changed broadcast on unsupported devices.
Bug: 114131539
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: I3e8f9297ca49ee86bd26bb3d7a094c38b6203118
2019-04-29 11:25:14 -07:00
Hui Yu
022058ec74 Make sure app_idle_constants is set during setup.
Set app_idle_constants in NetPolicyTestsPreparer is not always successful(suspect timing issue).
Set app_idle_constants in AbstractRestrictBackgroundNetworkTestCase again to make sure.

Bug: 115393390
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests#testAppIdleMetered_whenCharging

Change-Id: I41148bc7eea0825537133f0471ceefeb5b05d763
2019-04-26 17:07:34 -07:00
Lorenzo Colitti
5abd1ff346 Add instant and ABI XML tags for hostside networking tests.
These are not multi-ABI because the behaviour does not depend on
the ABI of the app. Some of the APIs are ultimately backed by JNI
code in the system server, but that only depends on the system
server's ABI, not the app's.

Enable instant mode because these applications are subject to the
same network restrictions as other apps.

Fix: 123364589
Test: atest CtsHostsideNetworkTests
Test: cts-tradefed run commandAndExit cts --enable-parameterized-modules --module-parameter instant_app -m CtsHostsideNetworkTests
Change-Id: Ib3c4cd365ffe95889d51a236f035ea84516f0abd
(cherry picked from commit ad17ee9e92)
2019-04-26 12:52:28 -07:00
Varun Anand
5d3ac8f9e1 CTS tests related to VPN meteredness.
(cherry picked from commit d1008aa730)

Tests cover scenarios related to whether VPN has explicitly declared its
underlying networks plus whether it is an always metered VPN.

For each of these scenarios, we ensure VPN meteredness based on its
capabilities and ConnectivityManager#isActiveNetworkMetered matches.

Bug: 123727651
Test: atest HostsideVpnTests

Change-Id: I2dea70c1c432d05b1a22c945f1e3e17166e4132d
Merged-In: I3030e5468a55bbc32be2a753f098dcf7f0256af8
2019-04-15 07:55:58 -07:00
Varun Anand
7973b17dd7 Merge "CTS tests related to VPN meteredness." am: 1806a7da53
am: dd6406d69d

Change-Id: I87ddf706b507fc0c9f8004b130b555c3905d99b1
2019-04-15 07:11:29 -07:00
Varun Anand
1806a7da53 Merge "CTS tests related to VPN meteredness." 2019-04-15 13:45:57 +00:00
Lorenzo Colitti
72914e4469 Merge "Add instant and ABI XML tags for hostside networking tests." am: 75c73cda26
am: c40bdf2fce

Change-Id: I82ad420b23f4c332d0463e154c135e19081cba98
2019-04-12 05:44:24 -07:00
Varun Anand
d1008aa730 CTS tests related to VPN meteredness.
Tests cover scenarios related to whether VPN has explicitly declared its
underlying networks plus whether it is an always metered VPN.

For each of these scenarios, we ensure VPN meteredness based on its
capabilities and ConnectivityManager#isActiveNetworkMetered matches.

Bug: 123727651
Test: atest HostsideVpnTests
Change-Id: I3030e5468a55bbc32be2a753f098dcf7f0256af8
2019-04-11 14:32:21 -07:00
Lorenzo Colitti
ad17ee9e92 Add instant and ABI XML tags for hostside networking tests.
These are not multi-ABI because the behaviour does not depend on
the ABI of the app. Some of the APIs are ultimately backed by JNI
code in the system server, but that only depends on the system
server's ABI, not the app's.

Enable instant mode because these applications are subject to the
same network restrictions as other apps.

Fix: 123364589
Test: atest CtsHostsideNetworkTests
Test: cts-tradefed run commandAndExit cts --enable-parameterized-modules --module-parameter instant_app -m CtsHostsideNetworkTests
Change-Id: Ib3c4cd365ffe95889d51a236f035ea84516f0abd
2019-04-11 20:43:59 +09:00
Lorenzo Colitti
f0d0a9e352 Merge "Add test coverage for ICMP echo constants." am: 718025ed2c am: 0f6be092bb
am: b452497881

Change-Id: Ic0189e07e2745b721a307754a7bcc6574878ac32
2019-04-01 09:11:18 -07:00
Lorenzo Colitti
950e10572b Add test coverage for ICMP echo constants.
Bug: 129251251
Test: atest android.net.ipv6.cts.PingTest com.android.cts.net.HostsideVpnTests
Change-Id: Icca18e0870588ca250225ce79cf30dbd8c361e84
2019-03-30 02:11:46 +09:00
Junyu Lai
06db529877 Merge changes Ic19b3b64,I26ca370f am: c5ceda2354 am: f29182d403
am: 6188ebe70d

Change-Id: I7aa0abf2308ede2025bb8bfdf044fd37275f6afb
2019-03-24 19:30:34 -07:00
junyulai
27e1316c33 Add cts test cases for NetworkCallback.onBlockedStatusChanged
Bug: 118862340
Test: atest HostsideNetworkCallbackTests

Change-Id: Ic19b3b648a94adf4449393beb9b30ad7a7dc2283
2019-03-22 19:17:01 +08:00
junyulai
d05db41eb7 Export API of listening for network change events in app2
Currently, due to foreground app will never get blocked by
NetworkPolicyManagerService, so onBlockedStatusChanged cannot be
tested under cts net app.

Thus, listen for network change events in app2 allows subsequent
tests on NetworkCallbacks.

Bug: 118862340
Test: m -j cts
Change-Id: I26ca370fc6ae4dd3f32ce6cf448bae83f3fbfbcc
2019-03-22 10:19:38 +08:00
Brett Chabot
44a06a7fbd Migrate remaining cts to androidx.test.
See go/jetpack-test-android-migration

Exempt-From-Owner-Approval: automated package name refactoring; already
reviewed+merged internally
Test: m cts

Change-Id: I6877435bf0436b8ef1dd252b225eac2908e78b71
Merged-In: I092c369229f8cb4c13827cbad4fd162622ac7849
2019-03-03 18:22:22 -08:00
Yichun Li
c3baf72520 Merge "Backfill OWNERS for CTS module CtsHostsideNetworkTests" 2019-03-01 22:57:28 +00:00
Yichun Li
0c6f9ef7c8 Backfill OWNERS for CTS module CtsHostsideNetworkTests
You're receiving this CL because you're the owner of CtsHostsideNetworkTests as per http://go/cts-test-owners. Please refer to the following doc for more details on why we are backfilling OWNERS file: http://go/backfill-cts-owners.

Test: Ignored
Bug: 126563878
Change-Id: Ib239888264404f6acd265f9923d8c2c4eb988797
2019-03-01 10:37:11 -08:00
Brett Chabot
29235ec92f Migrate cts/hostsidetests to androidx.test
See go/jetpack-test-android-migration

Test: make cts; atest CtsDexMetadataHostTestCases
CtsAppSecurityHostTestCases
Exempt-From-Owner-Approval: mechanical automated package name refactoring
Change-Id: I87228b09384f759d0702270ca26ed9010072e6bf
2019-02-27 00:30:28 +00:00
Sudheer Shanka
2186a943d3 Add permissions needed for WifiManager.getConnectionInfo().getSSID().
Fixes: 124383293
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests

Change-Id: I3145e4ba1e768b7bb3c89867e36b506a90b87506
2019-02-15 18:03:10 -08:00
Pavel Grafov
6b35917311 Merge "Cleanup leftover commented code." am: 89268e42f2 am: da8ad481d3
am: 6fe1ac0066

Change-Id: I574b525b90709c3f1256c60a5f0dfb41b6c4c69a
2019-01-31 02:36:01 -08:00
Pavel Grafov
93281da1c3 Merge "CTS test for VpnService.isAlwaysOn & .isLockdownEnabled." am: 30667cf8c0 am: ec4f77d275
am: 1c2ee40dcd

Change-Id: I6416bb47b1793995155c41dfa9728615e78b9418
2019-01-30 13:55:09 -08:00
Pavel Grafov
063552f8c9 Cleanup leftover commented code.
Test: builds
Bug: none
Change-Id: Ic14227d0ddccbd04e13c7a61197765eab2555cbe
2019-01-30 21:44:39 +00:00
Pavel Grafov
49e9a78dcb CTS test for VpnService.isAlwaysOn & .isLockdownEnabled.
Test cases that expect to get "true" returned are part of
devicepolicy tests since it is hard to set up always-on
configuration without device/profile owner.

Test: atest MixedDeviceOwnerTest#testAlwaysOnVpn
Test: atest HostsideVpnTests#testIsAlwaysOnIsLockdown
Bug: 72628179
Change-Id: I7fceab93a1d2d0255611f7a788391540e0dddccb
2019-01-30 18:50:15 +00:00
Amith Yamasani
614733dab6 Merge "Foreground Service Location tests" 2019-01-29 20:07:13 +00:00
Amith Yamasani
1a2ad39b55 Foreground Service Location tests
Create multiple foreground services and make
sure the process state reflects which FG service
type is running.

Also fix an existing test with hardcoded proc
state.

Bug: 111453223
Test: atest CtsAppTestCases
      atest CtsHostsideNetworkTests

Change-Id: I309083d13452df58f6dc8e7089328acf260a2ed0
2019-01-28 22:11:30 -08:00
Irina Dumitrescu
24e2819d22 Merge "CTS test for setting HTTP proxy on a VPN network." am: 1ca625c2cb am: 0e603d64bf
am: 8c37a098cb

Change-Id: I61d8913e679ab73c61d951a9603b1823c5172f08
2019-01-25 07:15:07 -08:00
Irina Dumitrescu
3e84aa2e36 CTS test for setting HTTP proxy on a VPN network.
Bug: 76001058
Test: adb shell settings put global stay_on_while_plugged_in 7 && atest HostsideVpnTests
Change-Id: Ifa64d640f15bb68736b8c12f70e58a180bd80869
2019-01-24 19:10:21 +00:00
Juju Sung
6772e96931 Merge "Fix lowMemoryKill with app2.MyService" into pie-cts-dev am: 86ca1697d0 am: 5e7629b84a
am: fc407c45a7

Change-Id: If047ee41d0f3283c4e802d555453270f114b1dfd
2018-12-25 00:35:43 -08:00
Juju Sung
fc407c45a7 Merge "Fix lowMemoryKill with app2.MyService" into pie-cts-dev am: 86ca1697d0
am: 5e7629b84a

Change-Id: I8c5ab1fb1f60b7dc3d5b3ca7e1c2fabd763659a8
2018-12-25 00:29:49 -08:00
Juju Sung
46e3f1b3a5 Merge "Fix lowMemoryKill with app2.MyService" into pie-cts-dev
am: 86ca1697d0

Change-Id: Iee80963d4a158caab0892104ff0c4839e2490280
2018-12-25 00:21:50 -08:00
Juju Sung
62eb00af49 Fix lowMemoryKill with app2.MyService
MyForegroundService.java will change to background service during
testing,It’s ADJ will be 900. When run on a 512M project, it will
easily killed due to low memory.

Only set BIND_NOT_FOREGROUND and remove BIND_ALLOW_OOM_MANAGEMENT.
So MyForegroundService can still change process state between foreground
and background by startFround()/stopFround(). But it's ADJ will not too
high in background.

Bug: 120038371
Test: VTS, ran the test 5 times and it passed 5 times
Change-Id: I555366db7dd9904bc119bea94efbbe6422764f69
2018-12-25 08:07:26 +00:00
Kweku Adams
30897c29ef Tests for app idle whitelisting.
Ensuring that app idle network whitelisting works as expected and does
not override other power saving restrictions.

Bug: 117846754
Bug: 111423978
Test: atest CtsHostsideNetworkTests
and atest NetworkPolicyManagerServiceTest
Change-Id: I09172184e2fe543d6723639e5e62ae6afd5a6087
2018-11-28 14:36:13 -08:00
markchien
de0f268f78 Exempt adb socket for hostside VpnTest
Vpn test would destroy socket. If adb run over network, adb
socket would be killed during Vpn test. Then, test stop due to
adb disconnect.

Bug: 119382723
Test: - build pass
      - run cts -m CtsHostsideNetworkTests -t com.android.cts.net.HostsideVpnTests

Change-Id: I91b4ab018a9e7fc73dcb7969e4a6520d6b27d629
2018-11-22 20:39:46 +08:00
Jeff Vander Stoep
d502c99123 Refactor duplicate code into single function
Address comments in aosp/763607

Bug: 116053204
Test: atest ProcNetTest
Change-Id: Iec8b58b6499a7764b3757d4dd820e1f45a65e814
2018-09-28 10:36:12 -07:00
Jeff Vander Stoep
ff39f3fa71 Move tests requiring /proc/sys/net access to hostside
This access is going away for apps. Move these tests to hostside
tests to be executed by the shell domain.

Test: atest cts/hostsidetests/net/src/com/android/cts/net/ProcNetTest.java
Test: atest android.net.cts.ConnectivityManagerTest
Test: atest android.net.cts.IpSecSysctlTest
Test: atest android.net.cts.MultinetworkSysctlTest
Bug: 116053204
Change-Id: Id7e867184dd344a2d877515956e76019d627788b
2018-09-28 10:29:01 -07:00
Jeff Vander Stoep
ab53484d7b VpnTest: test getConnectionOwnerUid API
Test connection->UID resolution for both UDP and TCP connections.

Bug: 9496886
Bug: 109758967
Test: atest HostsideVpnTests
Change-Id: Ic17c64df74f65d788fd3d95a25af3c5b44946881
2018-09-18 15:40:32 -07:00
Sudheer Shanka
841d4711be Use a different key for signing networkpolicy test app.
One of the preparation steps for running cts involves loading up the sim
card with the key used to sign CtsCarrierApiTestCases.apk. It
means if the same key is used for signing networkpolicy test app too,
then the app is considered as carrier privileged by the system and can't
be forced into app standby state.

Fixes: 80077890
Test: cts-tradefed run singleCommand cts-dev -m CtsHostsideNetworkTests -t \
      com.android.cts.net.HostsideRestrictBackgroundNetworkTests#testDataSaverMode_disabled

Change-Id: Iaa9f4fabe83430fa42b6f67c1025db41a5e1d938
2018-06-19 19:35:00 -07:00
Sudheer Shanka
cd670e7957 Update charge level too when turning battery off.
BATTERY_CHARGING which triggers the parole state
will only be sent if the level is > 90.

Change-Id: I1073e473c27eb5d29744f4a967771392729b4e1a
Fixes:80534062
Test: Verified that updating the level activates the parole mode.
2018-05-31 11:43:40 -07:00
Sudheer Shanka
4ca791b07b Merge "Update turnBatteryOff to include changing charging status too." into pi-dev 2018-05-23 01:42:05 +00:00
Sudheer Shanka
1b3cc387bf Update turnBatteryOff to include changing charging status too.
AppStandbyController is now listening to BatteryManager.ACTION_CHARGING
for starting parole state and this broadcast won't be sent immediately
after plugging in the device. So, update the charging status too which is
going to trigger this broadcast and parole state can be started
immediately.

Bug: 80109076
Test: cts-tradefed run singleCommand cts-dev -m CtsHostsideNetworkTests -t \
      com.android.cts.net.HostsideRestrictBackgroundNetworkTests

Change-Id: I6f19f7a509ec48e96eaea4b188262d5a9735edf1
2018-05-22 14:18:10 -07:00
Sudheer Shanka
926a3cb026 CtsHostsideNetworkTests: Skip unsupported tests.
If appStandby is not enabled, then
testAppIdleAndBatterySaver_tempPowerSaveWhitelists is not supported.

Fixes: 79942156
Test: cts-tradefed run singleCommand cts-dev -m CtsHostsideNetworkTests -t \
      com.android.cts.net.HostsideRestrictBackgroundNetworkTests

Change-Id: I2f4012ff2cf42481e089d7fc33930258e501ddbf
2018-05-22 13:10:50 -07:00
Sudheer Shanka
6dea1b7567 Set stable_charging_threshold app idle constant to 0 during tests.
Tests need the parole state to get started immediately after device
starts charging, so update stable_charging_threshold constant to 0.

Also simplify the logic to update the global setting as the tests only rely
on a couple of constants.

Fixes: 79319040
Test: Test: cts-tradefed run singleCommand cts-dev -m CtsHostsideNetworkTests -t \
      com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Change-Id: Ie9ef67bb1544dd0179980d537365d13e6b6020c1
2018-05-08 15:02:37 -07:00
Sudheer Shanka
217aee2c9c Merge "Don't reset battery status before disabling battery saver mode." into pi-dev 2018-03-29 19:32:56 +00:00
Sudheer Shanka
6d389c2bfc Don't reset battery status before disabling battery saver mode.
Resetting battery status makes the "disabling battery saver mode"
operation that follows it a no-op if the device is plugged-in to power.
In this case, sticky battery saver status won't get reset and might
affect the tests following it.

Also, change back turnBatteryOff -> "cmd battery reset" since issue "72502904"
is fixed now.

Fixes: 77236363
Test: cts-tradefed run singleCommand cts-dev -m CtsHostsideNetworkTests -t \
      com.android.cts.net.HostsideRestrictBackgroundNetworkTests

Change-Id: I93e11c714200e8de6864a3bd7627eb66842a39d1
2018-03-29 10:29:16 -07:00
Sudheer Shanka
10864275fb Turn screen-on if needed, on every iteration network access is verified.
In some cases, we verify network connection is available to an app while
in foreground. If the app's foreground status is due to top activity, it
will lose the foreground status in case the screen goes off. So, turn
the screen-on while verifying for network connectivity.

Fixes: 71694434
Test: cts-tradefed run singleCommand cts-dev -m CtsHostsideNetworkTests -t \
      com.android.cts.net.HostsideRestrictBackgroundNetworkTests

Change-Id: Id1a49cedc2501859f73deead372afb7f6a41baac
2018-03-28 18:57:42 -07:00