Commit Graph

2521 Commits

Author SHA1 Message Date
Treehugger Robot
c7d350f66a Merge "Move CtsHostsideNetworkTests to group presubmit-large" am: c3bac64a94 am: b0e2855252 am: 45a26a4aa2
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1674227

Change-Id: Ice6daa7d9f5bfb3481fa7579398416cd42c6f3c8
2021-04-19 04:14:41 +00:00
Treehugger Robot
45a26a4aa2 Merge "Move CtsHostsideNetworkTests to group presubmit-large" am: c3bac64a94 am: b0e2855252
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1674227

Change-Id: I2ff565e0a753cd133972f34eff2fb9fc9bd27678
2021-04-19 03:53:58 +00:00
Treehugger Robot
c3bac64a94 Merge "Move CtsHostsideNetworkTests to group presubmit-large" 2021-04-19 03:05:59 +00:00
Junyu Lai
34006332a1 Merge "[VCN20.2] Change requestBackgroundNetwork argument order" am: afd18ddd57 am: d1c84ae89c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1676442

Change-Id: I68ab7fc43774c3ea977219261857930c703f6ea9
2021-04-16 16:52:15 +00:00
Junyu Lai
afd18ddd57 Merge "[VCN20.2] Change requestBackgroundNetwork argument order" 2021-04-16 16:04:31 +00:00
Treehugger Robot
15bc33f87d Merge "Fix CTS fail to register network callback since lack of permission" am: f7d188c8c9 am: 9da7347603 am: 0dc94a353e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1674237

Change-Id: I7564fa7cf1f8c5d9e73044ccf8411f08f42a3c77
2021-04-15 16:32:49 +00:00
junyulai
989cf46ba0 [VCN20.2] Change requestBackgroundNetwork argument order
Test: atest FrameworksNetTests FrameworksVcnTests
Fix: 185215095
Merged-In: I09ff7461b655cbfc6ed5a7db07e02a388cd3d079
Change-Id: I09ff7461b655cbfc6ed5a7db07e02a388cd3d079
  (cherry-picked from ag/14185520)
2021-04-16 00:29:20 +08:00
Treehugger Robot
9e7affed67 Merge "Fix CTS fail to register network callback since lack of permission" am: f7d188c8c9 am: 9da7347603
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1674237

Change-Id: I76e3e4536e592f61243e1afa46811a8992996bb5
2021-04-15 16:05:01 +00:00
Junyu Lai
41e033f8f1 Merge "[VCN20.2] Change requestBackgroundNetwork argument order" into sc-dev 2021-04-15 15:57:43 +00:00
Treehugger Robot
f7d188c8c9 Merge "Fix CTS fail to register network callback since lack of permission" 2021-04-15 15:03:15 +00:00
junyulai
8b5e4b4b4d [VCN20.2] Change requestBackgroundNetwork argument order
Test: atest FrameworksNetTests FrameworksVcnTests
Fix: 185215095
Ignore-AOSP-First: avoid build break caused by multipatch automerge
Change-Id: I09ff7461b655cbfc6ed5a7db07e02a388cd3d079
2021-04-15 20:59:08 +08:00
Treehugger Robot
9675c9da0b Merge changes from topic "connectivitymanager-blockedreason-shim" am: bea56fbe11 am: 0cbabb7316 am: 6f7e10d3ef
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1676430

Change-Id: Icba8d6ffebafb907578e1893f0567eafdfc9dfd2
2021-04-15 10:58:31 +00:00
Treehugger Robot
333db9a5f0 Merge changes from topic "connectivitymanager-blockedreason-shim" am: bea56fbe11 am: 0cbabb7316
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1676430

Change-Id: I9f71c66d037a7e32b084951c01d46d9d01cc8f3a
2021-04-15 10:01:04 +00:00
Lorenzo Colitti
ddeb269ca0 Fix CtsNetTestCasesLatestSdk in AOSP.
This test suite is broken in AOSP due to a number of tests that
depend on S APIs. We attempted to prevent those tests running on
R builds with:

