Add hostside CTS tests to test for SoftApConfiguration being redacted
from TetheringInterface for apps that don't own that config.
Bug: 216524590
Test: atest CtsHostsideNetworkTests
Change-Id: I823c8e94cc6fe10c6118e7a694da368e585bbd69
Quang Anh Luongcommited 2024-11-19 19:32:19 +09:00
For now, only share a couple of statements (min_sdk_version and
platform_apis). More will be added later.
Also, remove the test_suites stanzas everywhere. These are not
relevant for test apps because the APKs will be pulled in by
the data: stanzas anyway.
Bug: 365191921
Test: atest CtsHostsideNetworkTests
Change-Id: If510519b3bdd6ab27c1923bae523cddb694e0ecc
Lorenzo Colitticommited 2024-09-20 14:48:12 +09:00
These are no longer necessary, and now that udc-mainline-prod is
gone, we are moving away from shims entirely.
Bug: 365191921
Test: test-only change
Change-Id: Ia441170c25a04d7b146b48e170d53e0916d49ecf
Lorenzo Colitticommited 2024-09-20 14:48:08 +09:00
Updated the testing app and AIDL interface used by
CtsHostsideNetworkTests to support min_sdk_version 30, ensuring
compatibility with Android R devices.
Test: TH
Change-Id: Ib334f95cf9bd199cce46b2c98d40d8361179aac3
Yuyang Huangauthored and Lorenzo Colitticommited 2024-09-09 19:47:44 +09:00
Missing min_sdk_version will make the helper apps failed to install on
older Android releases.
Bug: 364110022
Test: TH
Change-Id: I2b53d3547d175786574064f9b8b24ea5d302a3ff
This change specifies the sdk_version property to the cts test modules
so that the test modules do not depend on the framework, and utilize the
test api instead.
Test: TH
Bug: 345499522
Change-Id: I876fb8681dadad9d123bedb38d67c1a31b0f3a54
Tests for the connectivity module and network policy are both currently
residing in the same cts module leading to significant problems while
maintaining the tests. Breaking them up into two separate modules so
making changes and maintaining error free tests is easier.
Development of network policy changes occurs in non-updatable system
code so relevant tests should be moved outside of the apex module
respository. This will be possible after this change.
Network policy related tests are moved to the new module
CtsHostsideNetworkPolicyTests, with classes renamed accordingly.
Since some code was shared between tests, that code is now duplicated in
the new module.
No functional change to tests is intended. Further refactorings to
better suit the new structure should be pursued independently via
follow-up changes in respective modules from now on.
Test: atest CtsHostsideNetworkTests
Test: atest CtsHostsideNetworkPolicyTests
Bug: 322115994
Change-Id: I2c6ad2281ede6bad099c971b1f212244881a262d
Checking that the network was successfully restricted before starting
the activities in ConnOnActivityStartTest. This avoids races between uid
state changes and device state changes in NPMS code that lead to
unpredictable UnknownHostException flakes in the first iteration.
Moving the java cache clearing to happen immediately before the check,
so no side effect from different code can impact the DNS query.
Increasing the socket-timeout to mitigate socket timeout failures.
Changing the default test URL to generate a 204 to avoid any extraneous
errors that may arise in doing other I/O, and switching to the canonical
connectivity check URL on the android.com domain.
Enabling support for passing down a custom url to use for testing
network connectivity using the runner options. This will enable easily
switching between different URLs for debugging when required.
Using a dedicated data class to encapsulate information to be returned
from test app to the instrumentation app.
This makes the logic more resilient, readable and maintainable.
Test: atest CtsHostsideNetworkTests:HostsideConnOnActivityStartTest --\
--test-arg com.android.compatibility.common.tradefed.testtype.JarHostTest:\
set-option:com.android.cts.net.HostsideConnOnActivityStartTest:\
custom-url:"https\://www.example.com"
Bug: 330406935
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:04c638ee3a5bab7895817ebfc0d3f6a69b1ee26d)
Merged-In: I139408fc0a9ffa21d7bd2f3f249d45a7b25243b4
Change-Id: I139408fc0a9ffa21d7bd2f3f249d45a7b25243b4
Suprabh Shuklaauthored and Android Build Cherrypicker Workercommited 2024-04-02 05:51:41 +00:00
This CL is created as a best effort to migrate test targets
to the new android ownership model. If you find incorrect or unnecessary
attribution in this CL, please create a separate CL to fix that.
For more details please refer to the link below,
<add g3 doc link>
Bug: 304529413
Test: N/A
Change-Id: I243f17b3f0ad7af9ffa15ca242456e36688733f5
Merged-In: I243f17b3f0ad7af9ffa15ca242456e36688733f5
packages/modules/Connectivity.
TO meet the U requirement that apps targetSdkVersion U+ must specify
foreground service type and permissions.
Bug: 262580021
Test: build and run.
Change-Id: I9ba478459c8ce0dfc77b6e50876c4c2249523ad9
Ignore-AOSP-First: foregroundServiceType "specialUse" is internal master branch only.
If the app tries to make a network connection in the
foreground immediately after trying to do the same when
it's network access was blocked, it could receive a
UnknownHostException due to the cached DNS entry.
So, clear the dns cache after every network access for
now until we have a fix on the platform side.
Bug: 237549250
Bug: 238064333
Bug: 237556596
Bug: 238962235
Bug: 238833668
Bug: 239262832
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Ignore-AOSP-First: Will be cherrypicked to aosp later
Change-Id: Ic603b1bd9da24ee3724054c4a91794ee569e97f6
Bug: 231496005
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Ignore-AOSP-First: This will cherry-picked to AOSP later.
Change-Id: Iba17daa70f14bdee1d1a7d32cb9dc64623ba1d24
We already have tests that verify this but these new tests
launch the activity repeatedly a few times and verify the
network access as there are multiple race conditions
involving AMS, NPMS and the app that could result in an
inconsistent network rules state.
Bug: 226299593
Test: atest atest tests/cts/hostside/src/com/android/cts/net/HostsideConnOnActivityStartTest
Change-Id: I6372820fd2b21ebd759a3c44c7280c6699726bde
Merged-In: I6372820fd2b21ebd759a3c44c7280c6699726bde
We already have tests that verify this but these new tests
launch the activity repeatedly a few times and verify the
network access as there are multiple race conditions
involving AMS, NPMS and the app that could result in an
inconsistent network rules state.
Bug: 226299593
Test: atest atest tests/cts/hostside/src/com/android/cts/net/HostsideConnOnActivityStartTest
Change-Id: I6372820fd2b21ebd759a3c44c7280c6699726bde
Bug: 218790167
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests
Ignore-AOSP-First: This will be cherrypicked later
Change-Id: I42a8da4677126803fd4728bd4f1b61fa0379c3f4
In order to follow the new dynamic receiver paradigm introduced in T, receivers will have to be specifically marked as exported or not exported when registering dynamically. Since this is in a test only, and the test says that it needs the broadcast to be in a different process, mark as exported.
Bug: 161145287
Change-Id: I112d56962e3a6c3043240f8dfab058dc5a728ba9
Test: atest HostsideRestrictBackgroundNetworkTests#testAppIdle_toast
Jacob Hobbieauthored and Michael Groovercommited 2022-02-07 15:40:49 -08:00
As it sends notifications
Test: com.android.cts.net.HostsideRestrictBackgroundNetworkTests#testDozeModeMetered_enabledButWhitelistedOnNotificationAction
Fixes: 218219438
Change-Id: Ib79c5f250cabc92d454ffb828e82d528eadb2774
This fixes the missing apk errors when running this module as
part of sts.
Ignore-AOSP-First: Platform changes related to this are not in AOSP yet.
Test: run sts-engbuild-no-spl-lock -m CtsHostsideNetworkTests
Bug: 195961795
Change-Id: I9a9a2d20ce637663790df42e22b0c8023cf7bc3e
Bug: 177931370
Test: atest tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Ignore-AOSP-First: Platform changes related to this are not in AOSP yet.
Change-Id: I6d525c4d88ba01838d51a873251593281b628898
Basically, this commit is to fix the comments left on
aosp/1737395.
- Remove MeterednessConfigurationRule since this test won't
change meteredness.
- Launch activity without checking network access because such
behavior has covered by DataSaverModeTest. This test can only
focus on the network rule changed when the app is in the
foreground or background.
Also improve test by
- Having a new function to just launch the activity without
checking network status.
- Having a callback design when launching an activity to ensure
that the ACTION_FINISH_ACTIVITY is registered before leaving
launchActivity() method. Without this design, there might be a
race when activity is launched but ACTION_FINISH_ACTIVITY
has not registered before test calls finishActivity().
When the issue is happened, there is no way to fix it, so have
a callback design to prevent this problem.
Ignore-AOSP-First: There is a merge conflict in AOSP.
Bug: 176289731
Test: atest CtsHostsideNetworkTests:HostsideNetworkPolicyManagerTests \
#testIsUidNetworkingBlocked_withDataSaverMode \
CtsHostsideNetworkTests:HostsideNetworkPolicyManagerTests \
#testIsUidRestrictedOnMeteredNetworks --rerun-until-failure 100
Change-Id: I045e4a7dd0cec15f20e529024cd1fc06bcccd68f
lucaslinauthored and Lucas Lincommited 2021-07-13 12:37:28 +00:00
Currently, NetworkCallbackTest gets the capabilities of current
active network to track the network used for the tests. And
construct the request with the capabilities gets from the
network. This causes test fails if the capabilities contain
signal strength, since it requires NETWORK_SIGNAL_STRENGTH_WAKEUP
to be declared.
Thus, this patch null out several fields from capabilities
of the current active network to construct the new request
in order to prevent over-specifying the requirement.
Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideNetworkCallbackTests
Bug: 182516128
Change-Id: Ib79b38e63ad2083c29fd71a24b8686b3f6f4e12f
By current wifi design, wifi will report disconnected and
re-connected when changing from non-metered to metered.
However, the cts test app listens for all network, which
will get mobile network as active network when wifi is
changing meteredness. This is not expected. And causes
test failures when DUT has both wifi and mobile connections.
Thus, this change pass request to track currently active
network to the test app and register only for transport
types of currently active network to prevent from getting
unexpected network.
Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideNetworkCallbackTests
Bug: 182516128
Merged-In: I2dce6035b13472bbdc2609009d690aac96280033
Change-Id: I2dce6035b13472bbdc2609009d690aac96280033
(cherry-picked from ag/14029457)
By current wifi design, wifi will report disconnected and
re-connected when changing from non-metered to metered.
However, the cts test app listens for all network, which
will get mobile network as active network when wifi is
changing meteredness. This is not expected. And causes
test failures when DUT has both wifi and mobile connections.
Thus, this change pass request to track currently active
network to the test app and register only for transport
types of currently active network to prevent from getting
unexpected network.
Test: atest CtsHostsideNetworkTests:com.android.cts.net.HostsideNetworkCallbackTests
Bug: 182516128
Ignore-AOSP-First: merge conflict with ag/13615939 which cannot
be cherry-picked.
Change-Id: I2dce6035b13472bbdc2609009d690aac96280033
Accessing @TestApis is only allowed for
debuggable APKs on release builds.
Fixes: 181594072
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Ignore-AOSP-First: Related CL http://ag/13615939 is not in AOSP yet.
Change-Id: I7777d70e3dc4217e7eb931060feb658d8943962a
Bug: 177641226
Test: atest ./tests/cts/hostside/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
Ignore-AOSP-First: Expedited jobs are not available in AOSP
Change-Id: Ic75ebdc184764b7e7ac02d3e2ca18cbba1c55ee5
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
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
Ignore-AOSP-First: Handling merge-conflict
Change-Id: Id70856dffc920e74bda28583dba4dd851a832397
Fixes: 178077028
Test: atest com.android.cts.net.HostsideRestrictBackgroundNetworkTests#testDozeModeNonMetered_enabledButWhitelistedOnNotificationAction
Ignore-AOSP-First: FLAG_MUTABLE is not available in aosp
Change-Id: I91013ffe375fb7befc58134a571ea9ab37c3affa
Bug: 177641226
Test: atest CtsHostsideNetworkTests:HostsideRestrictBackgroundNetworkTest
Ignore-AOSP-First: Expedited jobs are not available in AOSP yet
Change-Id: Idc0762093667d49f09d52050c47c29cbc55997e1