Commit Graph

205 Commits

Author SHA1 Message Date
junyulai
4aa86b782b [SP21] Address comments for API council review about aosp/1172143
Test: atest FrameworksNetTests ImsPhoneCallTrackerTest
Test: atest TetheringTests NetworkStackTests
Test: m doc-comment-check-docs
Fix: 148552904

Change-Id: I141393f229e772d2eb9f7c156849e379bd71b845
Merged-In: I141393f229e772d2eb9f7c156849e379bd71b845
(cherry picked from aosp/1253717)
2020-03-17 14:57:59 +00:00
Mark Chien
6d175120a0 Merge "Support static address configuration" 2020-03-17 13:26:09 +00:00
Remi NGUYEN VAN
677a3b5e92 Merge "Cleanup the TetheredClients API" into rvc-dev 2020-03-17 04:49:06 +00:00
markchien
f053e4b6f5 Support static address configuration
Application can specify static ipv4 server and client address to setup
tethering and this is one shot configuration. Tethering service would
not save the configuration and the configuration would be reset when
tethering stop or start failure.

When startTethering callback fired, it just mean tethering is requested
successful. Therefore, callers may call startTethering again if
startTethering successful but do not receive following tethering active
notification for a while. Tethering service never actually does anything
synchronously when startTethering is called:
  -startProvisioningIfNeeded just posts a message to the handler thread.
  -enableTetheringInternal doesn't do anything synchronously, it just
  asks the downstreams to get their interfaces ready and waits for
  callbacks.
If tethering is already enabled with a different request,
tethering would be disabled and re-enabled.

Bug: 141256482
Test: -build, flash, boot
      -atest TetheringTests
      -atest CtsTetheringTest

Change-Id: I0399917e7cefa1547d617e688225544c4fc1a231
2020-03-17 00:11:16 +08:00
Automerger Merge Worker
0010ca0c70 Cleanup the TetheredClients API
Add comments to getters as requested in API review, and remove the
expirationTime private field that was planned to be replaced with
LinkAddress expiration.

Test: atest TetheringTests
Fixes: 150878126
Change-Id: Iecf65859cdeeaac2fa7b817b4f505c510424ac89
Merged-In: Iecf65859cdeeaac2fa7b817b4f505c510424ac89
(cherry picked from commit 594d0eae38c13e2bb03de0b3ae1f8781991c321e)
2020-03-16 10:11:29 +00:00
Junyu Lai
12b21035c4 Merge "[SP21] Address comments for API council review about aosp/1172143" 2020-03-16 02:41:19 +00:00
Remi NGUYEN VAN
dfdf750417 Cleanup the TetheredClients API
Add comments to getters as requested in API review, and remove the
expirationTime private field that was planned to be replaced with
LinkAddress expiration.

Test: atest TetheringTests
Fixes: 150878126
Change-Id: Iecf65859cdeeaac2fa7b817b4f505c510424ac89
2020-03-13 19:01:15 +09:00
junyulai
5752baa6b6 [SP21] Address comments for API council review about aosp/1172143
Test: atest FrameworksNetTests ImsPhoneCallTrackerTest
Test: atest TetheringTests NetworkStackTests
Test: m doc-comment-check-docs
Fix: 148552904

Change-Id: I141393f229e772d2eb9f7c156849e379bd71b845
2020-03-12 21:34:17 +08:00
Automerger Merge Worker
9cb35621a6 [TNU01] Add Tethering notification updater
There are lots of Carrier/OEM requests for tethering
notification customization. So add a new tethering notification
updater class which can let OEM customize the behavior they
wanted.

Bug: 122085773
Test: atest TetheringTests
Change-Id: I7faacde7ac84e93ea0dfe03dd33d2cc41c589225
Merged-In: I7faacde7ac84e93ea0dfe03dd33d2cc41c589225
(cherry picked from aosp/1137358)
2020-03-12 01:42:35 +00:00
Paul Hu
ccf6239513 Merge "[TNU01] Add Tethering notification updater" 2020-03-09 08:10:55 +00:00
Automerger Merge Worker
74f27e6f63 Send offload status changed callback
The callback would be fired when offload started, stopped, or failed.
If offload is not supported, "failed" callback would be fired when user
enable tethering. Enabling multiple tethering would not have multiple
offload status callbacks because offload should already be started or
failed.

