Commit Graph

241 Commits

Author SHA1 Message Date
markchien
4b896ba32b Change TetheringConstants class to final
Bug: 151322331
Test: m doc-comment-check-docs
Change-Id: Ia02be3d1d91a08ae4a56b25560ed448c96a693db
2020-03-15 22:54:57 +08: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
Anton Hansson
6a9c68b619 Create all variants of stubs for tethering
Add separate publicapi, systemapi and module_libs stubs for tethering.

Bug: 147768409
Test: m
Test: m framework-tethering-stubs-{public,system,module_libs_}api
Change-Id: I0ed44691b4e7080818442a9d0eb37d874f707195
2020-03-10 13:13:36 +00:00
Mark Chien
47f84e53b0 Merge "Send offload status changed callback" into rvc-dev 2020-03-09 09:50:20 +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
a24b188455 Merge "Send offload status changed callback" 2020-03-09 02:52:07 +00:00
Automerger Merge Worker
1adfc1cbf1 Tethering: add isTetheringSupported with callerPkg parameter
BT tethering need to know whether tethering is supported for its caller
that call isTetheringSupported in binder thread under BT's process.
Current isTetheringSupported API is getting callerPkg inside
TetheringManager that would be BT's package name for bt tethering case.
Provide isTetheringSupported(String callerPkg) for caller to pass its
caller's package name if the use case is under binder IPC.

Bug: 146915889
Test: -boot, flash, boot

Change-Id: I01646fe045772c57b4e39a5e129531f8a2cea89f
Merged-In: I01646fe045772c57b4e39a5e129531f8a2cea89f
Merged-In: I2a35e1b6851e7a799c343be0dd60da23514768ba
(cherry picked from commit e09a92fabe7956692f34e94c198d9763bf76e53d)
2020-03-09 02:42:28 +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
markchien
06ea03a6c4 Tethering: add isTetheringSupported with callerPkg parameter
BT tethering need to know whether tethering is supported for its caller
that call isTetheringSupported in binder thread under BT's process.
Current isTetheringSupported API is getting callerPkg inside
TetheringManager that would be BT's package name for bt tethering case.
Provide isTetheringSupported(String callerPkg) for caller to pass its
caller's package name if the use case is under binder IPC.

Bug: 146915889
Test: -boot, flash, boot
Change-Id: I2a35e1b6851e7a799c343be0dd60da23514768ba
2020-03-03 14:27:04 +08:00
Automerger Merge Worker
5650a2bcce Build framework-tethering against module_current
Bug: 146757305
Test: build

Change-Id: Id6051296a02060179666b67fc6ea9092273c1780
Merged-In: Id6051296a02060179666b67fc6ea9092273c1780
Merged-In: Iad504f0e709daadfb4d86205c07f0faf429f5a8f
(cherry picked from commit bb09ceaf09c8aea00a5001ba7079c13a2575e809)
2020-02-25 09:47:25 +00:00
markchien
9e0792f8dc Build framework-tethering against module_current
Test: build
Change-Id: Iad504f0e709daadfb4d86205c07f0faf429f5a8f
2020-02-25 00:22:44 +08:00
Automerger Merge Worker
8a6e5c57b1 Merge "Stop exposing constructor of TetheringConstants" am: e19cd8f3ab am: f2472fa7aa am: 051bd7f721
Change-Id: If4cf11820b0d712584e7ee393c26c7c359d7952f
2020-02-20 13:27:19 +00:00
Mark Chien
e19cd8f3ab Merge "Stop exposing constructor of TetheringConstants" 2020-02-20 12:46:19 +00:00
markchien
1bec13e963 Stop exposing constructor of TetheringConstants
Fully-static utility classes must not have constructor.

Bug: 149430003
Test: -build, flash, boot
      -atest TetheringTests

Change-Id: I18e1129ef8717211d667ccd3b4110169dd7905b4
2020-02-20 16:11:35 +08:00
Anton Hansson
e814258f09 Stop exposing generated AIDL from Tethering
We don't want new modules exposing stable aidl directly. APIs should
be defined as java @SystemApi. It also seems like nothing actually
depend on these interfaces, except one simple exception.

Bug: 147200698
Test: m
Change-Id: Ia4222fa35a9a2f3c75cebb12f75c536f27e2fe16
2020-02-19 19:03:24 +00:00
Anton Hansson
c82ea10ea2 Stop exposing generated AIDL from Tethering
We don't want new modules exposing stable aidl directly. APIs should
be defined as java @SystemApi. It also seems like nothing actually
depend on these interfaces, except one simple exception.

Bug: 147200698
Test: m
Change-Id: Ia4222fa35a9a2f3c75cebb12f75c536f27e2fe16
Merged-In: Ia4222fa35a9a2f3c75cebb12f75c536f27e2fe16
2020-02-19 16:26:05 +00: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
Remi NGUYEN VAN
293d351b7e Fix usage of annotations in TetheringLib
Annotations such as @SystemApi cannot be jarjared to a different
package, as the members would not match the system API declarations.

Instead, only build against the annotations from
framework-annotations-lib, but do not include them as classes in the
output jar; annotations are not required to be available to the
classloader at runtime.

