Commit Graph

739 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
b3289466c5 Merge "Create a builder for NetworkCapabilities." 2020-03-30 02:58:45 +00:00
Mark Chien
6d4001132d Register callback and receiver after tethering is created
Tethering service is created after boot complete which means most of
the services are ready before tethering. Once tethering register the
callback, callback event may come-in immediately. Make sure all of
tethering related object is created, then register the callback,
receiver, or listener.

Bug: 149965121
Test: atest TetheringTests
      manual on/off tethering

Change-Id: Ifdc427341db7d1313ad4b61207a96ab379d100aa
Merged-In: I3941a186770679e7b476073d774e2310e25e44c6
(cherry picked from commit 285be1ee938ddc9728ccc3e951ed0ed1b2fa7117)
2020-03-27 14:01:49 +00:00
Mark Chien
bfe7965e6b Merge "Register callback and receiver after tethering is created" am: 33788bcaac am: 01326a25c0
Change-Id: Ifc4846347326ce5e18a2f8f1ac060febc0cbd486
2020-03-27 08:55:32 +00:00
Mark Chien
33788bcaac Merge "Register callback and receiver after tethering is created" 2020-03-27 08:31:11 +00:00
markchien
e31fb9d7bd Register callback and receiver after tethering is created
Tethering service is created after boot complete which means most of
the services are ready before tethering. Once tethering register the
callback, callback event may come-in immediately. Make sure all of
tethering related object is created, then register the callback,
receiver, or listener.

Bug: 149965121
Test: atest TetheringTests
      manual on/off tethering

Change-Id: I3941a186770679e7b476073d774e2310e25e44c6
2020-03-27 08:13:28 +00:00
Treehugger Robot
a4e2383d84 Update connected clients when a downstream disappears.
Otherwise, if another downstream of the same type reappears, the
code would fire a callback with the previous list of clients.

Bug: 150644681
Test: atest TetheringIntegrationTests:EthernetTetheringTest --rerun-until-failure 100
Change-Id: I6b34ea747ae1831001077f44879bb6828dcecc96
Merged-In: I6b34ea747ae1831001077f44879bb6828dcecc96
(cherry picked from commit 3984360f642ddd5820ced5a6935e37a8ae0d9d76)
2020-03-26 05:07:06 +00:00
Treehugger Robot
595266e4a8 Add a log message if enabling Ethernet tethering if it is already enabled.
Test: builds
Bug: 150644681
Change-Id: I68123e6dd04ccae5da2ecd7526c11d9f835d1d57
Merged-In: I68123e6dd04ccae5da2ecd7526c11d9f835d1d57
(cherry picked from commit e6b8ded8121c137a7e434e1c2a9e04cc144f2f28)
2020-03-26 05:05:35 +00:00
Paul Hu
fe6c41c815 [TNU04] Add tethering restricted notification
If tethering is restricted to the user, show restricted
notification to notify the user.

Bug: 122085773
Test: atest TetheringTests
Change-Id: Ic5baca2d6102886f4c3530ce1e321b5dab6ea9d7
Merged-In: Ic5baca2d6102886f4c3530ce1e321b5dab6ea9d7
(cherry picked from aosp/1188867)
2020-03-26 02:01:37 +00:00
Paul Hu
71007d31b5 [TNU03] Add TetheringNotificationUpdaterTest
Add new test for TetheringNotificationUpdater

Bug: 122085773
Bug: 130596698
Test: atest TetheringTests
Change-Id: I0db3df3e85dd6a8c3989c8bc66a06c50f45a0c15
Merged-In: I0db3df3e85dd6a8c3989c8bc66a06c50f45a0c15
(cherry picked from aosp/1209985)
2020-03-26 01:59:15 +00:00
Treehugger Robot
b989c19abf Merge "Update connected clients when a downstream disappears." am: 22e8c3350b am: bd69be52b1
Change-Id: I542acb7f50b1891b89f5fe495c3f58456dbd8d91
2020-03-25 15:32:41 +00:00
Treehugger Robot
22e8c3350b Merge "Update connected clients when a downstream disappears." 2020-03-25 15:00:43 +00:00
Paul Hu
e4beb93149 [TNU02] Update tethering notification by active data subid
Tethering notification can be customized by different subid. Thus
update notification when active data subid changed.

