Commit graph android_packages_modules_Co.../Tethering/tests
Message SHA1
TetheringManager API clean up
Per API review:
- @IntDef defined on the type integer parameter
- have getters on each parameter that is set in the
  TetheringRequest.Builder
- new added API should not be deprecated
Below APIs is moved from system-current to module-lib-current that only
plafrom code(e.g. ConnectivityManager and Settings) can use them.
TetheringRequest.
onTetherableInterfaceRegexpsChanged, TetheringInterfaceRegexps:
Only platform code can use them because interfaces by regular
expressions are a mechanism which is planning to be deprecated.

Also rename some constants for easier to understand.

Bug: 149858697
Bug: 151243337
Test: m doc-comment-check-docs
      atest TetheringTests
Change-Id: Idd041f0fbeca411ea23e49786a50dd7feb77ef45

markchien   commited 2020-03-19 16:32:37 +08:00
f1332573bb
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: I2b2dd965a673e6f1626738d41b5d443f0f9fbd0e
Merged-In: I0399917e7cefa1547d617e688225544c4fc1a231
(cherry picked from commit 5d6723e24e21154bef3967585a8adc069e007f49)

Automerger Merge Worker   authored and   markchien   commited 2020-03-19 12:39:46 +08:00
9462a3c9f0
[SP25] Rename functions that add Entry conditionally
Currently, in NetworkStats, there are many methods to manipulate
the records. However, some methods are similar and ambiguous,
such as addEntry, addValues, setValues, addIfaceValues,
combineValues and combineAllValues.

Thus, properly grouping and renaming methods are necessary.
In this change, for methods that add one record conditionally,
name them addEntry.
  addValues -> addEntry

Test: atest FrameworksNetTests ImsPhoneCallTrackerTest TetheringTests
Fix: 148895143
Change-Id: I9495a198cf247e6c79100f7ac1edcea370b071de

junyulai   authored and   Junyu Lai   commited 2020-03-17 14:59:59 +00:00
abb0596a0a
[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)

junyulai   authored and   Junyu Lai   commited 2020-03-17 14:57:59 +00:00
4aa86b782b
Merge "Cleanup the TetheredClients API" into rvc-dev
Remi NGUYEN VAN   authored and   Android (Google) Code Review   commited 2020-03-17 04:49:06 +00:00
677a3b5e92
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)

Automerger Merge Worker   authored and   Remi NGUYEN VAN   commited 2020-03-16 10:11:29 +00:00
0010ca0c70
[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)

Automerger Merge Worker   authored and   Paul Hu   commited 2020-03-12 01:42:35 +00:00
9cb35621a6
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)

Automerger Merge Worker   authored and   Mark Chien   commited 2020-03-09 07:59:29 +00:00
74f27e6f63
Merge "Fix crash and duplicated ethernet tethering request" into rvc-dev
Mark Chien   authored and   Android (Google) Code Review   commited 2020-03-09 07:51:43 +00:00
cf9a67a5db
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)

Automerger Merge Worker   authored and   Lorenzo Colitti   commited 2020-03-09 03:25:23 +00:00
f1194880cb
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)

Automerger Merge Worker   authored and   Lorenzo Colitti   commited 2020-03-09 03:02:22 +00:00
230178c6af
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)

Automerger Merge Worker   authored and   Mark Chien   commited 2020-03-09 02:02:23 +00:00
0a368b10bc
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)

Anton Hansson   commited 2020-02-22 11:05:37 +00:00
050ccee922
Merge "Tethering offload: add/remove IPv6 forwarding rules on ND events." am: 9a1f9d4669 am: 8d78f124e7 am: 2353495350
Change-Id: If7947436f2a26786f69377712ad0ff1234ac93fe

Automerger Merge Worker   commited 2020-02-19 23:12:04 +00:00
6bc4e1f98c
Merge "Minimal support for IPv6 upstreams in IpServer tests." am: ffd4bf34be am: 21d63cba5b am: 954d0c274f
Change-Id: Iba46592442663cdc9b69aa2c5cb1ea0893f8f087

Automerger Merge Worker   commited 2020-02-19 23:11:42 +00:00
696580b598
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

Lorenzo Colitti   commited 2020-02-19 20:50:43 +09:00
5e15d7b06a
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

Lorenzo Colitti   commited 2020-02-19 19:43:23 +09:00
d50b3ed6c7
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

Remi NGUYEN VAN   authored and   markchien   commited 2020-02-19 17:05:00 +08:00
b9379a518c
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

markchien   commited 2020-02-19 15:10:44 +08:00
b6ad1966c4
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

Remi NGUYEN VAN   authored and   markchien   commited 2020-02-18 13:32:16 +08:00
c8871c1b66
Merge "Fix TetheredClient and TetheredClientTest" am: 8451e20d98 am: 8ab2f58ab9 am: c8190ff316
Change-Id: I8a3d01dbd02639e07284a3dc6798c0db512c8307

Automerger Merge Worker   commited 2020-02-12 23:11:04 +00:00
545995255d
Merge "Always report non-null TetherStatesParcel" am: 8cbc588f5e am: 5aeb1cdb03 am: badf5be580
Change-Id: I4eba246b0e9093665a391624e1df95b621637e11

Automerger Merge Worker   commited 2020-02-07 11:33:51 +00:00
d070ced417
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

Remi NGUYEN VAN   commited 2020-02-07 19:55:33 +09:00
bb60ee8f10
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

markchien   commited 2020-02-07 00:27:26 +08:00
44fc26d19e
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

