Commit graph android_packages_modules_Co.../tests
Message SHA1
Merge "Jarjar all classes in service-connectivity"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-07-12 23:29:25 +00:00
23c627b090
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

Remi NGUYEN VAN   commited 2021-07-12 19:33:33 +09:00
0755183fae
Merge "Remove hidden ArrayUtils usage in test"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-07-12 02:21:12 +00:00
946da61e70
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

Remi NGUYEN VAN   commited 2021-07-09 18:52:51 +09:00
61cc1ac9bd
Merge "Add new network capabilities to support automotive head unit via USB"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-07-09 04:38:10 +00:00
8890ead0e0
Merge "Remove exclusivity restriction of multiple preferences"
Chalard Jean   authored and   Gerrit Code Review   commited 2021-07-08 03:50:34 +00:00
278b92f6a0
Add new network capabilities to support automotive head unit via USB
- Add a new transport type for USB and a new network capability
to support automotive head unit.
- In order to pass DnsManagerTest#testTransportTypesEqual, Android.bp
needs to link to dnsresolver_aidl_interface-V8-java. That test checks
whether the TRANSPORT types defined in NetworkCapabilities are the
same as IDnsResolver.aidl.

(clean cherry-pick of change in downstream branch history, original
change ID before project move:
Iec2df09a776d779108f95098e01b7ffdf6f8867a)

Bug: 181742019
Test: atest FrameworksNetTests

Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ie438ec68577ebdaaf990795fa27f1169b0105411

lucaslin   authored and   Remi NGUYEN VAN   commited 2021-07-08 09:44:39 +09:00
6f77442d76
Merge "Ensure wifi reconnects before waiting for metered"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-07-08 00:40:37 +00:00
14f0d14c14
Remove exclusivity restriction of multiple preferences
- Each network preference has been assigned a priority value so
  that netd can know which uid range rule has higher priority. So
  remove the restriction that all network preferences are
  exclusive.
- Add priority check when getting request for uid.

Bug: 171872461
Test: atest FrameworksNetTests
(cherry-pick from ag/14731887)
Merged-In: I6912db753c8b4a194aa7af92b01ca6dcfec10d8b

Change-Id: I6912db753c8b4a194aa7af92b01ca6dcfec10d8b

paulhu   commited 2021-07-07 23:06:43 +08:00
aa0743d7c4
Merge "Fix flake in testConnectivityDiagnosticsCallbackOnConnectivityReported"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-07-07 03:53:17 +00:00
1d2ad89424
Merge "Fix flake in testMobileDataAlwaysOn"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-07-07 03:52:38 +00:00
02ea3f55c1
Merge changes I99ce72bd,I5a11a802
* changes:
  Add retries for WifiManager#connect
  Use WifiManager.connect to reconnect wifi

Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-07-07 03:07:21 +00:00
527ffb6f0c
Merge "Use Netd new added/removed uid range methods"
Paul Hu   authored and   Gerrit Code Review   commited 2021-07-07 03:07:10 +00:00
51bfbbfb1b
Use Netd new added/removed uid range methods
Replace network[Add|Remove]UidRanges to
network[Add|Remove]UidRangesParcel. The new methods are passing
NativeUidRangeConfig which contains priority value for each uid
range rules.

Bug: 171872461
Test: atest FrameworksNetTests
Test: atest HostsideVpnTests
(cherry-pick from ag/14911836)
Merged-In: I08bbdbcb8450b08e6208fa730137348550f9e3d2

Change-Id: I08bbdbcb8450b08e6208fa730137348550f9e3d2

paulhu   authored and   Paul Hu   commited 2021-07-07 03:06:32 +00:00
0e79d95332
Ensure wifi reconnects before waiting for metered
testGetMultipathPreference assumes that wifi will auto-reconnect after
changing its metered status, but this is not necessarily the case if the
BSSID has been blocklisted after it failed validating too many times.

Call ensureWifiConnected to force wifi to reconnect before waiting for
it to become metered.

Bug: 190913510
Test: atest ConnectivityManagerTest
Change-Id: Iafe9837b97e4d654bb0f3962d48a94c1f31bbebc

Remi NGUYEN VAN   commited 2021-07-07 10:55:39 +09:00
c6be26e0ef
remove obsolete/no-op NativeQtaguidTest
qtaguid is long dead - test is thus a no-op

New test logs:
  Running Tests...

  x86 CtsNativeNetTestCases
  -------------------------
  CtsNativeNetTestCases (1 Test)
  [1/1] BpfTest#bpfStructSizeTest: PASSED (0ms)

  Summary
  -------
  x86 CtsNativeNetTestCases: Passed: 1, Failed: 0, Ignored: 0, Assumption Failed: 0,

  All tests passed!