Bug: 122085773
Bug: 130596698
Test: atest TetheringTests
Change-Id: I799d713326cfbf4dc96c712c6b15ed5a4ac18dd2
Merged-In: I799d713326cfbf4dc96c712c6b15ed5a4ac18dd2
(cherry picked from aosp/1209984)
2020-03-25 13:47:48 +00:00
Lorenzo Colitti
ca071b79cd Update connected clients when a downstream disappears.
Otherwise, if another downstream of the same type reappears, the
code would fire a callback with the previous list of clients.

Bug: 150644681
Test: atest TetheringIntegrationTests:EthernetTetheringTest --rerun-until-failure 100
Change-Id: I6b34ea747ae1831001077f44879bb6828dcecc96
2020-03-25 22:14:46 +09:00
Paul Hu
5ea31650ae Merge "[TNU04] Add tethering restricted notification" am: 255565e839 am: 7696642a8c
Change-Id: Iad59bdf6b3c5b3ce059d7c01c7396866aab85767
2020-03-25 12:03:10 +00:00
Paul Hu
255565e839 Merge "[TNU04] Add tethering restricted notification" 2020-03-25 11:30:41 +00:00
Paul Hu
ff89f2fd43 Merge "[TNU03] Add TetheringNotificationUpdaterTest" am: 18c34694f9 am: 493d3a833c
Change-Id: I1085dceb190b32122416d0240275d7ecb81aa627
2020-03-25 07:15:31 +00:00
Paul Hu
18c34694f9 Merge "[TNU03] Add TetheringNotificationUpdaterTest" 2020-03-25 06:45:14 +00:00
Paul Hu
357c0fcf14 Merge "[TNU02] Update tethering notification by active data subid" am: 8a47935fca am: 7135a19540
Change-Id: I2e1555972d9217fa689b10b23525fa5ba12c373b
2020-03-25 05:37:05 +00:00
Paul Hu
8a47935fca Merge "[TNU02] Update tethering notification by active data subid" 2020-03-25 04:53:32 +00:00
Chalard Jean
69286a3791 Create a builder for NetworkCapabilities.
Bug: 151322799
Test: FrameworksWifiTests
Change-Id: I69c00c9e3963950e55d7105d8825f7d3a3ec9b2f
Merged-In: I06eb97e50d5583579b3c26d1365d2dbaec8bfc99
(cherry picked from commit 9771f34dae9cdeb857636cac2b3c2d473713914e)
2020-03-25 13:27:04 +09:00
Chalard Jean
dd9c1f56fc Merge "Expose netId by adding getter API" 2020-03-25 02:23:03 +00:00
Treehugger Robot
46e3a9caf6 Merge "Add a log message if enabling Ethernet tethering if it is already enabled." am: 93a404041d am: 232904e22b
Change-Id: Ibe0d3567185b4dfbfd73d085080ca90594120c1f
2020-03-24 15:23:51 +00:00
Lorenzo Colitti
6976fae02e Add a log message if enabling Ethernet tethering if it is already enabled.
Test: builds
Bug: 150644681
Change-Id: I68123e6dd04ccae5da2ecd7526c11d9f835d1d57
2020-03-24 13:28:53 +00:00
markchien
58e3896aa8 Expose netId by adding getter API
Bug: 151156820
Test: m
      atest TetetheringTests

Clean CP from ag/10747732

Change-Id: Ieb1483c146aa2f7d8f251157e6e81d71c44ae899
Merged-In: Ieb1483c146aa2f7d8f251157e6e81d71c44ae899
2020-03-24 09:19:26 +00:00
paulhu
972f031fa5 [TNU04] Add tethering restricted notification
If tethering is restricted to the user, show restricted
notification to notify the user.

