Commit Graph

205 Commits

Author SHA1 Message Date
Treehugger Robot
5da1070d8f Assign specific client address to dhcp server
Bug: 141256482
Test: manual
      atest TetheringTests

Merged-In: Ief76c98c843ba5420224cbf0f34464f366c891b7
Change-Id: Ief76c98c843ba5420224cbf0f34464f366c891b7
2020-04-10 10:03:20 +00:00
Paul Hu
fab349c0a9 Address aosp/1274403 leftover comment
Bug: 152828142
Test: atest EntitlementManagerTest

Change-Id: I81f2d268c9f26bc4488b06032477a73d071f73f8
Merged-In: I81f2d268c9f26bc4488b06032477a73d071f73f8
(cherry picked from commit 9fe0a868e909a4cd1c1c63bf981441f1b9128890)
2020-04-09 02:13:32 +00:00
Automerger Merge Worker
b33911c19c Fix TetheringIntegrationTests failure
Bug: 150644681
Test: atest TetheringIntegrationTests
Change-Id: I5a537eca9b1aab3694a11a2dab147a31f289314c
Merged-In: I5a537eca9b1aab3694a11a2dab147a31f289314c
(cherry picked from commit f626b8a5388746d163600a5eccb60e22cb1071bf)
2020-04-08 08:17:20 +00:00
Paul Hu
9f33a5a7d9 Merge "Address aosp/1274403 leftover comment" 2020-04-08 07:36:35 +00:00
Paul Hu
77f43e56ef Merge "Fix TetheringIntegrationTests failure" 2020-04-08 06:12:29 +00:00
paulhu
eaa2b0e30a Address aosp/1274403 leftover comment
Bug: 152828142
Test: atest EntitlementManagerTest

Change-Id: I81f2d268c9f26bc4488b06032477a73d071f73f8
2020-04-08 11:45:08 +08:00
paulhu
d584d2fa36 Fix TetheringIntegrationTests failure
Bug: 150644681
Test: atest TetheringIntegrationTests
Change-Id: I5a537eca9b1aab3694a11a2dab147a31f289314c
2020-04-08 09:57:57 +08:00
Mark Chien
47c8b0f87e Add TetheringServiceTest unitest
Bug: 145490751
Test: atest TetheringTests

Change-Id: Ia9e3232467c7db0e566cced84f3c72bbcd6512d6
Merged-In: I68cd403302848c041444e6d47652435d67f59273
(cherry picked from commit 790a4dd7d3aa813f15fe95c5bf3cef6dd734ce32)
2020-04-08 01:02:39 +00:00
Mark Chien
7e0920903b Merge "Add TetheringServiceTest unitest" 2020-04-07 15:39:38 +00:00
Mark Chien
8caf921dc8 Merge "Add IPv6TetheringCoordinator unit test" into rvc-dev 2020-04-07 07:50:40 +00:00
Paul Hu
aaf92e5165 Merge "Fix EntitlementManager issues" into rvc-dev 2020-04-07 04:37:30 +00:00
Mark Chien
5e9e0337c5 Add IPv6TetheringCoordinator unit test
Bug: 148636687
Test: atest IPv6TetheringCoordinatorTest

Change-Id: I1ba30bb524cbc0cc2782ce1702f9889c0d8a7576
Merged-In: I939323ce09adb9c66b1e2b83d58b0f892aa8f011
(cherry picked from commit 368c56dd7133d292c5f3ab5942016bb4dd1fbc88)
2020-04-07 04:33:24 +00:00
Lorenzo Colitti
7f6ab40294 Add a test for static IPv4 address tethering configuration.
Bug: 150644681
Test: test-only change
Merged-In: I8f4a99da2351fdb5467f561a9732b14a8ebf674b
Change-Id: I8f4a99da2351fdb5467f561a9732b14a8ebf674b
2020-04-07 02:21:00 +00:00
Lorenzo Colitti
46b44053da Use CompletableFuture instead of a latch.
Addresses review comments on aosp/1260100.

Bug: 150644681
Test: test-only change
Merged-In: Ia73ba8a121a3744a5e36795d2d2bff2f099c1394
Change-Id: Ia73ba8a121a3744a5e36795d2d2bff2f099c1394
2020-04-07 02:20:35 +00:00
Paul Hu
bd8d7a8208 Fix EntitlementManager issues
1. Add TETHERING_ETHERNET to vaild downstream type. So starting
   ethernet tethering will do entitlement check as well.
2. Ignore request with invalid downstream type on
   handleRequestLatestTetheringEntitlementValue()

Bug: 152828758
Bug: 152828142
Test: atests TetheringTests CtsTetheringTest

Change-Id: Id0cb59cc4681f5ffbde7be54de05a05e46f0ffb8
Merged-In: Id0cb59cc4681f5ffbde7be54de05a05e46f0ffb8
(cherry picked from commit c502e050fd9543e8bde45014dd66ea1be91c90ef)
2020-04-07 01:23:49 +00:00
Lorenzo Colitti
e6107d2466 Migrate to TetherOffloadRuleParcel in IpServer
The netd tethering offload IPCs are changing from taking a list
of primitives to taking a TetherOffloadRuleParcel. Modify their
only caller.