Test: atest CtsNativeNetTestCases, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I9ff784dbfda0ce981904d53eacb7bc831cbe81da

Maciej Å»enczykowski   commited 2021-07-06 22:15:44 +00:00
2aabf4138e
add test for /system/etc/bpf/{netd,clatd}.o using correct struct sizes
This test is required to ensure that the system is compatible
with future updates of the tethering mainline module, which
updates BPF .o files on device.

This test must already be passing on OEM devices because otherwise
the offload.o program in the Tethering mainline module would bootloop
the device.

Bug: 190519702
Test: atest CtsNativeNetTestCases, TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ibaedb8fcb28591ffba1506514f2305d55712a26b

Maciej Å»enczykowski   commited 2021-07-06 02:50:47 -07:00
bbc4ea32bc
Add retries for WifiManager#connect
Connect can error with BUSY if the framework is busy when connect is
called. Add retries so that if this happens, the connection can succeed
after the framework stops being busy.

Also log the level of scan results when several configurations are
available, and clarify the legacy broadcast assert.

Bug: 188077861
Test: atest CtsNetTestCases
Change-Id: I99ce72bd2604489cb419ea9984643b6985728461

Remi NGUYEN VAN   commited 2021-07-06 17:53:48 +09:00
00407b0c1b
Fix flake in testMobileDataAlwaysOn
The internal structure backing getAllNetworks is updated after
invoking lost callbacks, so the test needs to wait for the handler
to be idle before calling getAllNetworks.

Also avoid assertions in finally clauses, as it causes confusing
error messages.

Bug: 185081944
Change-Id: I8ad5ab45a3e65b0031672e6f594b1a6d6ad5abcb
Test: atest ConnectivityServiceTest

Remi NGUYEN VAN   commited 2021-07-06 06:09:17 +00:00
e687d5844e
Fix flake in testConnectivityDiagnosticsCallbackOnConnectivityReported
The test relied on waitForIdle to ensure diagnostics callbacks were called,
but as this may require several iterations in the handler queue, this makes
the test unreliable.

Use mockito timeouts on the verify() calls instead.

Bug: 192651465
Change-Id: Iae1704af7ae3649eae301c6aee223ac753629d55
Test: atest ConnectivityServiceTest

Remi NGUYEN VAN   commited 2021-07-06 06:05:38 +00:00
1f210f792a
Use WifiManager.connect to reconnect wifi
Address a TODO to use WifiManager#connect to reconnect wifi, instead of
WifiManager#reconnect. #connect also clears the BSSID denylist; that
list has caused flakyness due to tests that cause the network not to
validate such as captive portal or invalid private DNS behavior tests,
causing wifi to ignore the access point in reconnect attempts.

Bug: 188077861
Test: atest CtsNetTestCasesLatestSdk

Change-Id: I5a11a802db8a4881c161e6038c1c183d2ac23a05

Remi NGUYEN VAN   commited 2021-07-06 11:30:51 +09:00
3676ffb9af
Merge "Consider NetworkOffer is unneeded if it cannot satisfy the request"
Junyu Lai   authored and   Gerrit Code Review   commited 2021-07-05 08:57:07 +00:00
b028fc7cf1
Merge "Move BitUtils, RingBuffer test to coretests"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-07-05 05:05:34 +00:00
6be4ebcb0a
Merge "Add tests for in-kernel VPN/VCN dataplane"
Benedict Wong   authored and   Gerrit Code Review   commited 2021-07-02 18:42:15 +00:00
64619cabc1
Merge "Listen EXTERNAL_APPLICATIONS_AVAILABLE intent"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-07-02 16:56:12 +00:00
321558ffe8
Listen EXTERNAL_APPLICATIONS_AVAILABLE intent
- Some applications are installed on external storage and they
  are unavailable until exernal storage installed them
  completely. And their permission need update after becoming
  available. Thus, listen EXTERNAL_APPLICATIONS_AVAILABLE intent
  and update those package whose is listed in chaged package
  list.
- Remove user argument on buildPackageInfo() because the uid on
  ApplicationInfo is based uid.

Bug: 145234989
Test: atest FrameworksNetTests
Merged-In: Ia11ca4a7ba6fc1b87c27c0c40e36c91d9cdb322a

Change-Id: Ia11ca4a7ba6fc1b87c27c0c40e36c91d9cdb322a