markchien   commited 2020-02-06 17:18:39 +08:00
f5a7c1647b
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)

Remi NGUYEN VAN   commited 2020-01-28 17:52:06 +09:00
0ef3b75ff5
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)

Milim Lee   authored and   Remi NGUYEN VAN   commited 2020-01-28 17:52:06 +09:00
45a971bd8c
Merge "Add support for Ethernet tethering"
Remi NGUYEN VAN   authored and   Android (Google) Code Review   commited 2020-01-27 13:01:29 +00:00
162e0a5d17
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

Remi NGUYEN VAN   commited 2020-01-27 19:31:08 +09:00
5c14666b09
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

Remi NGUYEN VAN   authored and   Lorenzo Colitti   commited 2020-01-24 23:39:50 +09:00
3662c1bb6d
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

markchien   authored and   Lorenzo Colitti   commited 2020-01-24 23:39:50 +09:00
f6761bdd0c
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

markchien   authored and   Lorenzo Colitti   commited 2020-01-24 23:39:49 +09:00
249752d8a3
Merge "Local Tethering with ncm interface"
Remi NGUYEN VAN   authored and   Android (Google) Code Review   commited 2020-01-24 13:59:55 +00:00
38ee05ed8f
Local Tethering with ncm interface
Bug: 130840842
Test: build, boot
      atest TetheringTest
      manual test (call startTethering(TETHERING_NCM))

Change-Id: Icc6c4d6be39e787503cecf3a5835b40d4be12a57

Milim Lee   authored and   Remi NGUYEN VAN   commited 2020-01-24 19:18:04 +09:00
97c36bc8c3
Merge "Add API for tethering clients change"
Remi NGUYEN VAN   authored and   Android (Google) Code Review   commited 2020-01-24 09:07:10 +00:00
ab7e30807e
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

Remi NGUYEN VAN   commited 2020-01-24 13:21:59 +09:00
2781c80d28
Merge "Allows the caller to specify configuration by TetheringRequest"
Remi NGUYEN VAN   authored and   Android (Google) Code Review   commited 2020-01-24 02:38:52 +00:00
ccef484ff1
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

markchien   authored and   Remi NGUYEN VAN   commited 2020-01-23 23:19:23 +09:00
ecaba161bd
Merge "Make TetheringManager to system API"
Remi NGUYEN VAN   authored and   Android (Google) Code Review   commited 2020-01-23 00:11:49 +00:00
5a22b9a22f
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

markchien   authored and   Remi NGUYEN VAN   commited 2020-01-23 00:41:59 +09:00
5786b6dc9a
Merge "p2p: revise tethering handler for shared group interface support" am: 0bbf289b09 am: bbbe6f7ba5 am: c9bde4be72
Change-Id: I512a950fc395518bc46dd99590bfdcbe3b10bed3

Automerger Merge Worker   commited 2020-01-17 21:48:36 +00:00
b499ecedc6
p2p: revise tethering handler for shared group interface support
When leaving a group, all information are erased and no group interface
is passed to tethering service.
For separate group interface, tethering could be stopped
on p2p group interface removed. For shared group interface,
i.e. management interface and group interface share one
interface, ex. p2p0, tethering has no chance to be stopped since management
interface won't be removed after leaving a group.

Bug: 141382930
Test: atest FrameworksNetTests
Test: atest FrameworksWifiTests
Test: atest TetheringTests
Change-Id: Ib611018b67c76ff79c7e6658136721090feb145b

Jimmy Chen   commited 2020-01-16 14:33:32 +08:00
ea902f6f2a
Merge "TetheringTests: Stop using @hide Wifi P2P APIs"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-01-16 05:51:49 +00:00
81369f59d2
Merge "Tethering: remove redundant source code" am: 18401e3bb0 am: 69c72da2c7 am: 00356b8d79
Change-Id: Ifb9903a985090e85d85e642bd3e6d5a1d68b6bfb

Automerger Merge Worker   commited 2020-01-15 12:34:28 +00:00
6d22290067
Merge "Tethering: remove redundant source code"
Mark Chien   authored and   Gerrit Code Review   commited 2020-01-15 11:51:07 +00:00
18401e3bb0
Merge "Allow opening tethering when data saver ON" am: 99c7c0fe87 am: 80cc1ede37 am: dbefc5e6ac
Change-Id: I24a842de6918ccd0eb1dc60161854ea25528dff5

Automerger Merge Worker   commited 2020-01-15 07:29:40 +00:00
afae2bad30
Merge "Allow opening tethering when data saver ON"
Mark Chien   authored and   Gerrit Code Review   commited 2020-01-15 06:58:29 +00:00
99c7c0fe87
Merge "Tethering: switch to use tethering package resources" am: 4cefaf8bc8 am: 01224e019f am: f1e67d5b17
Change-Id: I3f3ba0792f2ac0c4137381cbb6e49d533a136845

Automerger Merge Worker   commited 2020-01-15 06:44:39 +00:00
96d7b00caf
Merge "Tethering: switch to use tethering package resources"
Mark Chien   authored and   Gerrit Code Review   commited 2020-01-15 06:17:06 +00:00
4cefaf8bc8
Merge changes from topic "sp06-offloadcontroller" am: 01d30a4ce0 am: b61116705a am: c6a841b77b
Change-Id: I4e7924ebb2d37ecffb8facce0ec51643afb12264

Automerger Merge Worker   commited 2020-01-15 05:33:32 +00:00
4d4aaaf243