Commit Graph

10244 Commits

Author SHA1 Message Date
Lorenzo Colitti
e91257ecf4 Remove dead code. am: 2422319cb7 am: 9d288a6904
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1703126

Change-Id: Ib82c7542b1fdf6d46182694a8b24147b3d7a3b25
2021-05-12 10:55:44 +00:00
Lorenzo Colitti
1a56f34c7c Remove mPublicSync. am: 94311aa902 am: c0f1bed8c5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1678387

Change-Id: Ie173e954e3ed27aebb73ebe2baefe3eff1c52556
2021-05-12 10:55:44 +00:00
Lorenzo Colitti
778d795271 Make Tethering#dump asynchronous. am: 5f729e14a3 am: c7a163bae8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1678386

Change-Id: Iab29a982cdc237140820f15edc3fe80acaca5683
2021-05-12 10:55:42 +00:00
Lorenzo Colitti
7e41d51fa4 Skip presubmit for IPsec transport mode IPv6 TCP tests. am: b54bdabe5a am: 946da7b575
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1705126

Change-Id: Icc80118b56129d435c04b9837cfa72cc68c9d74e
2021-05-12 10:55:40 +00:00
Lorenzo Colitti
9d288a6904 Remove dead code. am: 2422319cb7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1703126

Change-Id: I7c3990ac8943e30fae0508a1bda55db02e019a90
2021-05-12 10:41:17 +00:00
Lorenzo Colitti
c0f1bed8c5 Remove mPublicSync. am: 94311aa902
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1678387

Change-Id: I72b34f951a036a7baa1f1f84a55820aa10970198
2021-05-12 10:41:16 +00:00
Lorenzo Colitti
c7a163bae8 Make Tethering#dump asynchronous. am: 5f729e14a3
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1678386

Change-Id: Ifc7372870a3bf12251a909d84e1c9174531a87ec
2021-05-12 10:41:15 +00:00
Lorenzo Colitti
946da7b575 Skip presubmit for IPsec transport mode IPv6 TCP tests. am: b54bdabe5a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1705126

Change-Id: Iefb634b98f1f7e4420f40b80740eaaef4329e66e
2021-05-12 10:41:11 +00:00
Lorenzo Colitti
2422319cb7 Remove dead code.
Remove a few legacy methods that have no callers.

Test: m
Change-Id: I499e940dc98453194fc528d65a89696471ad8bdd
2021-05-12 17:35:49 +09:00
Lorenzo Colitti
94311aa902 Remove mPublicSync.
This is no longer necessary as all the methods that take it are
running on on the handler thread, either in Tethering itself or
on the state machine thread in IpServer, which runs on the same
thread as Tethering.

Specifically:
- interfaceStatusChanged, interfaceAdded, interfaceRemoved,
  interfaceLinkStateChanged: run from mNetdCallback, which always
  posts them to mHandler.
- setWifiTethering: only called by enableTetheringInternal, which
  is called by the following:
  - startTethering, stopTethering: via lambda posted to mHandler
  - IpServerCallback#requestEnableTethering: called by IpServer
    while processing a command.
- setEthernetTethering: only called by enableTetheringInternal.
- EthernetCallback: runs on mExecutor, which posts to mHandler.
- getLastTetherError: only used by the test. Renamed to
  getLastErrorForTest to ensure no other callers.
- sendTetherStateChangedBroadcast: called only by
  notifyInterfaceStateChange, which is called only by
  - IpServerCallback#updateInterfaceState, which is called only
    by sendInterfaceState, which is called by various IpServer
    state enter methods.
- notifyLinkPropertiesChanged: called only by
  IpServerCallback#updateLinkProperties, which is only called by
  IpServer#sendLinkProperties, which is only called by:
  - Code that processes CMD_IPV6_TETHER_UPDATE
  - IpServer#handleNewPrefixRequest: only called when processing
    CMD_NEW_PREFIX_REQUEST.
  - IpServer#sendInterfaceState (see above)
- handleWifiApAction, handleWifiP2pAction: only called by
  mStateReceiver, which runs on the handler thread
- tether(String, int): called by:
  - tether(String, IIntResultListener): posted to mHandler
  - changeInterfaceState: called by:
    - EthernetCallback (see above)
    - enableWifiIpServingLocked: called by handleWifiApAction and
      handleWifiP2pAction (see above)
    - tetherMatchingInterfaces: only called by handleUsbAction,
      which is run from mStateReceiver on the handler thread.
- untether(String): called by:
  - untether(String, IIntResultListener): posted to mHandler
  - changeInterfaceState (see above)