paulhu   commited 2021-07-02 22:35:26 +08:00
8a4ce40acb
Merge "Force only system uid can set uids allowed on restricted networks"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-07-02 13:52:50 +00:00
47202851ec
Merge "Allow non-VPNs to have underlying networks."
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-07-02 13:28:01 +00:00
5903d5646c
Force only system uid can set uids allowed on restricted networks
- Check whether calling UID/PID is system_server.
- For CTS test, enforce NETWORK_SETTINGS permission otherwise if
  it's a debug build.

Bug: 175199465
Test: atest FrameworksNetTests
Test: atest ConnectivityManagerTest#testUidsAllowedOnRestrictedNetworks
Merged-In: I175a831671d3e52460d28203b09f6c0dda56b61c

Change-Id: I175a831671d3e52460d28203b09f6c0dda56b61c

paulhu   commited 2021-07-02 20:04:50 +08:00
92f128c51c
Allow non-VPNs to have underlying networks.
Certain network types, like the VCN, have underlying
networks for the purpose of data usage, but do not want to
propagate the underlying network capabilities.

Allow these networks to set underlying networks, but continue
not to propagate the capabilities.

Bug: 190620024
Test: new unit test
Change-Id: I53d6080f48707ff3c37fbfbef534284ba77a7432

Lorenzo Colitti   commited 2021-07-02 18:48:25 +09:00
bd079455f1
Add tests for in-kernel VPN/VCN dataplane
This change adds relevant tests for the migrateTun functionality in
NetworkStats.

Bug: 190620024
Test: atest NetworkStatsTest
Change-Id: I33f14f2d0f71013a594fd4c8c3914a590d30ea06

Benedict Wong   commited 2021-07-02 00:39:32 -07:00
1117e853f9
Move BitUtils, RingBuffer test to coretests
The utilities are part of com.android.internal.util, but were
historically tested as part of the services.net tests. They were then
mistakenly moved to packages/modules/Connectivity with the rest of the
networking code, but actually belong in coretests.

Bug: 187935317
Test: atest FrameworksCoreTests
Change-Id: I74702f6a4d9bed5985d2a830dacd78129a7854a8

Remi NGUYEN VAN   commited 2021-07-02 16:24:01 +09:00
a1b3f57eb8
Merge changes from topic "conn-diags-skipped"
* changes:
  Update ConnDiags CTS test to expect validation result SKIPPED.
  Report result SKIPPED in ConnDiags if the network is not validated.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-07-02 06:26:57 +00:00
05752a5316
Merge "Test Entitlement when telephony is present"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-07-02 04:28:18 +00:00
93773f0aa0
Merge "Fix CtsNetTestCases in instant mode"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-07-02 04:07:05 +00:00
81be2bd036
Merge "Change to REQUEST from LISTEN for mobile data preferred uids feature"
Paul Hu   authored and   Gerrit Code Review   commited 2021-07-02 01:10:56 +00:00
7079b72fa6
Update ConnDiags CTS test to expect validation result SKIPPED.
This CL updates ConnectivityDiagnosticsManagerTest to expect
NETWORK_VALIDATION_RESULT_SKIPPED for its TestNetworks. The tests also
expect a ConnectivityReport to be sent for all calls to
ConnectivityManager#reportNetworkConnectivity.

Bug: 162407730
Test: atest ConnectivityDiagnosticsManagerTest
Change-Id: I525ea22a38c54a6b5b969a70301852e7af12849c

Cody Kesting   commited 2021-07-01 17:38:17 -07:00
69ec69341e
Report result SKIPPED in ConnDiags if the network is not validated.
This CL updates ConnectivityDiagnostics to report
NETWORK_VALIDATION_RESULT_SKIPPED when the platform does not validate
the reported Network. This CL also updates the behavior for
ConnectivityManager#reportNetworkConnectivity, such that it will always
generate a ConnectivityReport on the reported network. If the reported
connectivity does not match the known connectivity of this network, the
network is revalidated and a report is generated. Otherwise,
revalidation is not performed and the cached ConnectivityReport is sent
instead.

This CL also updates ConnDiags behavior for calls to
ConnectivityManager#reportNetworkConnectivity. Specifically, ConnDiags
callbacks are only notified for these calls if:
  a) the call causes the Network to be re-validated, or
  b) the callback registrant was the caller of
     #reportNetworkConnectivity().
For b), the caller is always guaranteed to receive a ConnectivityReport
(a fresh report if the Network is re-validated, else the cached report).

Bug: 162407730
Test: atest FrameworksNetTests ConnectivityDiagnosticsManagerTest
Change-Id: I78b78919d5b0f09348dfdd5fdb37418b8c7f861f