Bug: 122085773
Test: atest TetheringTests
Change-Id: Ic5baca2d6102886f4c3530ce1e321b5dab6ea9d7
2020-03-24 16:45:02 +08:00
paulhu
769e00cad2 [TNU03] Add TetheringNotificationUpdaterTest
Add new test for TetheringNotificationUpdater

Bug: 122085773
Bug: 130596698
Test: atest TetheringTests
Change-Id: I0db3df3e85dd6a8c3989c8bc66a06c50f45a0c15
2020-03-24 15:35:05 +08:00
paulhu
7bfbe253d7 [TNU02] Update tethering notification by active data subid
Tethering notification can be customized by different subid. Thus
update notification when active data subid changed.

Bug: 122085773
Bug: 130596698
Test: atest TetheringTests
Change-Id: I799d713326cfbf4dc96c712c6b15ed5a4ac18dd2
2020-03-24 14:31:03 +08:00
Remi NGUYEN VAN
1cd0dcc4a9 Merge changes from topic "netstack_constant_cherrypick"
* changes:
  Remove usage of Context.NETWORK_STACK_SERVICE
  Remove NETWORK_STACK_SERVICE constant
2020-03-23 03:33:58 +00:00
Remi NGUYEN VAN
fd50cff7c6 Remove usage of Context.NETWORK_STACK_SERVICE
The NetworkStack.getService() API should be used instead.

Bug: 151243982
Test: atest FrameworksNetTests TetheringTests
      Manual tethering test
Merged-In: I7855090bffbe895c8349ad4903b8f2eb55515f0b
(clean cherry-pick from internal branch)

Change-Id: If4af2846a82605e828287a9a4680d5547b76b802
2020-03-23 11:29:06 +09:00
Junyu Lai
6bf64c655b Merge "Expose netId by adding getter API" into rvc-dev am: cf99dc2717
Change-Id: I826f8a561b2bd0f456302247f90d26ffc42c42df
2020-03-20 11:23:27 +00:00
Chalard Jean
1f83e37fa1 Create a builder for NetworkCapabilities. am: db3d568139
Change-Id: I3d7a595d25b65ff4f5762c83a3dfc82c0f5ddc2d
2020-03-20 11:08:52 +00:00
Junyu Lai
0fb2814388 Merge "Create a builder for NetworkCapabilities." into rvc-dev 2020-03-20 11:03:47 +00:00
Junyu Lai
cf99dc2717 Merge "Expose netId by adding getter API" into rvc-dev 2020-03-20 11:03:05 +00:00
Mark Chien
9bfe7f7b3e Merge "TetheringManager API clean up" 2020-03-19 16:09:21 +00:00
Treehugger Robot
2dd2453ae0 Merge "Move NetworkCallback to last parameter for new exposed requestNetwork" 2020-03-19 15:51:32 +00:00
Treehugger Robot
4f0eb16c41 Release the interface request when Ethernet tethering is stopped.
When the Ethernet interface becomes unavailable (e.g., because
the cable was unplugged or the interface was removed), or when
setEthernetTethering(false) is called, release the Ethernet
interface request.

This ensures that:
- The Ethernet interface immediately becomes available for use in
  client mode.
- If an interface later becomes available, tethering is not
  automatically started. This is consistent with what happens for
  other downstream types such as wifi and USB. Evey time one of
  those downstreams goes down, tethering is stopped and will not
  be restarted.

