Commit Graph

11626 Commits

Author SHA1 Message Date
Treehugger Robot
659bbf4f24 Merge "Add native coverage listener to tethering coverage test" am: e6bafe29b0 am: 1c4103c150
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1687651

Change-Id: I2c5465f222c89f65de9fe42272f9ee4cfc971df5
2021-04-27 19:32:38 +00:00
Treehugger Robot
1c4103c150 Merge "Add native coverage listener to tethering coverage test" am: e6bafe29b0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1687651

Change-Id: I895dd9b7c2a9fdf1f9e9dae18e54a5fe635d954f
2021-04-27 19:08:11 +00:00
Sarah Chin
db1cde3f50 Merge "Add tests for NetCapability#getCapabilityCarrierName" am: 45fa6bd811 am: 4d9f226837
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1683350

Change-Id: I306e0ba0bb52de4a408e21a26a81a327905c7d59
2021-04-27 18:35:59 +00:00
Treehugger Robot
e6bafe29b0 Merge "Add native coverage listener to tethering coverage test" 2021-04-27 18:35:29 +00:00
Sarah Chin
4d9f226837 Merge "Add tests for NetCapability#getCapabilityCarrierName" am: 45fa6bd811
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1683350

Change-Id: I90d74f4ec5f6b7bbe81862484f50fc7fb83ae134
2021-04-27 18:17:55 +00:00
Sarah Chin
45fa6bd811 Merge "Add tests for NetCapability#getCapabilityCarrierName" 2021-04-27 17:58:12 +00:00
markchien
b23e912805 Add native coverage listener to tethering coverage test
This allows the coverage tests to manually trigger native coverage
collection, as a workaround for collection not being triggered
automatically by the coverage infrastructure.

Bug: 185202279
Test: atest TetheringCoverageTests
Change-Id: I619fc267cf1743dd2218e3dd42546b0d4e9da193
2021-04-27 16:48:25 +00:00
Chiachang Wang
d4d930f937 Merge "Update APIs based on API review feedback" am: 5d4e9ee83d am: ccaf092fc0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1679670

Change-Id: Ifd55469fe2ea875345ce0b078e47ba5476310e9a
2021-04-26 01:13:03 +00:00
Chiachang Wang
ccaf092fc0 Merge "Update APIs based on API review feedback" am: 5d4e9ee83d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1679670

Change-Id: I3e2943633d520579dab8e2056fdd04e9e11448e1
2021-04-26 00:43:16 +00:00
Chiachang Wang
5d4e9ee83d Merge "Update APIs based on API review feedback" 2021-04-26 00:22:27 +00:00
Mark Chien
81cb8cf02c Merge "Release mobile request when default upstream is not mobile" am: 07f8a618d2 am: d4b21984e9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1679667

Change-Id: Id1a6fe30e93d175ba8e67bbafa05df7aa6e1f182
2021-04-23 12:23:23 +00:00
Mark Chien
d4b21984e9 Merge "Release mobile request when default upstream is not mobile" am: 07f8a618d2
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1679667

Change-Id: Iaa11651f0d1a9d3850b45962231a7232e81f229d
2021-04-23 12:01:48 +00:00
Mark Chien
07f8a618d2 Merge "Release mobile request when default upstream is not mobile" 2021-04-23 11:48:36 +00:00
markchien
d5096f504d Release mobile request when default upstream is not mobile
Some OEM may have special mobile data icon show up when non-default
(e.g. DUN) mobile connection connected even wifi is also connected.
So always connected DUN may let user hard to distinguish tethering
upstream in those OEM's devices. Also release unused mobile connection
may safe power.

This CL removes unnecessary code from selectPreferredUpstreamType.
In particular:
    - When a DUN or HIPRI upstream is selected, calling
    registerMobileNetworkRequest is unnecessary. A mobile
    NetworkRequest is always registered unless a non-mobile upstream
    is selected.

    - When a non-mobile upstream is found, releasing the mobile
    NetworkRequest is unnecessary in selectPreferredUpstreamType
    because it will be done by chooseUpstreamType immediately after
    selectPreferredUpstreamType returns.

    - When no upstream is found and cellular upstream is not permitted,
    it is not necessary to release the mobile NetworkRequest. When
    cellular is not permitted, no such NetworkRequest will be filed
    because registerMobileNetworkRequest checks with EntitlementManager
    before actually requesting the network. If cellular becomes the
    upstream and then later becomes not permitted because of an
    entitlement failure, all tethering will be stopped by Settings.