Bug: 130596697
Test: -build, flash, boot
      -atest TetheringTests
      -ON/OFF hotspotf

Change-Id: Ifb16dcedc8081833fa95a39596fe5cdc309ededd
Merged-In: Ifb16dcedc8081833fa95a39596fe5cdc309ededd
Merged-In: Ia0398601144b0e5f61dc0c5771eacf13e7cfbb59
(cherry picked from commit cd266076bed28459234c5d74ad373867944df116)
2020-03-09 07:59:29 +00:00
Mark Chien
cf9a67a5db Merge "Fix crash and duplicated ethernet tethering request" into rvc-dev 2020-03-09 07:51:43 +00:00
Automerger Merge Worker
f1194880cb Merge the following changes to tethering:
======
Fix a logic error in IpServerTest#addRemoveipv6ForwardingRules

When checking that link-local and multicast neighbours are
ignored, make sure the test neighbours are added on the correct
interface. Otherwise, they might be ignored because events on the
wrong interface are ignored, and not necessarily because
link-local and multicast neighbours are ignored.

Test: atest TetheringTests
Change-Id: I4a624ea4ce9ee9a9352afccbc7bf866587d4cdfa
======
Clear IPv6 forwarding rules when losing upstream or stopping.

Test: new unit test
Change-Id: I8626932e43e0daa300dad5fe6a81f47a6d667030
======

Bug: 149963652
Change-Id: I691053b22cb0b20e49419212f378cc473b1f35dc
(cherry picked from commit 3384bb9a4d7bd85370fe64e59f2872a5cab644d7)
2020-03-09 03:25:23 +00:00
Automerger Merge Worker
230178c6af Support losing the upstream in IpServerTest.
Allow dispatchTetherConnectionChanged to pass in a null
upstream interface and/or null LinkProperties. This will allow
future tests to check what happens when the upstream interface
goes away.

Bug: 149963652
Test: test-only change
Change-Id: I7cfc32d072f23644159d33700d6cd830c426ea19
Merged-In: I7cfc32d072f23644159d33700d6cd830c426ea19
(cherry picked from commit 62457f17e72c7ef0bee5c5bb1a04935a549b9fe6)
2020-03-09 03:02:22 +00:00
Automerger Merge Worker
0a368b10bc Fix crash and duplicated ethernet tethering request
This change fix two things:
1. Handle ethernet callback in internal thread to avoid crash. IpServer
should be created from tethering thread, otherwise mIpNeighborMonitor of
IpServer would throw
   IllegalStateException("start() called from off-thread")
2. Ethernet tethering request may be duplicated if multiple
startTethering is called but no stopTethering

Bug: 130840861
Bug: 148824036
Test: ON/OFF ethernet tehtering manually
      atest TetheringTests

Change-Id: Ibd3ea6bc6751bd65647ff381f9b0124bc3395c09
Merged-In: I7c5127e96d80d077735010d2e62c7227805ccb10
Merged-In: Ibd3ea6bc6751bd65647ff381f9b0124bc3395c09
(cherry picked from commit 72702b979654234c18045f04270040056a74cf90)
2020-03-09 02:02:23 +00:00
markchien
05bee8027d Send offload status changed callback
The callback would be fired when offload started, stopped, or failed.
If offload is not supported, "failed" callback would be fired when user
enable tethering. Enabling multiple tethering would not have multiple
offload status callbacks because offload should already be started or
failed.

Bug: 130596697
Test: -build, flash, boot
      -atest TetheringTests
      -ON/OFF hotspot
Change-Id: Ia0398601144b0e5f61dc0c5771eacf13e7cfbb59
2020-03-09 01:51:20 +00:00
paulhu
08294f9c09 [TNU01] Add Tethering notification updater
There are lots of Carrier/OEM requests for tethering
notification customization. So add a new tethering notification
updater class which can let OEM customize the behavior they
wanted.

Bug: 122085773
Test: atest TetheringTests
Change-Id: I7faacde7ac84e93ea0dfe03dd33d2cc41c589225
2020-03-09 09:20:19 +08:00
Lorenzo Colitti
048c96276b Merge "Fix crash and duplicated ethernet tethering request" 2020-02-28 02:37:45 +00:00
markchien
3849d89111 Fix crash and duplicated ethernet tethering request
This change fix two things:
1. Handle ethernet callback in internal thread to avoid crash. IpServer
should be created from tethering thread, otherwise mIpNeighborMonitor of
IpServer would throw
   IllegalStateException("start() called from off-thread")
