Commit Graph

155 Commits

Author SHA1 Message Date
paulhu
1957e6a0fb [TNU1.2] Add string for client number notification
Add string for client number notification

Bug: 122085773
Test: atest TetheringTests
Change-Id: Icc4e59ce3b2d8d4c1c7883c2f9d040d3ce563f09
2020-03-19 15:48:23 +08:00
Paul Hu
09bc9bf0b9 Merge "[TNU1.1]Add tethering notification strings" 2020-03-19 01:33:01 +00:00
Junyu Lai
2a17338e44 Merge "[SP25] Rename functions that add Entry conditionally" 2020-03-18 03:16:41 +00:00
paulhu
3355cc4f06 [TNU1.1]Add tethering notification strings
Add string for no upstream and cellular roaming notification.

Bug: 145629001
Bug: 147818698
Test: atest TetheringTests
Change-Id: I30f68d83344f66fb3ef77abf3f8748c3eb1276f0
2020-03-18 09:49:51 +08:00
junyulai
36a172910e [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
Merged-In: I9495a198cf247e6c79100f7ac1edcea370b071de
(cherry picked from ag/10700816)
2020-03-18 00:29:15 +00:00
Mark Chien
6d175120a0 Merge "Support static address configuration" 2020-03-17 13:26:09 +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
Anton Hansson
064ed493ce 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
Merged-In: I0ed44691b4e7080818442a9d0eb37d874f707195
2020-03-16 15:54:19 +00:00
Mark Chien
0c5f387efe Merge "Change TetheringConstants class to final" 2020-03-16 05:25:40 +00:00
Mark Chien
1d68778a35 Merge "Give tethering bluetooth privilege permission" 2020-03-16 04:46:44 +00:00
Junyu Lai
12b21035c4 Merge "[SP21] Address comments for API council review about aosp/1172143" 2020-03-16 02:41:19 +00:00
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
markchien
db2a16b8c4 Give tethering bluetooth privilege permission
Permisssion of PanService#setBluetoothTethering is change from
BLUETOOTH_ADMIN to BLUETOOTH_PRIVILEGED.
Tethering service need bluetooth privilege permission to enable
bluetooth tethering.

Bug: 146045934
Test: on/off bluetooth tethering
Change-Id: Ib87a5d5a5bb49390aa55e52713bb3539d4a52348
2020-03-13 07:06:58 +00:00
Bill Yi
97eb4abfed Import translations. DO NOT MERGE
Auto-generated-cl: translation import
Change-Id: I8c6eed7de942d3b4d67ad1205ccabf5852ef928f
2020-03-12 16:41:15 -07: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
Paul Hu
ccf6239513 Merge "[TNU01] Add Tethering notification updater" 2020-03-09 08:10:55 +00:00
Mark Chien
a24b188455 Merge "Send offload status changed callback" 2020-03-09 02:52:07 +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
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
Jiyong Park
067c45b1ee Merge "Mark updatable APEXes" 2020-02-29 15:10:24 +00:00
Jiyong Park
5c72ad41f0 Mark updatable APEXes
Mark updatable APEXes as updatable: true so that they are opted-out from
optimizations that make sense only for non-updatable modules; such as
symlinking to the libs in the system partition.

Bug: 149805758
Test: m and check that there is no symlink from the APEX to the system
partition.

Exempt-From-Owner-Approval: cherry-pick from internal

Merged-In: Idb55300a60a261c7bb6359439ed220ff51fcf06c
(cherry picked from commit 8201bdfab070fb2b93a997947095fad003060da9)
Change-Id: Idb55300a60a261c7bb6359439ed220ff51fcf06c
2020-02-29 09:18:24 +00: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
Treehugger Robot
02dd6fdfd3 Merge "tethering: transitive deps from jni_libs" 2020-02-25 22:13:19 +00:00
Treehugger Robot
9821f7e940 Merge "[SP19] Reduce log when set limit and request stats update" 2020-02-25 09:14:24 +00:00
Jooyung Han
cfea439ba4 tethering: transitive deps from jni_libs
The build system collects transtive deps from jni_libs for APKs.
No need to list them explicitly in android_app definition.

Bug: 146992436
Test: m com.android.tethering
      deapexer extract com.android.tethering.apex apex
      unzip apex/priv-app/Tethering/Tethering.apk -u apk
      ls apk/lib/arm64-v8a

Change-Id: Icba6ea3611c443cbf22ad6363d0239377d16ac9e
2020-02-25 17:35:18 +09:00
junyulai
fd4a2f0528 [SP19] Reduce log when set limit and request stats update
setLimit can be ignored if the quota is unlimited and not
changed, and the log could be omitted since it will still be
logged in HAL. Request stats update will print error log in
service if it is not correctly responded in time.

Test: atest TetheringTests
Test: manual
Fix: 149735152

Change-Id: I01c0191d5b89942fa69b167b8a6b40ed2821300b
2020-02-25 15:02:10 +08:00
Lorenzo Colitti
0f0bff0594 Merge changes I4a624ea4,I8626932e
* changes:
  Fix a logic error in IpServerTest#addRemoveipv6ForwardingRules
  Clear IPv6 forwarding rules when losing upstream or stopping.
2020-02-25 03:54:59 +00: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
markchien
9e0792f8dc Build framework-tethering against module_current
Test: build
Change-Id: Iad504f0e709daadfb4d86205c07f0faf429f5a8f
2020-02-25 00:22:44 +08:00
Lorenzo Colitti
a429d3b551 Merge "Support losing the upstream in IpServerTest." 2020-02-23 10:18:02 +00:00
Colin Cross
131380ff26 Remove liblog from Tethering jni_libs
Tethering's JNI libraries use the NDK version of liblog, it should
not package the platform version of liblog into the APK.

Bug: 149591340
Test: m checkbuild
Change-Id: If208c1078d2755907f57d7853a5c545bf12458c2
2020-02-21 14:49:40 -08: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
Chiachang Wang
1784f25df5 Use exposed permission defintion in Tethering
The permissions are checked by Tethering; mainline modules should be
able to do permission checks based on these permissions.

Bug: 135411507
Test: m
Change-Id: Ib7f2aedfaaa909bbc356196114c62af9345f2593
2020-02-21 17:50:18 +08:00
Mark Chien
e19cd8f3ab Merge "Stop exposing constructor of TetheringConstants" 2020-02-20 12:46:19 +00:00
Anton Hansson
703048d08b Merge "Stop exposing generated AIDL from Tethering" 2020-02-20 12:18:34 +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
Peter Collingbourne
9969e5dff7 Tethering: Don't crash if wifi unavailable.
r.android.com/1213016 seems to have caused the following crash on devices
without wifi:

FATAL EXCEPTION: main
Process: com.android.networkstack.process, PID: 1041
java.lang.RuntimeException: Unable to create service com.android.server.connectivity.tethering.TetheringService: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.net.wifi.WifiManager.registerSoftApCallback(java.util.concurrent.Executor, android.net.wifi.WifiManager$SoftApCallback)' on a null object reference
	at android.app.ActivityThread.handleCreateService(ActivityThread.java:4005)
	at android.app.ActivityThread.access$1500(ActivityThread.java:220)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1891)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loop(Looper.java:216)
	at android.app.ActivityThread.main(ActivityThread.java:7396)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:949)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.net.wifi.WifiManager.registerSoftApCallback(java.util.concurrent.Executor, android.net.wifi.WifiManager$SoftApCallback)' on a null object reference
	at com.android.server.connectivity.tethering.Tethering.<init>(Tethering.java:317)
	at com.android.server.connectivity.tethering.TetheringService.makeTethering(TetheringService.java:90)
	at com.android.server.connectivity.tethering.TetheringService.onCreate(TetheringService.java:81)
	at android.app.ActivityThread.handleCreateService(ActivityThread.java:3993)