@IgnoreUpTo(Build.VERSION_CODES.R)

but this is not sufficient for them to pass when the test is
compiled against the R SDK (e.g., in CtsNetTestCasesLatestSdk).
This is because when compiling against the R SDK, the test uses
the API 30 shims, which throw UnsupportedApiLevelException even
though the method actually exists on device.

Fix this using:

    assumeTrue(shouldTestSApis());

This is not great, but at least it unbreaks the tests for now.

Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest
Test: atest CtsNetTestCasesLatestSdk:android.net.cts.ConnectivityManagerTest
Change-Id: Ifee0aea5afef6bd4bc762a4b1f25fc05e562d49a
2021-04-15 13:30:02 +09:00
Lorenzo Colitti
7ba366de0b Use the non-API static UserHandle.getUid method in tests.
The code was updated in AOSP to use the new non-static
UserHandle#getUid(int), which is only available in S or above.
This fails to build in mainline-prod. Instead of defining a shim
for this, simply use an older method that takes a userId.

Bug: 165835257
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest
Test: CtsNetTestCasesLatestSdk:android.net.cts.ConnectivityManagerTest
Change-Id: Id529f8b201cc871aa3155aef0f44574d88040c2d
2021-04-15 13:20:02 +09:00
Junyu Lai
19a7cda181 Merge "Add CTS to verify NetworkAgent#setLingerDuration" into sc-dev 2021-04-15 03:23:54 +00:00
Lorenzo Colitti
aa9db67edc Import ConnectivityManager.BLOCKED_REASON_* from ConstantsShim.
This is needed for the tests to compile in mainline-prod.

Bug: 165835257
Test: atest CtsNetTestCases:android.net.ConnectivityManagerTest
Change-Id: I32924824e9968996f379e31f1b28eb6a8f29bc5d
2021-04-15 10:25:46 +09:00
Lorenzo Colitti
52d0924665 Merge "Test ConnectivityManager module-lib APIs for VPNs and blocking." am: f6875cc583 am: 682cb315ee am: ddc265e884
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1671528

Change-Id: I17293cdf47468d634c3a6c26ea1673aa3a799b57
2021-04-14 16:59:58 +00:00
Lorenzo Colitti
fcdf0c2894 Merge "Test ConnectivityManager module-lib APIs for VPNs and blocking." am: f6875cc583 am: 682cb315ee
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1671528

Change-Id: Iaa2d6c4b497eba6a0340094294ba0c6f2ff74f04
2021-04-14 16:10:55 +00:00
junyulai
3a7d92513f Fix CTS fail to register network callback since lack of permission
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
2021-04-14 22:18:39 +08:00
junyulai
cfb2af8659 Add CTS to verify NetworkAgent#setLingerDuration
Test: this
Bug: 184227264
Fix: 184796264
Ignore-AOSP-First: prevent merge conflict
Change-Id: I77818685b2bfea499c0294874d205544161677c5
2021-04-14 20:46:20 +08:00
easoncylee
942a988249 Move CtsHostsideNetworkTests to group presubmit-large
The test config takes longer than 15mins to run. Move it to a dedicated
group for running slow presubmit Test Mapping test.

Some more context is in the referenced bug, e.g, b/174495337
The group will work exactly the same as presubmit for now.

Bug: 174654670
Bug: 174495337
Test: none
Change-Id: I7fe1286ed952a6058c56c36f28b4832947edb69f
2021-04-13 22:26:06 +08:00
Chiachang Wang
b014b5fdef Merge "Update the method based on API feedback" am: 0a5d964242 am: 80a70a3679 am: 807d7f2e41
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1671535

Change-Id: I3e3c69bbef95a6a4303a94f69dfa4415bfc1d11c
2021-04-13 13:04:56 +00:00
Chiachang Wang
807d7f2e41 Merge "Update the method based on API feedback" am: 0a5d964242 am: 80a70a3679
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1671535

