Commit Graph

12035 Commits

Author SHA1 Message Date
paulhu
90255ef0a7 Add ACCESS_NETWORK_STATE to Tethering CTS
Add ACCESS_NETWORK_STATE to Tethering CTS because tests call to
EthernetManager#isAvailable() which is enforcing permission check
now. Without ACCESS_NETWORK_STATE, some tests will fail by lack
of permission.

Bug: 174573778
Test: CtsTetheringTest
Change-Id: I735d98527c14c12fb0f2df536cda25fdd84152f1
Ignore-AOSP-First: Security vulnerability issue should not fix on
                   aosp branch.
2021-04-26 06:57:46 +00:00
Chiachang Wang
a9e718f59d [automerger skipped] Merge "Update APIs based on API review feedback" am: 5d4e9ee83d am: ccaf092fc0 am: 5dba5e229a -s ours
am skip reason: skip tag Change-Id Ie542e5ad631388d9948dd27de21bc218b5b5b8f2 with SHA-1 7f46cda1aa is already in history

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1679670

Change-Id: I9eccbeb23cbe93aff034093f99d66858874a8475
2021-04-26 01:34:33 +00:00
Chiachang Wang
69f9bea5a3 [automerger skipped] Merge "Update APIs based on API review feedback" am: 5d4e9ee83d am: ccaf092fc0 am: d4d930f937 -s ours
am skip reason: skip tag Change-Id Ie542e5ad631388d9948dd27de21bc218b5b5b8f2 with SHA-1 7f46cda1aa is already in history

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1679670

Change-Id: I3d887e625035d8385a183e6e0c2a3081e3b599eb
2021-04-26 01:33:18 +00:00
Chiachang Wang
5dba5e229a 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: If730c3212ff938044fb1d7b04f57cca8df65dec2
2021-04-26 01:15:13 +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
15d5f55256 Merge "Release mobile request when default upstream is not mobile" am: 07f8a618d2 am: d4b21984e9 am: 2827638c7e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1679667

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

Change-Id: I2f5ee699fd85d5f3cad3331718a3c332a392ea67
2021-04-23 12:45:01 +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
2827638c7e 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: I6fabfeed5609677c1f5045d66c344ad33f181669
2021-04-23 12:23:18 +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
67bc25eb33 Merge "Update doc in TestUtils" am: 8027d24eaf am: 3b5fd3154a am: 81fa7cc8d6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1684726

Change-Id: I197987806ba2f5e003dc939cffe2fb79eab5bfe3
2021-04-23 01:50:31 +00:00
Chiachang Wang
786749aa60 Merge "Update doc in TestUtils" am: 8027d24eaf am: 3b5fd3154a am: 6d7a9fa2cb
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1684726

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

Change-Id: I09661d949feded17a1f1f45e660a66a73a0f1b2a
2021-04-23 01:18:10 +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
Chiachang Wang
789811f267 Merge "Update APIs based on API review feedback" into sc-dev 2021-04-23 00:30:51 +00:00
Treehugger Robot
733780fd4b Merge "Fix testKeepaliveWifiUnsupported failure" am: 3b55c68cc2 am: c856c57a92 am: 455ef41ef5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1684429

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

Change-Id: I0b12536f2247c8d360506a6cae3891148a1a5197
2021-04-22 15:54:16 +00: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
455ef41ef5 Merge "Fix testKeepaliveWifiUnsupported failure" am: 3b55c68cc2 am: c856c57a92
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1684429

Change-Id: If346d0f024f4854a7d165c3f72f035a25fb66c2b
2021-04-22 15:33:53 +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
Chalard Jean
a2755fbae3 Merge "Adjust a test for policy scoring" into sc-dev 2021-04-22 13:24:32 +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
f55413a5d9 Merge "Add test for NetworkRequest.Builder(NetworkRequest)" am: 28f3e69a25 am: 44f9593f24 am: 1230993fb4
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1650232

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

Change-Id: I5c944661cbc4ba2ae3118d1eb9cd477f858682a1
2021-04-22 11:10:11 +00: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
9f699e0815 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: I78b7cd5255202ca9ec8fe63f4cb6c728376d3e9a
2021-04-22 10:48:36 +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
Chalard Jean
d95d122e3d Adjust a test for policy scoring
Ignore-AOSP-First: This code is not in AOSP yet
Bug: 184834350
Test: this
Change-Id: Ib161503c0e6f73c5b5017ae554bbdc28ac3edb3e
2021-04-22 09:22:16 +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
Junyu Lai
e5ca854bb6 Merge changes from topic "sp32" into sc-dev
* changes:
  [SP32] Try to get 1.1 OffloadControl hardware if available
  [SP32.3] No-op refactoring of OffloadControllerTest
2021-04-21 01:45:15 +00:00
junyulai
184d458181 [SP32] Try to get 1.1 OffloadControl hardware if available
This is a no-op change that try to use 1.1 HAL if available.
Otherwise, fallback to 1.0 HAL. The change also provides version
information for subsequent patches to determine what to do for
specific version.

Test: atest TetheringTests
Bug: 149467454
Ignore-AOSP-First: avoid long automerger delay
Change-Id: I6a3ce877cdff2496087b97b191a9bfd5b0792827
2021-04-20 17:34:11 +08:00
Chiachang Wang
7f46cda1aa 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
Ignore-AOSP-First: Prevernt build break by automerger
2021-04-20 08:57:39 +00:00
junyulai
36aa3f237c [SP32.3] No-op refactoring of OffloadControllerTest
This is necessary change for minimize the code size when
repeatedly restarting OffloadController in subsequent
patches.

Test: atest TetheringTests
Bug: 149467454
Ignore-AOSP-First: avoid long automerger delay
Change-Id: I0b02d01cd8749d81c9d020dee7fdb4f80e18ae98
2021-04-20 11:26:10 +08:00
Lorenzo Colitti
5a46aa4608 Merge "Allow callers of startTethering to choose local-only mode." am: ac9ce08d45 am: af691a13b6 am: 45e5965e2f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1674232

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

Change-Id: I308835fd656b7c61d04f04b816babd0e2031df89
2021-04-19 15:21:56 +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
45e5965e2f 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: If54ea1076b0a3f51b1b6eea77f6941186a229b51
2021-04-19 14:51:13 +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