Test: builds, boots, tethering working
Bug: 147812912
Fixes: 148609988
Change-Id: I1fae97a1c1e0ba07fa3e2d64cde7650cd26d0acd
Merged-In: I1fae97a1c1e0ba07fa3e2d64cde7650cd26d0acd
2020-02-19 16:32:26 +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
Amos Bianchi
bc47a4578b Merge "Use constant for tethering connector poll interval." 2020-02-18 20:46:25 +00: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
Mark Chien
88f04a19df Merge "Fix usage of annotations in TetheringLib" 2020-02-17 11:00:55 +00:00
Amos Bianchi
1faaf591dd Use constant for tethering connector poll interval.
A constant is defined but a literal is used instead.

Test: manual

Change-Id: I233e11af4e39a35d9a47e45066df994a9f547272
2020-02-13 16:18:47 -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
Remi NGUYEN VAN
63dc279dfc Fix usage of annotations in TetheringLib
Annotations such as @SystemApi cannot be jarjared to a different
package, as the members would not match the system API declarations.

Instead, only build against the annotations from
framework-annotations-lib, but do not include them as classes in the
output jar; annotations are not required to be available to the
classloader at runtime.

Test: builds, boots, tethering working
Bug: 147812912
Fixes: 148609988
Change-Id: I1fae97a1c1e0ba07fa3e2d64cde7650cd26d0acd
2020-02-12 03:44:16 +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
Remi NGUYEN VAN
283abc0ad4 Merge "Do not block for connector in TetheringManager" 2020-01-29 23:46:00 +00:00
Remi NGUYEN VAN
2a85986866 Do not block for connector in TetheringManager
Instead of blocking for the ITetheringConnector, in the rare case (only
on boot) that the connector is not ready, queue requests and poll for
the connector until it is available.

Bug: 146821053
Test: Flashed, verified tethering working
Change-Id: I4bd45fcbdce2336694c3b6a349f121e40230f001
2020-01-29 15:15:58 +09: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
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
Jiyong Park
1eb8933d3e Platform shouldn't directly link to jars in APEXes
The non-updatable part of the platform shouldn't directly link to the
boot jars in APEXes. Ensure this by

1) setting the visibility property for the boot jars so that they are
not visible to non-APEX modules and
2) setting the apex_available property so that the boot jars are only
built for the corresponding APEXes, but not for others.

Bug: b/146167933
Bug: b/146218515
Bug: b/147200698
Test: m
Change-Id: I251fabd773bc31f46d572d143c72dd9162f3f0a6
Merged-In: I251fabd773bc31f46d572d143c72dd9162f3f0a6
2020-01-10 15:15:24 +00:00
markchien
9b4d7577d8 Replace ConnectivityManager constants to TetheringManager
Replace some ConnectivityManager constants as TetheringManager inside
tethering module. No API change, will have follow up CL to delete
@hide tethering constants in ConnectivityManager and replace caller
to using TetheringManager.

Bug: 144753389
Test: build
Change-Id: Ia1b963669722c32d147375763205ed2f3af52fed
2020-01-08 15:06:09 +00:00
markchien
9d3538260b [Tether13] Move TetheringManager into framework
Move tethering out of ConnectivityService. All client would
use TetheringManager to talk with TetheringService directly.

Bug: 144320246
Test: -build, flash, boot
      -atest TetheringTests

Change-Id: Ib051bea724a256f9c4572b566e46ae7b9c4abe6e
Merged-In: Ib051bea724a256f9c4572b566e46ae7b9c4abe6e
2019-12-19 20:53:06 +08:00
markchien
59aa54a9b0 Protect early access before tethering ready
Bug: 145876447
Test: build, flash, boot
Change-Id: Ic40b6080a662e312e4efd7246d964710d9f07bef
2019-12-13 10:12:59 +08:00
markchien
147186daff [Tether10]Remove UserManagerInternal usage in Tethering
To be the unbundled application, tethering can not use UserManagerInternal
method anymore. Replace it by listening user restriction change intent.

Also fix some cleanup from
https://android-review.googlesource.com/c/platform/frameworks/base/+/1131002

Bug: 143195885
Test: -build, flash, boot
      -atest TetheringTests
      -manual test. Add a trigger point to call
       UserManager.setUserRestriction(DISALLOW_CONFIG_TETHERING) from
       Settings. Open hotspot -> restrict tethering from new adding trigger
       point -> hotspot is OFF and Tethering settings are not available.

Change-Id: I4ed08d20f8b7476b8ecd5d018b75806dd2f22cc1
Merged-In: I4ed08d20f8b7476b8ecd5d018b75806dd2f22cc1
2019-11-30 10:06:23 +00:00
markchien
ee6ad37837 [Tether07] Migrate Tethering into module
Now tethering would be run in dedicated service.
TetheringManager is the interface used to communicate with
TetheringService. The new call flow would be: ConnectivityManager
-> ConnectivityService -> TetheringManager -> TetheringService.
Note: the return value of #tether(), #untether() and #setUsbTethering()
APIs would always be no error. Client can use #getLastTetherError()
or #getTetheredIfaces or listen tether state change to check
status of corresponding interface.

Bug: 136040414
Bug: 144742179
Test: -build, flash, boot
      -atest TetheringTests
      -atest FrameworksNetTests

Change-Id: I7e78c0e0a3e70f940a749ba2a39ece7c7ec5b9b3
Merged-In: I7e78c0e0a3e70f940a749ba2a39ece7c7ec5b9b3
2019-11-30 10:03:08 +00:00
markchien
932da868a5 [Tether01] Add Tethering App
This is initial patch that don't contain any service for now.

Bug: 136040414
Test: -build, flash, boot
Change-Id: I0b49d7e9c3fcba5af3025163f9cc9eafb0778116
2019-10-24 13:35:41 +08:00