Change-Id: I13071221d470bd633ef8337889b803a388bcab05
2021-04-13 11:54:13 +00:00
Lorenzo Colitti
b84176e9f9 Test ConnectivityManager module-lib APIs for VPNs and blocking.
This CL adds tests for:
- ConnectivityManager#setsetLegacyLockdownVpnEnabled
- ConnectivityManager#setRequireVpnForUids
- NetworkCallback#onBlockedStatusChanged(Network, int)

Bug: 165835257
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest
Change-Id: Ie9b73ec2a1634f3b3a3eb4d21acbe0803b77c70d
2021-04-13 17:30:49 +09:00
Paul Hu
247b7233b4 Merge "Replace FIRST_SDK_INT to DEVICE_INITIAL_SDK_INT in Connectivity" into sc-dev 2021-04-13 02:05:21 +00:00
Chiachang Wang
a31a9b6218 Update the method based on API feedback
UserHandle.getUid() is updated to a non-static API based on API
review feedback. Update the usage accordingly.

Bug: 184735865
Test: atest VpnTest
Change-Id: I884f427fae85b2b26973a0315b1ccf3d6f0824c6
2021-04-12 19:35:56 +08:00
paulhu
e0f3796bbb Replace FIRST_SDK_INT to DEVICE_INITIAL_SDK_INT in Connectivity
Replace all FIRST_SDK_INT usage in Connectivity because it has
been renamed to DEVICE_INITIAL_SDK_INT.

Bug: 184735771
Test: m CtsNetTestCases
Ignore-AOSP-First: Some files are differnet between aosp and
                   sc-dev on frameworkrs/base.
Change-Id: I2f155592b08cdbf259a00b035cacb37ca9847e72
2021-04-12 01:55:33 +00:00
Lorenzo Colitti
c7f7f5ada8 Merge changes from topic "peruidcallback-cts" am: 65bba3f6bc am: ab98c8119d am: 89d260c039
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669609

Change-Id: I0a28ee62a63c4db0494cc51f69ab0b8468401f85
2021-04-09 17:12:08 +00:00
Lorenzo Colitti
a42e82e17f Ensure the HostsideVpnTests passes with keyguard locked. am: fd3b95c1f7 am: 16d841048e am: a8f8011851
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669608

Change-Id: I707386cd46c2070762d50254629829173be80510
2021-04-09 17:12:08 +00:00
Lorenzo Colitti
02e2380c8a Add CTS tests for registerDefaultNetworkCallbackAsUid. am: ed26ffe92d am: 6cbdc19b2c am: 97384c0121
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669267

Change-Id: If16f7076f47acec463cb288f5a88c0cb7ee6de03
2021-04-09 17:12:07 +00:00
Lorenzo Colitti
89d260c039 Merge changes from topic "peruidcallback-cts" am: 65bba3f6bc am: ab98c8119d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669609

Change-Id: Ifbd2f1615f9db9c499edc7d75d2bc3865043e1dc
2021-04-09 16:45:30 +00:00
Lorenzo Colitti
a8f8011851 Ensure the HostsideVpnTests passes with keyguard locked. am: fd3b95c1f7 am: 16d841048e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669608

Change-Id: I689f8a5e5028069753d377979eee14f97e611681
2021-04-09 16:45:29 +00:00
Lorenzo Colitti
97384c0121 Add CTS tests for registerDefaultNetworkCallbackAsUid. am: ed26ffe92d am: 6cbdc19b2c
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669267

Change-Id: I6983acf968da429a0c036aa7e13a406f27ba7278
2021-04-09 16:45:27 +00:00
Lorenzo Colitti
16d841048e Ensure the HostsideVpnTests passes with keyguard locked. am: fd3b95c1f7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669608

Change-Id: Idabf4f50d54116d80dc349564bd9ab04cc7fd21a
2021-04-09 15:59:15 +00:00
Lorenzo Colitti
6cbdc19b2c Add CTS tests for registerDefaultNetworkCallbackAsUid. am: ed26ffe92d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1669267