Fix it by null checking wifiManager before calling a method on it.

Bug: 142352330
Change-Id: I46e2f3053a59d3dba6a186a9eed34fa63b45d03e
2020-02-19 12:55:44 -08: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
Lorenzo Colitti
9a1f9d4669 Merge "Tethering offload: add/remove IPv6 forwarding rules on ND events." 2020-02-19 13:41:10 +00:00
Lorenzo Colitti
ffd4bf34be Merge "Minimal support for IPv6 upstreams in IpServer tests." 2020-02-19 13:38:00 +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
Treehugger Robot
b23d20fea7 Merge "Reduce advertised ipv6 mtu by 16 to fit ethernet header" 2020-02-19 11:20:29 +00:00
Maciej Żenczykowski
da0fb1bca8 Reduce advertised ipv6 mtu by 16 to fit ethernet header
This is a temporary hack to workaround the inability of current
kernel's ebpf bpf_skb_change_mode() function to prefix a 14-byte
ethernet header on to a packet without going over the upstream
(source, rawip) interface's mtu *before* we bpf_redirect() to
the downstream (destination, ethernet) interface.

Test: build, atest, atest TetheringTests
Bug: 149816401
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I646148ebfd978a2489c0cd065e4b671b01150add
2020-02-19 10:44:54 +00: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
Mark Chien
5ea7a9466b Merge "Add tethering client callbacks" 2020-02-19 10:41:30 +00:00
Mark Chien
907976e0a2 Merge "Fix usage of annotations in TetheringLib" 2020-02-19 09:54:13 +00:00