2. Ethernet tethering request may be duplicated if multiple
startTethering is called but no stopTethering

Bug: 130840861
Bug: 148824036
Test: ON/OFF ethernet tehtering manually
      atest TetheringTests

Change-Id: I7c5127e96d80d077735010d2e62c7227805ccb10
2020-02-27 14:50:16 +08:00
Lorenzo Colitti
6c8147ea56 Fix a logic error in IpServerTest#addRemoveipv6ForwardingRules
When checking that link-local and multicast neighbours are
ignored, make sure the test neighbours are added on the correct
interface. Otherwise, they might be ignored because events on the
wrong interface are ignored, and not necessarily because
link-local and multicast neighbours are ignored.

Test: atest TetheringTests
Change-Id: I4a624ea4ce9ee9a9352afccbc7bf866587d4cdfa
2020-02-25 09:26:36 +09:00
Lorenzo Colitti
c61fc087b2 Clear IPv6 forwarding rules when losing upstream or stopping.
Test: new unit test
Change-Id: I8626932e43e0daa300dad5fe6a81f47a6d667030
2020-02-25 09:26:36 +09:00
Anton Hansson
050ccee922 Re-submit "Create all variants of stubs for wifi"
Use sdk_version: module_current instead.

This reverts commit d20f03011f95bd04bace0977d246cdc737ce5627.

Bug: 147768409
Test: m
Test: build/soong/soong_ui.bash --make-mode dist ANDROID_BUILDSPEC=vendor/google/build/app_build_spec.mk
Exempt-From-Owner-Approval: clean cp
Change-Id: I36cf007a4813027721dfb6389e10cf95085f85e4
Merged-In: I36cf007a4813027721dfb6389e10cf95085f85e4
(cherry picked from commit 21f0ed2a0aceddd4ce3dfcf792cb1ae9a144547b)
2020-02-22 11:05:37 +00:00
Lorenzo Colitti
03a734f352 Support losing the upstream in IpServerTest.
Allow dispatchTetherConnectionChanged to pass in a null
upstream interface and/or null LinkProperties. This will allow
future tests to check what happens when the upstream interface
goes away.

Test: test-only change
Change-Id: I7cfc32d072f23644159d33700d6cd830c426ea19
2020-02-21 20:23:59 +09:00
Automerger Merge Worker
6bc4e1f98c Merge "Tethering offload: add/remove IPv6 forwarding rules on ND events." am: 9a1f9d4669 am: 8d78f124e7 am: 2353495350
Change-Id: If7947436f2a26786f69377712ad0ff1234ac93fe
2020-02-19 23:12:04 +00:00
Automerger Merge Worker
696580b598 Merge "Minimal support for IPv6 upstreams in IpServer tests." am: ffd4bf34be am: 21d63cba5b am: 954d0c274f
Change-Id: Iba46592442663cdc9b69aa2c5cb1ea0893f8f087
2020-02-19 23:11:42 +00:00
Lorenzo Colitti
5e15d7b06a Tethering offload: add/remove IPv6 forwarding rules on ND events.
Use IpNeighborMonitor to listen for ND cache events on the
downstream interface, and push downstream IPv6 fowarding rules
to netd.

Rules are pushed when:
- IPv6 neighbours appear/disappear on the downstream interface.
- The upstream changes.

Test: new unit test
Change-Id: I7b01ba179a4d6bb248fd6c4994e48800613a4efa
2020-02-19 20:50:43 +09:00
Lorenzo Colitti
d50b3ed6c7 Minimal support for IPv6 upstreams in IpServer tests.
This makes the IpServer tests a bit more realistic. It is needed
by an upcoming change that adds new functionality, and is in its
own commit because it modifies the behaviour of all the existing
tests.

Test: atest TetheringTests
Change-Id: I8c3267bea983d1453c010b7b6b85548b9481a153
2020-02-19 19:43:23 +09:00
Remi NGUYEN VAN
b9379a518c Add tethering client callbacks
The callbacks are fired when the list of connected clients or their IP
addresses / hostname change.