Change-Id: Id8d968130a52d419c65a628fb93e47e5ac48c81e
2021-04-09 15:59:13 +00:00
Lorenzo Colitti
65bba3f6bc Merge changes from topic "peruidcallback-cts"
* changes:
  Cleanups to VPN hostside tests.
  Ensure the HostsideVpnTests passes with keyguard locked.
  Add CTS tests for registerDefaultNetworkCallbackAsUid.
2021-04-09 15:16:47 +00:00
junyulai
2ece9db0de Fix NetworkCallback expecting wrong network am: 2e74377464 am: cfd7518bdc
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1657299

Change-Id: I9f14fae14fcb7ed5b2e63b067e8ea14404b484a2
2021-04-09 09:38:26 +00:00
Remi NGUYEN VAN
0b137cb1aa Add back platform APIs to HostsideNetworkTestsApp
The "platform_apis: true" clause was removed by mistake and is actually
necessary.

Ignore-AOSP-First: original change not in AOSP
Fixes: 184844380
Test: atest HostsideVpnTests
Change-Id: I32bd4a7057a3eb167975fe9f51f1bc0d056c44a0
2021-04-09 04:51:16 +00:00
junyulai
2e74377464 Fix NetworkCallback expecting wrong network
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)
2021-04-09 10:16:18 +08:00
Junyu Lai
3ec79f9919 Merge "Fix NetworkCallback expecting wrong network" into sc-dev 2021-04-09 02:06:50 +00:00
Lorenzo Colitti
08b33ff7fb Cleanups to VPN hostside tests.
Use TestableNetworkCallback instead of a hand-rolled class.
Remove unnecessary runWithShellPermissionIdentity around
unregisterNetworkCallback calls.

Bug: 165835257
Test: test-only change
Change-Id: I4557dfc64136f9c0b4bdaa1248c33b13e96ba3ed
2021-04-08 22:09:10 +09:00
Lorenzo Colitti
fd3b95c1f7 Ensure the HostsideVpnTests passes with keyguard locked.
The test app used in CtsHostsideNetworkTests already dismisses
the keyguard for its own activity, but that doesn't work for the
VPN tests. This is because as soon as the VPN dialog appears, the
test activity is no longer in the foreground and the keyguard
comes back. As a result, the test cannot click on the VPN dialog.

Test: test-only change
Change-Id: I7be1d7fb46a2f9547bc5325d75b5bd5546e6dc18
2021-04-08 21:50:15 +09:00
Lorenzo Colitti
ed26ffe92d Add CTS tests for registerDefaultNetworkCallbackAsUid.
Bug: 165835257
Test: test-only change
Change-Id: Ib3266665735ee587f3f8ae82dadd1e4ca7ce4353
2021-04-08 21:44:30 +09:00
junyulai
bed32ff530 Fix NetworkCallback expecting wrong network
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
2021-04-08 18:37:26 +08:00
Chiachang Wang
f3066426bf Merge "Add framework-connectivity-test-defaults to hostside test" into sc-dev 2021-04-07 00:30:57 +00:00
Chiachang Wang
8cbbafef5e Merge "Update tests for onNetworkCreated and onNetworkDestroyed" am: 7d0e27bd7c am: d212efd8b0 am: e08cfe35ca
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1652210

Change-Id: I3b80a8a8a68f6a1ef2cab32d59cf4aae71cca645
2021-04-06 13:02:08 +00:00
Chiachang Wang
a8cf72829c Merge "Update tests for onNetworkCreated and onNetworkDestroyed" am: 7d0e27bd7c am: d212efd8b0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1652210

Change-Id: I00a93b5bf8c44ab5b05f27dc7312f2d996e1b501
2021-04-06 12:35:39 +00:00
Chiachang Wang
7d0e27bd7c Merge "Update tests for onNetworkCreated and onNetworkDestroyed" 2021-04-06 11:04:30 +00:00
Chiachang Wang
b3269df005 Merge "Ensure SSID is not exposed to apps without correct permission" am: 674a907cc4 am: c1c5f7f974 am: 0f60bf6013
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1655447

Change-Id: If7ac04aa2a7014d7154879f539b37bb12a3788ae
2021-04-06 10:04:05 +00:00