Test: manual
Bug: 148824036
Change-Id: Iaf85e800569f2e08c39f7ebb96f8aa34f6e53133
Merged-In: Iaf85e800569f2e08c39f7ebb96f8aa34f6e53133
(cherry picked from commit e54c92e5657abe2ce5da9dcba76b89c5e540cc44)
2020-03-19 15:40:40 +00:00
Treehugger Robot
a85874d67a Merge "Release the interface request when Ethernet tethering is stopped." am: 0cc7c00396 am: beac7a732f
Change-Id: I448662a926fe797f30fe45a9de5072023fb769a6
2020-03-19 15:23:45 +00:00
TreeHugger Robot
f80f541d16 Merge "Move NetworkCallback to last parameter for new exposed requestNetwork" into rvc-dev 2020-03-19 13:40:51 +00:00
Lorenzo Colitti
d44de5a624 Release the interface request when Ethernet tethering is stopped.
When the Ethernet interface becomes unavailable (e.g., because
the cable was unplugged or the interface was removed), or when
setEthernetTethering(false) is called, release the Ethernet
interface request.

This ensures that:
- The Ethernet interface immediately becomes available for use in
  client mode.
- If an interface later becomes available, tethering is not
  automatically started. This is consistent with what happens for
  other downstream types such as wifi and USB. Evey time one of
  those downstreams goes down, tethering is stopped and will not
  be restarted.

Test: manual
Bug: 148824036
Change-Id: Iaf85e800569f2e08c39f7ebb96f8aa34f6e53133
2020-03-19 22:35:28 +09:00
Chalard Jean
db3d568139 Create a builder for NetworkCapabilities.
Bug: 151322799
Test: FrameworksWifiTests
Change-Id: I06eb97e50d5583579b3c26d1365d2dbaec8bfc99
2020-03-19 21:55:57 +09:00
markchien
ec0b68d491 Move NetworkCallback to last parameter for new exposed requestNetwork
Bug: 151243698
Test: atest TetheringTests
Change-Id: I87ef1d451eefa6998b9793c4eacabae978376d24
Merged-In: I87ef1d451eefa6998b9793c4eacabae978376d24
2020-03-19 11:36:07 +00:00
markchien
8146b56d01 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: I45cb21d5bc919f6d32c42650326597d5173ea028
Merged-In: Idd041f0fbeca411ea23e49786a50dd7feb77ef45
2020-03-19 19:32:50 +08:00
markchien
ac580f9826 Move NetworkCallback to last parameter for new exposed requestNetwork
Bug: 151243698
Test: atest TetheringTests
Change-Id: I87ef1d451eefa6998b9793c4eacabae978376d24
2020-03-19 19:10:23 +08:00
markchien
f1332573bb 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
2020-03-19 16:32:37 +08:00
markchien
dc651f03da Expose netId by adding getter API
Bug: 151156820
Test: m
      atest TetetheringTests
Change-Id: Ieb1483c146aa2f7d8f251157e6e81d71c44ae899
(cherry picked from commit 8831c4b54178753013d568c0b76bbf7487db8122)
2020-03-19 15:57:31 +09:00
Automerger Merge Worker
9462a3c9f0 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)
2020-03-19 12:39:46 +08:00
Remi NGUYEN VAN
06b45ca764 Merge changes from topic "netstack_api_review" into rvc-dev
* changes:
  Remove usage of Context.NETWORK_STACK_SERVICE
  Remove NETWORK_STACK_SERVICE constant
2020-03-19 01:21:29 +00:00
markchien
245352ed07 Assign specific client address to dhcp server
Bug: 141256482
Test: manual
      atest TetheringTests

Change-Id: Ief76c98c843ba5420224cbf0f34464f366c891b7
2020-03-19 01:47:25 +08:00
Remi NGUYEN VAN
b8fecf4b32 Remove usage of Context.NETWORK_STACK_SERVICE
The NetworkStack.getService() API should be used instead.

Bug: 151243982
Test: atest FrameworksNetTests TetheringTests
      Manual tethering test
Change-Id: I7855090bffbe895c8349ad4903b8f2eb55515f0b
2020-03-18 18:31:39 +09:00
Junyu Lai
2a17338e44 Merge "[SP25] Rename functions that add Entry conditionally" 2020-03-18 03:16:41 +00:00