Bug: 140541991
Test: atest IpServerTest
Merged-In: I83718c80ef9d31199c87021b4dd5821717fd5ba5
Change-Id: I83718c80ef9d31199c87021b4dd5821717fd5ba5
2020-04-06 15:45:58 +00:00
Mark Chien
7b4fb08444 Merge "Add IPv6TetheringCoordinator unit test" 2020-04-06 15:25:37 +00:00
markchien
1b39a10c21 Add IPv6TetheringCoordinator unit test
Bug: 148636687
Test: atest IPv6TetheringCoordinatorTest
Change-Id: I939323ce09adb9c66b1e2b83d58b0f892aa8f011
2020-04-06 18:25:41 +08:00
Lorenzo Colitti
b22a70d7c8 Merge "Migrate to TetherOffloadRuleParcel in IpServer" 2020-04-06 08:40:51 +00:00
Paul Hu
943af02d92 Merge "Fix EntitlementManager issues" 2020-04-06 07:33:26 +00:00
markchien
e96f42d27b Add TetheringServiceTest unitest
Bug: 145490751
Test: atest TetheringTests
Change-Id: I68cd403302848c041444e6d47652435d67f59273
2020-04-06 12:02:17 +08:00
Lorenzo Colitti
beb28405b1 Migrate to TetherOffloadRuleParcel in IpServer
The netd tethering offload IPCs are changing from taking a list
of primitives to taking a TetherOffloadRuleParcel. Modify their
only caller.

Bug: 140541991
Test: atest IpServerTest
Change-Id: I83718c80ef9d31199c87021b4dd5821717fd5ba5
2020-04-04 16:24:58 +09:00
Lorenzo Colitti
cfd82d4361 Add a test for static IPv4 address tethering configuration.
Bug: 150644681
Test: test-only change
Change-Id: I8f4a99da2351fdb5467f561a9732b14a8ebf674b
2020-04-03 10:47:47 +09:00
Lorenzo Colitti
57827f67e0 Merge "Add an Ethernet tethering test." into rvc-dev 2020-04-01 03:56:28 +00:00
paulhu
4175676eab Fix EntitlementManager issues
1. Add TETHERING_ETHERNET to vaild downstream type. So starting
   ethernet tethering will do entitlement check as well.
2. Ignore request with invalid downstream type on
   handleRequestLatestTetheringEntitlementValue()

Bug: 152828758
Bug: 152828142
Test: atests TetheringTests CtsTetheringTest

Change-Id: Id0cb59cc4681f5ffbde7be54de05a05e46f0ffb8
2020-03-31 18:01:54 +08:00
Treehugger Robot
037becbf64 Merge "Assign specific client address to dhcp server" 2020-03-30 03:38:46 +00:00
Lorenzo Colitti
0a61e95319 Use CompletableFuture instead of a latch.
Addresses review comments on aosp/1260100.

Bug: 150644681
Test: test-only change
Change-Id: Ia73ba8a121a3744a5e36795d2d2bff2f099c1394
2020-03-27 23:51:48 +09: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
Lorenzo Colitti
eb73310727 Add an Ethernet tethering test.
This test uses EthernetManager's ability to use test network
interfaces to test tethering. This provides a fairly realistic
integration test for Tethering and its callbacks, IpServer and
DhcpServer, and so on.

It is in a new integration/ directory under Tethering because I
didn't really know where to put it. It's fast enough to run in
presubmit, but it didn't seem to be appropriate to call it a
unit test, and in the future we could also use this test to do
some limited testing of real Ethernet tethering as well.

Bug: 150644681
Test: atest TetheringIntegrationTests:EthernetTetheringTest --rerun-until-failure 100
Merged-In: Ifcda70b73848b1fd4c26b031e53f0a6500cc93d4
Change-Id: Ifcda70b73848b1fd4c26b031e53f0a6500cc93d4
2020-03-27 11:39:50 +00:00
Lorenzo Colitti
cdd0dabe09 Merge "Add an Ethernet tethering test." 2020-03-27 10:37:18 +00:00
Mark Chien
33788bcaac Merge "Register callback and receiver after tethering is created" 2020-03-27 08:31:11 +00:00
Lorenzo Colitti
4896e3200f Add an Ethernet tethering test.
This test uses EthernetManager's ability to use test network
interfaces to test tethering. This provides a fairly realistic
integration test for Tethering and its callbacks, IpServer and
DhcpServer, and so on.

It is in a new integration/ directory under Tethering because I
didn't really know where to put it. It's fast enough to run in
presubmit, but it didn't seem to be appropriate to call it a
unit test, and in the future we could also use this test to do
some limited testing of real Ethernet tethering as well.

Bug: 150644681
Test: atest TetheringIntegrationTests:EthernetTetheringTest --rerun-until-failure 100
Change-Id: Ifcda70b73848b1fd4c26b031e53f0a6500cc93d4
2020-03-27 17:16:30 +09: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
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
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
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
Mark Chien
9bfe7f7b3e Merge "TetheringManager API clean up" 2020-03-19 16:09:21 +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
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
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
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
Junyu Lai
2a17338e44 Merge "[SP25] Rename functions that add Entry conditionally" 2020-03-18 03:16:41 +00: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
junyulai
abb0596a0a [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
2020-03-17 14:59:59 +00:00