156 Commits

Author SHA1 Message Date
Paul Hu
428a847981 Merge "[TNU09] Adjust restricted notification" 2020-04-23 07:50:34 +00:00
paulhu
f8d6163cab [TNU09] Adjust restricted notification
1. Let restricted notification that can be dismissed.
2. Only put up restricted notification when any of tethering is
   activating.

Bug: 154214549
Test: atest TetheringTests
Change-Id: Ib980aca154036828abdab35e3bb11d42f85ff610
2020-04-23 00:17:28 +08:00
Paul Hu
97e28ae76d Merge "Add TetheredClient tests" 2020-04-22 15:22:32 +00:00
Philip P. Moltmann
da8697a48b Merge "Set attributionTag for noteOp(WRITE_SETTINGS) calls" 2020-04-22 14:58:13 +00:00
Paul Hu
bbb5a3c7f7 Merge "Add TetheringCommonTests" 2020-04-22 12:46:39 +00:00
Mark Chien
467f0b0cca Merge "Include NetworkStaticLibTestsLib into tethering coverage test" 2020-04-22 08:51:23 +00:00
paulhu
b908f04f53 Add TetheredClient tests
Test APIs below:
getAddresses()
getMacAddress()
getTetheringType()
AddressInfo.getAddress()
AddressInfo.getHostname()
AddressInfo.writeToParcel(android.os.Parcel, int)

Bug: 153614365
Bug: 153613717
Test: atest TetheringTests
Change-Id: Ic7cbebe54a38af5b5c4639eb7641a20de6864a26
2020-04-22 16:32:58 +08:00
paulhu
bf0d419301 Add TetheringCommonTests
Bug: 153614365
Bug: 153613717
Test: atest TetheringTests TetheringCoverageTests
Change-Id: If7c933ec0c72943312cd37bfc66918f10a5504a9
2020-04-22 16:15:33 +08:00
markchien
25fff15879 Include NetworkStaticLibTestsLib into tethering coverage test
Bug: 148636687
Test: atest NetworkStaticLibTests
Test: atest TetheringCoverageTests
Change-Id: I8cd9dbc9fe163583ff1d016c9262546949105b80
2020-04-21 09:50:28 +00:00
Philip P. Moltmann
6bb9c7bdc4 Set attributionTag for noteOp(WRITE_SETTINGS) calls
Test: atest FrameworksNetTests TetheringTests:TetheringServiceTest
Bug: 136595429
Merged-In: I33f787644c44d7b0e5ce17a433820cfcd985cdfb
Change-Id: Ic3d937e7bb5141798234ed5b2852c1f768e97495
2020-04-20 18:00:03 -07:00
paulhu
d954d2cd7c [TNU08] Remove the "tethering is on" notification
All carriers discarded the requirement to put up a standing
notification when tethering is on. Thus, remove the "tethering
is on" notification.

Bug: 154438388
Test: atest TetheringTests
Change-Id: Ife3915837b6b7b83d3eaaa84b71b6409ff37b71c
2020-04-20 16:10:08 +08:00
paulhu
f98918fc2c [TNU06] Add roaming notification
Warn user of potential data charges if the backhaul is
cellular and user is roaming.

Bug: 145629001
Test: atest TetheringTests
Change-Id: I74b4f87c2f6aad09e05d3f2a779f880396885953
2020-04-17 21:25:54 +08:00
Paul Hu
0ca532a78c Merge "[TNU05.1] Address aosp/1237036 leftover comments" 2020-04-16 08:25:24 +00:00
paulhu
dc5c86ddd9 [TNU05.1] Address aosp/1237036 leftover comments
Bug: 147818698
Test: atest TetheringTests
Change-Id: Ife738339aeae00d2063fea6918b50204daef24fc
2020-04-16 14:39:12 +08:00
Paul Hu
8e8224c97b Merge "Add TetheringCoverageTests" 2020-04-16 06:00:07 +00:00
paulhu
1b404e56ae Add TetheringCoverageTests
Bug: 148636687
Test: atest TetheringCoverageTests
      atest TetheringTests
      atest TetheringIntegrationTests
      atest NetworkStackTests
      atest CtsTetheringTest
Change-Id: I1f2a50f16894b05e988476520ba25baba0b60d88
Merged-In: I1f2a50f16894b05e988476520ba25baba0b60d88
2020-04-15 00:50:01 +00:00
paulhu
481512a6b0 [TNU05] Add no upstream notification
Reminder user of unavailable tethering status if there is no
internet access.