- setUsbTethering: called by:
  - setUsbTethering(boolean, IIntResultListener): posted to mHandler
  - enableTetheringInternal (see above)
- setNcmTethering: called by enableTetheringInternal (see above)
- getTetheredIfaces: called only by TetheringTest. Renamed to
  getTetheredIfacesForTest to ensure no other callers.
- getErroredIfaces: unused, deleted in this CL
- getTetheredIfaces: called by:
  - isTetheringActive: called by onUserRestrictionsChanged, which
    is only called by mStateReceiver
  - TetheringTest
- dump(): changed to run on handler thread
- upstreamWanted: called by
  - TetherModeAliveState#enter
  - TetherModeAliveState#updateUpstreamWanted, which is called
    only by TetherModeAliveState#processMessage.

Test: atest TetheringCoverageTests
Test: enabled/disabled hotspot, USB tethering
Change-Id: Id49d33f027b8df4c97fda480ff239c0ba90bb96a
2021-05-12 17:35:49 +09:00
Lorenzo Colitti
5f729e14a3 Make Tethering#dump asynchronous.
This is in preparation for removing mPublicSync.

Test: m
Test: adb shell dumpsys tethering
Test: atest TetheringTests TetheringIntegrationTests
Change-Id: Ib2c9d0bff23614f76c8e075d32cb03412d3d21f7
2021-05-12 17:35:49 +09:00
Lorenzo Colitti
b54bdabe5a Skip presubmit for IPsec transport mode IPv6 TCP tests.
These tests are currently broken due to what appears to be an
upstream regression affecting 5.10 kernels, and are causing
all networking CLs to fail presubmit.

Skip them in presubmit until the regression is fixed. The tests
will still fail when run manually or in postsubmit.

Bug: 186608065
Test: atest CtsNetTestCases:android.net.cts.IpSecManagerTest
Change-Id: Ib78e13ace62a0addddff0a2d17b7f393a4cc4f87
2021-05-12 17:35:49 +09:00
Hungming Chen
fdd9f07e20 Fix attaching program failure on kernel 5.10 am: 3c94994650 am: dc0ec70f3f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1697147

Change-Id: Ia8e6302907d0115f92cd1186ea626dd1115a131e
2021-05-06 07:30:44 +00:00
Hungming Chen
dc0ec70f3f Fix attaching program failure on kernel 5.10 am: 3c94994650
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1697147

Change-Id: I67cee508cb60f424b01c84fc729b892693905e95
2021-05-06 07:14:29 +00:00
Hungming Chen
3c94994650 Fix attaching program failure on kernel 5.10
Attach BPF program may be failed with the netlink error message
"Invalid argument". Per debug kernel trace, it is failed in
comparing the kind name in tc_new_tfilter.

Log:
05-05 19:44:42.329  1073  2332  2332 W tc_new_tfilter:
Specified filter kind does not match existing one

Test: enable usb tethering and check the follows

$ adb shell tc filter show dev <upstream, downstream> ingress
filter protocol ipv6 pref 1 bpf chain 0
filter protocol ipv6 pref 1 bpf chain 0 handle 0x1
prog_offload_schedcls_tether_upstream6_ether:[*fsobj]
direct-action not_in_hw id 3 tag 94ca9b12972fdea8
filter protocol ip pref 2 bpf chain 0
filter protocol ip pref 2 bpf chain 0 handle 0x1
prog_offload_schedcls_tether_upstream4_ether:[*fsobj]
direct-action not_in_hw id 9 tag 992aa9bfd0503457
filter protocol ipv6 pref 1 bpf chain 0
filter protocol ipv6 pref 1 bpf chain 0 handle 0x1
prog_offload_schedcls_tether_downstream6_rawip:[*fsobj]
direct-action not_in_hw id 4 tag 7fb60e556b8f3be7
filter protocol ip pref 2 bpf chain 0
filter protocol ip pref 2 bpf chain 0 handle 0x1
prog_offload_schedcls_tether_downstream4_rawip:[*fsobj]
direct-action not_in_hw id 6 tag e41426095404fb64

Change-Id: I471a2e34c626a3737cbd2754e4d1b3000bcf6ba6
2021-05-06 02:52:07 +00:00
Treehugger Robot
9662233c70 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: Ib128e298c8b695438a562e5cbb092fd04c4746c2
2021-04-27 19:32:29 +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
2200bcd2db 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: I7d74dc77ea69c68138c282af74f19dd67c38253f
2021-04-27 18:36:09 +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
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
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
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
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
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
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
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
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
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
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
Treehugger Robot
7a4a243750 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: Ie3cdcb7a7b5a4147c84f830a688b588add73ea16
2021-04-19 03:54:02 +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