Note: currently legacy upstream selection has two known bugs:
1. If mobile has higher priority than non-mobile network, mobile request
should never be released and always prefer use mobile. But in practice,
mobile request would be released when tethering select non-mobile network
as upstream.
2. If mobile has higher priority than wifi network and default network
is wifi but mobile is still connected, tethering would choose mobile as
upstream because it has higher priority. Mobile disconnecting may not
trigger tethering to switch its upstream to wifi because currnetly
tethering rely on CONNECTIVITY_ACTION broadcast to handle upstream
disconnect.

Bug: 173068192
Test: atest TetheringTests
Change-Id: Id5df58af830cc534ecd79041ddf8a04171047e9b
2021-04-23 16:45:29 +08:00
Chiachang Wang
878ad503a9 Update APIs based on API review feedback
Update the usage in callers side for
  - Rename NetworkAgent#setTeardownDelayMs to
    NetworkAgent#setTeardownDelayMillis
  - Use getters instead of fields in VpnTransportInfo
  - Rename registerDefaultNetworkCallbackAsUid to
    registerDefaultNetworkCallbackForUid in ConnectiivityManager

Bug: 183972850
Bug: 185246410
Fix: 184735863
Test: atest FrameworksNetTests
Test: atest CtsNetTestCasesLatestSdk
Change-Id: Ie542e5ad631388d9948dd27de21bc218b5b5b8f2
Merged-In: Ie542e5ad631388d9948dd27de21bc218b5b5b8f2
2021-04-23 02:44:07 +00:00
Chiachang Wang
81fa7cc8d6 Merge "Update doc in TestUtils" am: 8027d24eaf am: 3b5fd3154a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1684726

Change-Id: Ic43358e6d0670f07acc2a5ca6e79ba346f43675f
2021-04-23 01:17:58 +00:00
Chiachang Wang
3b5fd3154a Merge "Update doc in TestUtils" am: 8027d24eaf
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1684726

Change-Id: I33f2149be5c24bfbe269f2f25bcfc25d11da22be
2021-04-23 00:50:19 +00:00
Chiachang Wang
8027d24eaf Merge "Update doc in TestUtils" 2021-04-23 00:35:27 +00:00
Sarah Chin
bae0fb30f9 Add tests for NetCapability#getCapabilityCarrierName
Test: atest ConnectivityManagerTest
Fix: 183553812
Change-Id: I60801bb86302b57f6d72ea903d98a8249fae4555
2021-04-22 17:00:57 -07:00
Treehugger Robot
367e8bdc75 Merge "Fix testKeepaliveWifiUnsupported failure" am: 3b55c68cc2 am: c856c57a92
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1684429

Change-Id: I3d81d13647a923c3c37121bc99d5238b14d94e62
2021-04-22 15:34:04 +00:00
Treehugger Robot
c856c57a92 Merge "Fix testKeepaliveWifiUnsupported failure" am: 3b55c68cc2
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1684429

Change-Id: Iabf2fd3919523abf771908f4c5a4ad6c9b2710e2
2021-04-22 15:03:36 +00:00
Treehugger Robot
3b55c68cc2 Merge "Fix testKeepaliveWifiUnsupported failure" 2021-04-22 14:40:40 +00:00
Remi NGUYEN VAN
285d3a5da7 Fix testKeepaliveWifiUnsupported failure
As a temporary measure to get the test to pass, use the
QUERY_ALL_PACKAGES permission when calling getSupportedKeepalives.
This is helps as getSupportedKeepalives obtains the configuration
from resources in the connectivity resources package, which
recently got its own non-platform certificate and is now not
visible from the test anymore.

getSupportedKeepalives is only used by tests and ConnectivityService
which has all permissions.

The actual fix should make sure getSupportedKeepalives does not require
such a permission (although getSupportedKeepalives is not a formal API),
but this will take more time and the test needs to stay green in the
meantime.

Bug: 186093901
Test: atest CtsNetTestCases
Change-Id: I288ec13a6f0840b184f1c919785724733ca56adf
2021-04-22 21:35:34 +09:00
Chiachang Wang
1230993fb4 Merge "Add test for NetworkRequest.Builder(NetworkRequest)" am: 28f3e69a25 am: 44f9593f24
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1650232

Change-Id: Id1368ca84be2b04b7d3356ecdf11d40ab21bba20
2021-04-22 10:48:51 +00:00
Chiachang Wang
44f9593f24 Merge "Add test for NetworkRequest.Builder(NetworkRequest)" am: 28f3e69a25
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1650232

Change-Id: Iff282ee441837b517bcea874a08734d6f6d1e77f
2021-04-22 10:23:31 +00:00
Chiachang Wang
d514b53eca Update doc in TestUtils
Follow up commit from aosp/1650232 to update the doc