Bug: 147818698
Test: atest TetheringTests
Change-Id: Ic6557f9f7703337596100cd6a477fd7239217166
2020-04-15 01:25:37 +08:00
Lorenzo Colitti
17917f7bb0 Merge "Don't crash when receiving an RTM_DELNEIGH or NUD_FAILED." 2020-04-14 08:22:30 +00:00
Lorenzo Colitti
210ac1e145 Don't crash when receiving an RTM_DELNEIGH or NUD_FAILED.
These events don't have MAC addresses, so the code attempts to
create an Ipv6ForwardingRule with a null MAC address. This
crashes when attempting to get the raw MAC address bytes to send
to netd in the TetherOffloadRuleParcel.

This was not caught by unit tests because the test exercise this
code path in a way that is not correct (by sending RTM_DELNEIGH
and NUD_FAILED events with MAC addresses). Fix the unit tests to
properly pass in null MAC addresses for these events.

Bug: 153697068
Test: fixed existing tests to be more realistic
Change-Id: I26d89a81f1c448d9b4809652b079a5f5eace3924
2020-04-14 15:02:17 +09:00
markchien
711d8b4e4a Change tethering file structure to respect its package name
Bug: 145099347
Test: atest TetheringTests
      atest CtsTetheringTest
Change-Id: I7401c550fbafd17a5ed2d925b5d0e17e358af467
2020-04-14 02:09:51 +00:00
Paul Hu
033bccd37d Merge "Address aosp/1274403 leftover comment" 2020-04-08 07:36:35 +00:00
Paul Hu
43a219ee83 Merge "Fix TetheringIntegrationTests failure" 2020-04-08 06:12:29 +00:00
paulhu
e03ec757ee Address aosp/1274403 leftover comment
Bug: 152828142
Test: atest EntitlementManagerTest

Change-Id: I81f2d268c9f26bc4488b06032477a73d071f73f8
2020-04-08 11:45:08 +08:00
paulhu
114dab3670 Fix TetheringIntegrationTests failure
Bug: 150644681
Test: atest TetheringIntegrationTests
Change-Id: I5a537eca9b1aab3694a11a2dab147a31f289314c
2020-04-08 09:57:57 +08:00
Mark Chien
507e5f0959 Merge "Add TetheringServiceTest unitest" 2020-04-07 15:39:38 +00:00
Mark Chien
c8b4f60e85 Merge "Add IPv6TetheringCoordinator unit test" 2020-04-06 15:25:37 +00:00
markchien
b2d27d39ed Add IPv6TetheringCoordinator unit test
Bug: 148636687
Test: atest IPv6TetheringCoordinatorTest
Change-Id: I939323ce09adb9c66b1e2b83d58b0f892aa8f011
2020-04-06 18:25:41 +08:00
Lorenzo Colitti
74107e4dd1 Merge "Migrate to TetherOffloadRuleParcel in IpServer" 2020-04-06 08:40:51 +00:00
Paul Hu
14a8cf0f5e Merge "Fix EntitlementManager issues" 2020-04-06 07:33:26 +00:00
markchien
b174e14fa0 Add TetheringServiceTest unitest
Bug: 145490751
Test: atest TetheringTests
Change-Id: I68cd403302848c041444e6d47652435d67f59273
2020-04-06 12:02:17 +08:00
Lorenzo Colitti
dbd215ede1 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
0e127d1f66 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
paulhu
0ab66f6cd0 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
390f5b3bec Merge "Assign specific client address to dhcp server" 2020-03-30 03:38:46 +00:00
Lorenzo Colitti
a0a5b5bd23 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
Lorenzo Colitti
897ebfbc82 Merge "Add an Ethernet tethering test." 2020-03-27 10:37:18 +00:00
Mark Chien
8211dbba72 Merge "Register callback and receiver after tethering is created" 2020-03-27 08:31:11 +00:00
Lorenzo Colitti
a9f7e18546 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
031d34c1f6 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
paulhu
dd00f67eab [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
fb16184c6e [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
16c102c89a [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
c686fa828b Merge "TetheringManager API clean up" 2020-03-19 16:09:21 +00:00
markchien
32726e00e2 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
743236096e 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
b6723a2b8e 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
2c7aa1f5ab Merge "[SP25] Rename functions that add Entry conditionally" 2020-03-18 03:16:41 +00:00
junyulai
5a1b9fce65 [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
81ab487105 Merge "Support static address configuration" 2020-03-17 13:26:09 +00:00
markchien
b69c39ad83 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