Test: flashed, connected 2 devices, verified callbacks
Test: atest TetheringTests
Bug: 135411507
Change-Id: I96291038cf7b39a67547a5f74fcd7cbedc1ca002
Merged-In: I96291038cf7b39a67547a5f74fcd7cbedc1ca002
2020-02-19 17:05:00 +08:00
markchien
b6ad1966c4 Use framework-tethering-stub instead of framework-tethering
The non-updatable part of the platform now is built with
framework-tethering-stub, which is a stub library of
framework-tethering.

Bug: 147200698
Test: m
Change-Id: I97ef83f7f9b4c1376f373713036f5256318f1050
Merged-In: I97ef83f7f9b4c1376f373713036f5256318f1050
2020-02-19 15:10:44 +08:00
Remi NGUYEN VAN
c8871c1b66 Add tethering client callbacks
The callbacks are fired when the list of connected clients or their IP
addresses / hostname change.

Test: flashed, connected 2 devices, verified callbacks
Test: atest TetheringTests
Bug: 135411507
Change-Id: I96291038cf7b39a67547a5f74fcd7cbedc1ca002
2020-02-18 13:32:16 +08:00
Automerger Merge Worker
545995255d Merge "Fix TetheredClient and TetheredClientTest" am: 8451e20d98 am: 8ab2f58ab9 am: c8190ff316
Change-Id: I8a3d01dbd02639e07284a3dc6798c0db512c8307
2020-02-12 23:11:04 +00:00
Automerger Merge Worker
d070ced417 Merge "Always report non-null TetherStatesParcel" am: 8cbc588f5e am: 5aeb1cdb03 am: badf5be580
Change-Id: I4eba246b0e9093665a391624e1df95b621637e11
2020-02-07 11:33:51 +00:00
Remi NGUYEN VAN
bb60ee8f10 Fix TetheredClient and TetheredClientTest
- Ensure that addAddresses preserves the ordering of addresses
 - Fix assertion that was supposed to check equality of TetheredClient
   with a different tethering type, and used the same type.

Bug: 148996181
Test: atest TetheringTests
Change-Id: I86cef7b834d7ae7afa3d1d748ccac6b3a7e57ebc
2020-02-07 19:55:33 +09:00
markchien
44fc26d19e Use framework-tethering-stub instead of framework-tethering
The non-updatable part of the platform now is built with
framework-tethering-stub, which is a stub library of
framework-tethering.

Bug: 147200698
Test: m
Change-Id: I97ef83f7f9b4c1376f373713036f5256318f1050
2020-02-07 00:27:26 +08:00
markchien
f5a7c1647b Always report non-null TetherStatesParcel
Before this change, tetherStatesParcel may be null when there is no
avaialbe tethering interface yet. TetheringManager should handle null
case. But it is annoy to check null case each time and easy to have error.
Report non-null empty TetherStatesParcel object instead.

Bug: 148874619
Test: -build, flash, boot
      -atest TetheringTests
      -OFF/ON hotspot

Change-Id: I0717e7958c9409648170498d5e76322207856de3
2020-02-06 17:18:39 +08:00
Remi NGUYEN VAN
0ef3b75ff5 Add support for Ethernet tethering
Ethernet tethering can be started via
startTethering(TETHERING_ETHERNET).

Test: flashed, enabled ethernet tethering, verified internet access on
      downstream.
Bug: 130840861

Merged-In: I34842acd94b972e440c3622f7617df10c18acf65
Change-Id: I34842acd94b972e440c3622f7617df10c18acf65
(cherry-pick with conflicts in test-current.txt)
2020-01-28 17:52:06 +09:00
Milim Lee
45a971bd8c Local Tethering with ncm interface
Bug: 130840842
Test: build, boot
      atest TetheringTest
      manual test (call startTethering(TETHERING_NCM))

Merged-In: Icc6c4d6be39e787503cecf3a5835b40d4be12a57
Change-Id: Icc6c4d6be39e787503cecf3a5835b40d4be12a57
(clean cherry-pick)
2020-01-28 17:52:06 +09:00
Remi NGUYEN VAN
162e0a5d17 Merge "Add support for Ethernet tethering" 2020-01-27 13:01:29 +00:00
Remi NGUYEN VAN
5c14666b09 Add support for Ethernet tethering
Ethernet tethering can be started via
startTethering(TETHERING_ETHERNET).