Bug: 186061922
Test: m
Change-Id: Icb622516bc41de5cbe3112d7abd3df9d83448b32
2021-04-22 18:19:58 +08:00
Chiachang Wang
28f3e69a25 Merge "Add test for NetworkRequest.Builder(NetworkRequest)" 2021-04-22 09:58:54 +00:00
Chiachang Wang
93b807718b Add test for NetworkRequest.Builder(NetworkRequest)
Build NetworkRequest using builder from an existing
NetworkRequest is exposed to API surface, so add a test to
verify its behavior works as expectation.

Also, create a TestUtils in the cts to put the multiple
reference methods(shouldTestSApis) to prevent duplication.

Bug: 186061922
Test: atest CtsNetTestCases:android.net.cts.NetworkRequestTest
      in current sdk
Test: atest CtsNetTestCasesLatestSdk:android.net.cts.NetworkRequestTest
      in R and current sdk
Test: atest android.net.cts.ConnectivityManagerTest#\
      testRegisterNetworkCallback
Change-Id: I46318e212d51e4e13efa86e8b9c3ca7326d62b77
2021-04-22 02:30:26 +00:00
Lorenzo Colitti
f772ab1c61 Merge "Allow callers of startTethering to choose local-only mode." am: ac9ce08d45 am: af691a13b6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1674232

Change-Id: I9c88d0d05c6dbb0bac65b72e8d54df5eb25b4060
2021-04-19 14:51:21 +00:00
Lorenzo Colitti
af691a13b6 Merge "Allow callers of startTethering to choose local-only mode." am: ac9ce08d45
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1674232

Change-Id: Ifd9c2c87023711aefc314ccb92bc7cde00a83bb2
2021-04-19 14:24:46 +00:00
Lorenzo Colitti
ac9ce08d45 Merge "Allow callers of startTethering to choose local-only mode." 2021-04-19 14:10:32 +00:00
Lorenzo Colitti
8a36c297bc Allow callers of startTethering to choose local-only mode.
This is useful for OEMs that want to use RNDIS or NCM as a
local-only link that is directly connected to some other host.
This can be used to implement USB tethering using NCM, which
currently only supports local-only mode.

Bug: 175090447
Test: TetheringIntegrationTests:EthernetTetheringTest#testLocalOnlyTethering
Change-Id: I0ffaa46e4640e5b235340a15d25909106ceb0c07
2021-04-19 20:25:58 +09: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
b0e2855252 Merge "Move CtsHostsideNetworkTests to group presubmit-large" am: c3bac64a94
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1674227

Change-Id: I38dae7f191204502c9c9d2abaa9468d843763605
2021-04-19 03:32:18 +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
d1c84ae89c Merge "[VCN20.2] Change requestBackgroundNetwork argument order" am: afd18ddd57
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1676442

Change-Id: Ie99d30e70de1cf1593448629532a90b4edc2d17b
2021-04-16 16:25:55 +00:00
Junyu Lai
afd18ddd57 Merge "[VCN20.2] Change requestBackgroundNetwork argument order" 2021-04-16 16:04:31 +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
Treehugger Robot
95587e12d5 Merge "Put tether/untether calls into handler queue" am: 2576c457de am: 0ea3966a88
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1535794

Change-Id: I8525c8f800641defa45ef3e4072e6a7a8ac86c49
2021-04-15 16:04:57 +00:00
Treehugger Robot
9da7347603 Merge "Fix CTS fail to register network callback since lack of permission" am: f7d188c8c9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1674237

Change-Id: I0e849ab438734eae7e0577a463459405062d8124
2021-04-15 15:14:34 +00:00
Treehugger Robot
0ea3966a88 Merge "Put tether/untether calls into handler queue" am: 2576c457de
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1535794

Change-Id: I29be842c2faa24d4f49d3ed36eb71c047e5f1cc0
2021-04-15 15:14:23 +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
Treehugger Robot
2576c457de Merge "Put tether/untether calls into handler queue" 2021-04-15 14:46:25 +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
Treehugger Robot
0cbabb7316 Merge changes from topic "connectivitymanager-blockedreason-shim" am: bea56fbe11
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1676430

Change-Id: I6d9dc4e6fd3fa832efbafa4893cc20dccfe3d7a3
2021-04-15 08:27:32 +00:00
Treehugger Robot
bea56fbe11 Merge changes from topic "connectivitymanager-blockedreason-shim"
* changes:
  Fix CtsNetTestCasesLatestSdk in AOSP.
  Use the non-API static UserHandle.getUid method in tests.
  Import ConnectivityManager.BLOCKED_REASON_* from ConstantsShim.
2021-04-15 07:30:24 +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