Cody Kesting   commited 2021-07-01 17:38:16 -07:00
f1120be78b
Merge "Skip tests on unsupported devices."
Sudheer Shanka   authored and   Gerrit Code Review   commited 2021-07-01 16:59:46 +00:00
0dc6206752
Merge "Make notification icons and autocancel overlayable"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-07-01 09:49:37 +00:00
2c7e0714c6
Fix CtsNetTestCases in instant mode
Skip tests that cannot run in instant mode, as WifiManager is not
available, and the test cannot bind to sockets in instant mode.

Bug: 192284219
Test: atest CtsNetTestCases -- --enable-parameterized-modules \
        --abi arm64-v8a --module-parameter instant_app
Change-Id: I7a7b0169a3a495bb359dc1f72e56937dcdc5b8a8

Remi NGUYEN VAN   commited 2021-07-01 18:48:27 +09:00
f9d8719d64
Skip tests on unsupported devices.
Fixes: 192473577
Test: atest CtsHostsideNetworkTests:HostsideNetworkPolicyManagerTests
Change-Id: Ib90f0045cb574ada792c5d43fcc359c22d20f3a4

Sudheer Shanka   commited 2021-07-01 08:08:30 +00:00
f90750e26a
Merge "Print the result of command when test is failed"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-07-01 07:49:03 +00:00
c28bb26888
Merge "Fix testGetAllNetworkStateSnapshots for non-cellular"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-07-01 07:44:50 +00:00
ddf3660af8
Make notification icons and autocancel overlayable
Allow overlays to change the connectivity notification icons, and
whether the notifications are auto-cancelled.

This does not change default behavior, but is necessary to allow vendors
to adapt the notifications to their standards.

Bug: 173171709
Bug: 172048052
Test: atest NetworkNotificationManagerTest
      Added test overlay, verified icon replaced
Change-Id: Ibbb765a5e828b8b870cbfb81e89df2dbd2828be7

Remi NGUYEN VAN   commited 2021-07-01 16:04:09 +09:00
3a8198c3ba
Merge "Simplify the return condition in stop()"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-07-01 01:46:59 +00:00
584ab08627
Merge "Apply jarjar rules on coverage tests"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-06-30 23:53:57 +00:00
d590b30f72
Simplify the return condition in stop()
Previously, the return condition in stop() will check if the state
is STOPPING and the reason is ERROR_INVALID_NETWORK. The condition
is too restricted so that if another event is happened after binder
died, the exception will be thrown and crash the system.
Since calling stop() twice doesn't make sense, so relax the condition
of return when the state is STOPPING.

Bug: 182586681
Test: atest FrameworksNetTests
Change-Id: I2454c1c080d8954dd3785d4ac6e96fc4131fdb47

lucaslin   commited 2021-07-01 02:29:53 +08:00
40d931c474
Change to REQUEST from LISTEN for mobile data preferred uids feature
- If Mobile data always on is OFF, mobile data preferred uids
  feature does not work.
- We need to request mobile data when MDO list is not empty.

Bug: 171872461
Test: atest FrameworksNetTests
Test: atest CtsNetTestCases

Signed-off-by: Ansik <ansik.shin@samsung.com>
Change-Id: Ie9d6b3e39ef16813c4be3979900d226c8f3d656d

Ansik   authored and   paulhu   commited 2021-06-30 14:22:34 +00:00
605e77055c
Fix network callback with the same PendingIntent does not release
Currently, ConnectivityService uses EVENT_REGISTER_NETWORK_LISTENER
to dispatch registering network callback with pending intent, this
is wrong since the code flow will not check if the pending intent
is duplicated. Thus, the registration will be duplicated if the
caller uses the same pending intent and register multiple times.

This change fixes the logic by using
EVENT_REGISTER_NETWORK_LISTENER_WITH_INTENT instead of
EVENT_REGISTER_NETWORK_LISTENER when dispatching register network
callback with pending intent.

Test: atest android.net.cts.ConnectivityManagerTest#testRegisterNetworkRequest_identicalPendingIntents
Test: atest android.net.cts.ConnectivityManagerTest#testRegisterNetworkCallback_identicalPendingIntents
Test: atest ConnectivityServiceTest#testNetworkCallbackMaximum
Test: 1. Use test app to file callback with same PendingIntent
       2. Check dumpsys output
Bug: 189868426
Change-Id: I38bdea3a026a78a6dc34b5200d43a75b3cd1ac0c

WeiZhang   authored and   Junyu Lai   commited 2021-06-30 12:05:43 +00:00
1cc3f17413