Test: flashed, enabled ethernet tethering, verified internet access on
      downstream.
Bug: 130840861

Change-Id: I34842acd94b972e440c3622f7617df10c18acf65
2020-01-27 19:31:08 +09:00
Remi NGUYEN VAN
3662c1bb6d Add API for tethering clients change
Add a onClientsChanged callback to OnTetheringEventCallback.

The callback will provide information on connected clients combining
at least DHCP leases and WiFi AP information (WiFi AP tethering used).

Test: atest TetheringTests
Bug: 135411507
Change-Id: I7065d081c11bc606d691f76ac8b499dd075d6504
Merged-In: I7065d081c11bc606d691f76ac8b499dd075d6504
2020-01-24 23:39:50 +09:00
markchien
f6761bdd0c Allows the caller to specify configuration by TetheringRequest
This is initial work to allow caller to pass their prefered
configuration to start tethering. Caller may able to specify the
downstream interface ipv4 address with dhcp server disabled for
static IP configuration, or able to exempt entitlement check if
they have permission in follow up CL.

Bug: 141256482
Test: -atest TetheringTest
      -ON/OFF wifi tethering

Change-Id: Ic7c3a33195bbd7e72f9b8e73fa148be476b87bf3
Merged-In: Ic7c3a33195bbd7e72f9b8e73fa148be476b87bf3
2020-01-24 23:39:50 +09:00
markchien
249752d8a3 Make TetheringManager to system API
Also deprecated tethering APIs in ConnectivityManager.
Will have follow up change to remove @hide tethering function in
ConnectivityManager.

Bug: 145093446
Bug: 148038547
Test: -build, flash, boot
      -atest TetheringTests

Change-Id: Ia432057bf9056727c4a0ca97d160a49274d33581
Merged-In: Ia432057bf9056727c4a0ca97d160a49274d33581
2020-01-24 23:39:49 +09:00
Remi NGUYEN VAN
38ee05ed8f Merge "Local Tethering with ncm interface" 2020-01-24 13:59:55 +00:00
Milim Lee
97c36bc8c3 Local Tethering with ncm interface
Bug: 130840842
Test: build, boot
      atest TetheringTest
      manual test (call startTethering(TETHERING_NCM))

Change-Id: Icc6c4d6be39e787503cecf3a5835b40d4be12a57
2020-01-24 19:18:04 +09:00
Remi NGUYEN VAN
ab7e30807e Merge "Add API for tethering clients change" 2020-01-24 09:07:10 +00:00
Remi NGUYEN VAN
2781c80d28 Add API for tethering clients change
Add a onClientsChanged callback to OnTetheringEventCallback.

The callback will provide information on connected clients combining
at least DHCP leases and WiFi AP information (WiFi AP tethering used).

Test: atest TetheringTests
Bug: 135411507
Change-Id: I7065d081c11bc606d691f76ac8b499dd075d6504
2020-01-24 13:21:59 +09:00
Remi NGUYEN VAN
ccef484ff1 Merge "Allows the caller to specify configuration by TetheringRequest" 2020-01-24 02:38:52 +00:00
markchien
ecaba161bd Allows the caller to specify configuration by TetheringRequest
This is initial work to allow caller to pass their prefered
configuration to start tethering. Caller may able to specify the
downstream interface ipv4 address with dhcp server disabled for
static IP configuration, or able to exempt entitlement check if
they have permission in follow up CL.

Bug: 141256482
Test: -atest TetheringTest
      -ON/OFF wifi tethering

Change-Id: Ic7c3a33195bbd7e72f9b8e73fa148be476b87bf3
2020-01-23 23:19:23 +09:00
Remi NGUYEN VAN
5a22b9a22f Merge "Make TetheringManager to system API" 2020-01-23 00:11:49 +00:00
markchien
5786b6dc9a Make TetheringManager to system API
Also deprecated tethering APIs in ConnectivityManager.
Will have follow up change to remove @hide tethering function in
ConnectivityManager.

Bug: 145093446
Bug: 148038547
Test: -build, flash, boot
      -atest TetheringTests

Change-Id: Ia432057bf9056727c4a0ca97d160a49274d33581
2020-01-23 00:41:59 +09:00