Commit Graph

2739 Commits

Author SHA1 Message Date
Dan Stahr
e2be25f6a0 Add Cronet to the Tethering apex.
Test: m
API-Coverage-Bug: 258707653

Change-Id: I2d6401ec719ce265abdb30d6ba8fd94861845197
2023-01-17 08:06:53 -08:00
Motomu Utsumi
841643a95e cronet: Introduce constant for CronetJavaDefaultsEnabled srcs
This is required temporarily until the external/cronet is auto-merged
to tm-mainline-prod

Test: m
Change-Id: Ie875e4108a0b2a82e9615d1f32f3b0bf76572146
2023-01-17 15:03:03 +09:00
Patrick Rohr
c65b451289 cronet: introduce constant for apex_defaults
Merging them as enabled, so they can be disabled on tm-mainline-prod.

Test: TH
Change-Id: I5a15acfed68f47b4d59fa72da3dbbce2fd00ae63
2023-01-16 14:32:00 +00:00
Dan Stahr
1a8d9d1521 Set up the jarjar config generator for the Tethering module.
This does not affect existing classes in framework-tethering.jar
as everything inside android.net is excluded from being jarjar'ed.
It is a preparatory step to adding cronet to framework-tethering.jar
which will use jarjar.

Test: m
Change-Id: I8cc7babaa37f7aef52306a833593dba097fd26db
2023-01-13 02:26:19 -08:00
Treehugger Robot
8043d5d7af Merge "TetheringTest: fix assert{*}Equals order in TestTetheringEventCallback" 2023-01-13 08:43:07 +00:00
Treehugger Robot
401f1ff2db Merge changes from topic "deprecate_connectivity_action_in_tethering"
* changes:
  Tethering: deprecate CONNECTIVITY_ACTION on U+ device
  Test: add tests to testChooseDunUpstreamByAutomaticMode_*
  TetheringTest: separate setup func from chooseDunUpstreamTestCommon
2023-01-13 08:41:20 +00:00
KH Shi
c91fbabd45 Merge "Fix TetheringServiceTest#testTetheringManagerLeak flaky" 2023-01-13 05:44:17 +00:00
Hungming Chen
b4859d1ea1 TetheringTest: fix assert{*}Equals order in TestTetheringEventCallback
TestTetheringEventCallback may use assertEquals(actual, expected)
but assertEquals(expected, actual).

It is confused while test is failed.

For example:

Code:
callback.expectUpstreamChanged(new Network[] {null} /* expected */);

Before:
java.lang.AssertionError: expected:<100> but was:<null>

After:
java.lang.AssertionError: expected:<null> but was:<100>

Bug: 243516306
Test: atest TetheringTest
Change-Id: I6a987e4dd1cccc5e79da7dda55f194291e0c4a60
2023-01-12 17:48:04 +08:00
KH Shi
0ed11f5a46 Fix TetheringServiceTest#testTetheringManagerLeak flaky
This test relies on forceGc to free and finalize the TetheringManager
before perform validation checks. In some test suites, if there were
already too many unused objects accumulated in the system before
running the test, it might take more than 5 seconds to free them.
Increase the maximum retry time to 30 seconds to fix the flakiness.

Bug: 263335396
Test: atest TetheringServiceTest#testTetheringManagerLeak
      run the flaky test suite on ABTD with CL
Change-Id: I38bee3d43fbeb278993d113ccbe0645aedc5d75d
2023-01-12 08:25:34 +00:00
Patrick Rohr
9e31b74ee5 Merge changes I25096f4c,I40ba22ab
* changes:
  cronet: enable defaults in aosp
  cronet: add defaults to enable / disable Cronet in framework-tethering
2023-01-09 09:29:06 +00:00
Steven Moreland
f4e0f096b5 Merge "unregistered null callback will cause a crash later" 2023-01-07 02:11:16 +00:00
Patrick Rohr
a6d600ff50 cronet: enable defaults in aosp
Automerger into tm-mainline-prod is currently broken, so this change
uses a Merged-In line that is already present in tm-mainline-prod (and
downstream from it). This means that this change must also be
cherry-picked into internal-master with a slightly different Merged-In
specification.

Test: TH
Merged-In: I555ad1ed687632cfe8a7e30283f80e80956fc1d4
Change-Id: I25096f4cc21923c602d77a66aad248d52b42b18f
2023-01-06 04:13:56 -08:00
Patrick Rohr
3b9ba6acdf cronet: add defaults to enable / disable Cronet in framework-tethering
A similar option already exists in
packages/modules/Connectivity/Cronet/apex/Android.bp. This is in
preparation of adding cronet to framework-tethering. It is possible that
we only end up using one of the variables but better safe than sorry.

This change will be blocked by the blocked automerger into
tm-mainline-prod. If this continues to be a problem, we might have to
play some tricks with automerger.

Test: TH
Change-Id: I40ba22aba041ec12ec2bf2881df14e6c0ee53b44
2023-01-06 04:12:59 -08:00
Steven Moreland
cf42d60c53 unregistered null callback will cause a crash later
Bug: N/A
Change-Id: I7acbc084d8a401817879d416f0283ca40e060069
Test: N/A
2023-01-06 02:29:54 +00:00
Hungming Chen
5c985e2cdd BpfCoordinator: publish upstream interface mtu to v4 offload rule
Respect the upstream interface mtu instead of always setting
mtu 1500.

Using upstream interface mtu is probably not the best solution
for tether offload pmtu but it at least respects the upstream
interface mtu which may be less than 1500.

Test: manual test
1. Connect to carrier Taiwan Star.
2. Enable tethering and check the mtu 1434 in dumpsys.
IPv4 Upstream: proto [inDstMac] iif(iface) src -> nat ->
dst [outDstMac] pmtu age
  udp [02:10:45:32:ef:35] 54(54) 192.168.72.125:39034
  -> 15(rmnet1) 100.83.189.11:39034
  -> 142.251.43.14:443 [00:00:00:00:00:00] 1434 69657ms
IPv4 Downstream: proto [inDstMac] iif(iface) src -> nat
  -> dst [outDstMac] pmtu age
  udp [00:00:00:00:00:00] 15(rmnet1) 142.251.43.14:443
  -> 54(54) 100.83.189.11:39034
  -> 192.168.72.125:39034 [9a:8a:4d:ec:a4:7c] 1434 69633ms

Bug: 262860312
Test: atest BpfCoordinatorTest
Change-Id: Ic6dcb95ed76d5306053e4645b6baebc67ff082cf
2023-01-03 23:36:30 +08:00
Maciej Żenczykowski
53e8697d39 Merge "BpfCoordinatorTest: renumber the test interface indices" 2022-12-30 20:46:16 +00:00
Hungming Chen
46767ff62e BpfCoordinatorTest: renumber the test interface indices
This is a preparation to add new interface index.

Test: atest BpfCoordinatorTest
Change-Id: I758c2e7142099d74099fb8203f41ffec9b1182ee
2022-12-28 21:47:11 +08:00
Hungming Chen
a432d621b0 Tethering: deprecate CONNECTIVITY_ACTION on U+ device
Both CONNECTIVITY_ACTION and UpstreamNetworkMonitor monitor the
upstream connection status. The upstream status should be monitored
in one place and deprecated the duplicate one since U+ device.

Once CONNECTIVITY_ACTION is removed, CMD_UPSTREAM_CHANGED won't be
triggered anymore. For non-dun upstream netowrk , upstream
re-evaluation is triggered by EVENT_DEFAULT_SWITCHED and
EVENT_ON_LOST. For dun upstream re-evaluation, re-evaluation is
triggered by EVENT_ON_LINKPROPERTIES and EVENT_ON_LOST.

Changes:
1. Deprecate the CONNECTIVITY_ACTION broadcast.
2. Re-evaluate possible upstream selection on the event
   UpstreamNetworkMonitor.EVENT_ON_LOST.

Note that EVENT_DEFAULT_SWITCHED and EVENT_ON_LINKPROPERTIES have
already triggered the upstream re-evaluation and keep as it.

Bug: 257408654
Bug: 257941865
Test: atest ConnectivityCoverageTests
Change-Id: I8b75cfb2fec51fb5bc4e2d13ad6b54daf8efc71e
2022-12-28 02:28:16 +00:00
Hungming Chen
4c8c35748f Test: add tests to testChooseDunUpstreamByAutomaticMode_*
Add dun network test cases as follows.

Overall test coverage:
- testChooseDunUpstreamByAutomaticMode (original):
  common, test#1, test#2
- testChooseDunUpstreamByAutomaticMode_defaultNetworkWifi (new):
  test#3, test#4
- testChooseDunUpstreamByAutomaticMode_loseDefaultNetworkWifi (new):
  test#5
- testChooseDunUpstreamByAutomaticMode_defaultNetworkCell (new):
  test#5, test#7
- testChooseDunUpstreamByAutomaticMode_loseAndRegainDun (new):
  test#8
- testChooseDunUpstreamByAutomaticMode_switchDefaultFromWifiToCell
  (new):
  test#9, test#10

Overall test cases:
+-------+-------+-------+-------+-------+
| Test  | WiFi  | Cellu |  Dun  | Expec |
| Case  |       | alr   |       | ted   |
|   #   |       |       |       | Upstr |
|       |       |       |       | eam   |
+-------+-------+-------+-------+-------+
|   -   |       |       |       |   -   | --+
+-------+-------+-------+-------+-------+   |
|   -   |       |   V   |       |   -   |   |
+-------+-------+-------+-------+-------+   |   Implemented
|   -   |       |   V   |   O   |  Dun  |   +-- in chooseDun
+-------+-------+-------+-------+-------+   |   UpstreamTest
|   -   |   V   |   O   |   O   |  WiFi |   |   Common()
+-------+-------+-------+-------+-------+   |
|   -   |   V   |   O   |       |  WiFi | --+
+-------+-------+-------+-------+-------+
|       |   O   |   V   |       |   -   |
|   1   +-------+-------+-------+-------+
|       |   O   |   V   |   O   |  Dun  |
+-------+-------+-------+-------+-------+
|       |   O   |   V   |       |   -   |
|   2   +-------+-------+-------+-------+
|       |   O   |   V   |   O   |  Dun  |
+-------+-------+-------+-------+-------+
|   3   |   V   |   O   |       |  WiFi | (new)
+-------+-------+-------+-------+-------+
|   4   |   V   |       |       |  WiFi | (new)
+-------+-------+-------+-------+-------+
|   5   |       |       |   O   |  Dun  | (new)
+-------+-------+-------+-------+-------+
|   6   |       |   V   |   O   |  Dun  | (new)
+-------+-------+-------+-------+-------+
|   7   |       |       |   O   |  Dun  | (new)
+-------+-------+-------+-------+-------+
|       |       |       |       |   -   | (new)
|   8   +-------+-------+-------+-------+
|       |       |       |   O   |  Dun  |
+-------+-------+-------+-------+-------+
|       |   V   |       |   O   |  WiFi | (new)
|   9   +-------+-------+-------+-------+
|       |   V   |       |       |  WiFi |
+-------+-------+-------+-------+-------+
|       |   O   |   V   |       |   -   | (new)
|   10  +-------+-------+-------+-------+
|       |   O   |   V   |   O   |  Dun  |
+-------+-------+-------+-------+-------+

Annotation:
1. "V" means that the given network is connected and
   it is default network.
2. "O" means that the given network is connected and
   it is not default network.

Bug: 257408654
Test: atest ConnectivityCoverageTests
Change-Id: Ie7beda1a8fcfd2a3f2600ca601f58d869144d275
2022-12-28 02:28:00 +00:00
Hungming Chen
ecfe710805 TetheringTest: separate setup func from chooseDunUpstreamTestCommon
Prepare to share setup function to more dun network tests.
No operation is changed.

Bug: 257408654
Test: TetheringTest
Change-Id: I29f08d8bc3cf83aa9d03f5d2819a1c67466b7bcc
2022-12-26 19:25:16 +08:00
Mark Chien
09cb20d8a8 Merge "TestOnly: disable some UpstreamNetworkMonitor tests after T" 2022-12-21 06:27:02 +00:00
Mark
2657da3cbf TestOnly: disable some UpstreamNetworkMonitor tests after T
The legacy upstream selection flow is never called after T. Stop the
related test cases after T also.

Bug: 257408654
Test: atest TetheringTests
Change-Id: I62692bb9a49dde432d31bece41b4cff442a327d1
2022-12-21 06:26:37 +00:00
Igor Chernyshev
a4fc702f7e Add Wearable Tethering flag and configuration
This establishes the main Wear connection manager class,
and enforces T+ requirement.

Bug: 245972418

Change-Id: Ia60925ce4dc2a25ac61c4b9bae1d022dc74f5b05
2022-12-19 14:40:15 -08:00
Chiachang Wang
2d7d6e5caf Merge "Replace NetlinkSocket with NetlinkUtils" 2022-12-19 12:40:41 +00:00
chiachangwang
e97aed4847 Replace NetlinkSocket with NetlinkUtils
Those static method and constants are better to fit in
NetlinkUitls. Replace the usage.

Test: m
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: I81e27b8264e39764a44a4ba87344e9ac940d920a
2022-12-19 06:39:31 +00:00
Chiachang Wang
393052b61f Merge "Use SocketUtils from shared lib" 2022-12-19 00:54:16 +00:00
Igor Chernyshev
9dac660bf0 Add CDM dependency in Tethering
This change introduces a limited library for dependencies on
framework-connectivity from Tethering,
connectivity-internal-api-util, where all classes are annotated with
@RequiresApi(S) to ensure proper API checks are done before usage.

Bug: 245972418

Change-Id: I82bafd9063341adc71d07f0858e6d68283d081f0
2022-12-16 17:55:53 +00:00
chiachangwang
18e072c7f5 Use SocketUtils from shared lib
Test: m
Change-Id: Ia86183a7e7844309dcbd21140e2785a71d7febab
2022-12-16 07:34:51 +00:00
Mark Chien
6d8176898e Merge "SyncSM08: statically import tethering error code constant" 2022-12-14 13:35:12 +00:00
Mark
74461fc13d SyncSM08: statically import tethering error code constant
This can make the code using error code not so easy to over 100
words line limit.

Test: m
Change-Id: I952c51f2e3508ed320744985193802454d07ccfe
2022-12-14 09:12:15 +00:00
Hassan Ali
c3ebeb81a1 Merge "Add ConfigInfrastructure stubs lib to Android.bp" 2022-12-12 15:11:30 +00:00
Maciej Żenczykowski
4e3321ed3b bpf_tethering.h -> offload.h
match header file with bpf program

Locations to change found via:
  https://source.corp.google.com/search?q=p:aosp-master%20(%5E%7C%5B%5E_%5D)bpf_tethering.h

Core reasoning for this will be to match the .h naming
that we'll have for netd.c and clatd.c once we get rid of bpf_shared.h

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I4154659c7fb23a37f5316a5c804fb2606d842e9c
2022-12-08 13:04:45 +00:00
Hassan Ali
bc4e514ea1 Add ConfigInfrastructure stubs lib to Android.bp
This change is part of aosp/2305844 to update
framework-configinfrastructure dependency.

As part of moving DeviceConfig.java to
packages/modules/ConfigInfrastructure, We need to add
ConfigInfrastructure lib dependency to Android.bp as DeviceConfig APIs
will not be part of the non-updatable part and will not be part of the
base module_current SDK so we have to add an explicit dependency.

Test: m
bug: 253019048
Change-Id: Iba194c664c1c701e396e7a2a036bd03772644db8
Merged-In: Ic5323c10b7c899fbf9af41444915359f23db17b5
2022-12-08 12:58:20 +00:00
Hungming Chen
b58191dee8 Test: rename EthernetTetheringTest to CtsEthernetTetheringTest
Bug: 250552545
Bug: 258637850
Test: atest CtsEthernetTetheringTest
Change-Id: I76e687fc46f89fcfce9049ac6736bb078df06ecc
2022-12-06 15:46:23 +08:00
KH Shi
cc8db2ac6e Merge "Fix ConntrackSocketTest#testIpv4ConntrackSocket flaky" 2022-12-06 05:46:54 +00:00
Nucca Chen
a43bba1277 Merge "Test: separate common methods to EthernetTetheringTestBase" 2022-12-06 02:30:13 +00:00
KH Shi
09eb7631fa Fix ConntrackSocketTest#testIpv4ConntrackSocket flaky
If we run an iterations test, TCP connections opened by previous tests
won't be closed immediately. They will stay in the TIME_WAIT state for
120 seconds before closed. Netfilter socket listens to both
NF_NETLINK_CONNTRACK_NEW and NF_NETLINK_CONNTRACK_DESTROY groups.

There is a tiny time gap between socket creation and sending dump
request to kernel. If an old TCP connection happened to be closed in
this time gap, listening socket would see a DESTROY message before
seeing the NEW messages triggered by dump request.

The current test only parsing the first contrack message in the read
buffer, so it will only find the DESTROY message and ignore all of the
following NEW messages. It does a netfilter socket dump, but does not
check whether the dump produces reasonable output. Now that we have
the ability to parse conntrack messages, do more in-depth checking.

Bug: 254608655
Test: atest ConntrackSocketTest --iteration 500
Change-Id: Icf95adb9d9390d598e9c6bdb4e245c5fce764e3e
2022-12-05 22:26:52 +08:00
Treehugger Robot
767e5b6df6 Merge "Wrap some IpServer commands" 2022-12-02 21:48:05 +00:00
Cole Faust
65b2ec8855 Merge "Remove usages of java_api_finder" 2022-12-02 19:31:31 +00:00
Hungming Chen
40c9fe1165 Test: separate common methods to EthernetTetheringTestBase
This is a preparation for breaking down EthernetTetheringTest into
CTS and MTS tests.

Changes:
1. Separate common methods from EthernetTetheringTest
   to EthernetTetheringTestBase.
Before:
  EthernetTetheringTest

After:
  [base class]                   [derived class]

  EthernetTetheringTestBase +--+ EthernetTetheringTest

2. No test operation is changed.

Bug: 250552545
Bug: 258637850
Test atest EthernetTetheringTest

Change-Id: I36d205bf6f2a8145d5ac63c620af7528765b22ab
2022-12-02 09:23:03 +00:00
Treehugger Robot
fbef749cda Merge changes I9bccc558,Ifd855571
* changes:
  Test: separate common variables to EthernetTetheringTestBase
  Test: decouple the tests which access class member variables directly
2022-12-02 09:15:42 +00:00
Hungming Chen
21308b5b2d Test: separate common variables to EthernetTetheringTestBase
This is a preparation for breaking down EthernetTetheringTest into
CTS and MTS tests.

Changes:
1. Separate common variables from EthernetTetheringTest
   to EthernetTetheringTestBase.
Before:
  EthernetTetheringTest

After:
  [base class]                   [derived class]

  EthernetTetheringTestBase +--+ EthernetTetheringTest

2. Separate EthernetTetheringTest from aosp/2319857

Bug: 250552545
Bug: 258637850
Test atest EthernetTetheringTest

Change-Id: I9bccc558dc8b955055a2927a1a600afd399b264f
2022-12-02 07:18:43 +00:00
Mark
a542458c16 Wrap some IpServer commands
This is no-op change. Preparing for refactor.

Test: atest TetheringTests
Change-Id: I8fb67cbc95074e990074f08b5fe6afe7dfd28382
2022-12-02 04:48:00 +00:00
Hungming Chen
1dbc674e13 Test: decouple the tests which access class member variables directly
This is a preparation for breaking down EthernetTetheringTest into
CTS and MTS tests.

EthernetTetheringTest is going to separate test base class and
derived class. In order to encapsulate base class better, decouple
the following tests which access member variables directly.
- testStaticIpv4
- testLocalOnlyTethering
- testPhysicalEthernet
- testVirtualEthernet
- testVirtualEthernetAlreadyExists

Above tests change to use local veriables instead of class member
variables: mDownstreamReader, mDownstreamIface,
mTetheringEventCallback, mTetheredInterfaceRequester.

This can help to decouple the tests with class member variables and
these class member variables can be private in the
base class EthernetTetheringTestBase since the following commit.

Bug: 250552545
Bug: 258637850
Test atest EthernetTetheringTest

Change-Id: Ifd855571337b34c1dfee5cb2791369de754bc94d
2022-12-01 18:54:23 +08:00
Mark Chien
6ed83a43c8 Merge "Remove dead code: updateUpstreamIPv6LinkProperties in InitialState" 2022-11-25 01:07:15 +00:00
Hassan Ali
bfb0cdfa51 Merge "Add ConfigInfrastructure lib to Android.bp" 2022-11-24 13:33:28 +00:00
Cole Faust
417c1d9c3a Remove usages of java_api_finder
This errorprone checker is no longer used.

Bug: 260268418
Test: Presubmits
Change-Id: I055bce5957ae05faef683e3d515332bd119fb720
2022-11-23 15:10:11 -08:00
Hassan Ali
c4f63fa973 Add ConfigInfrastructure lib to Android.bp
As part of moving DeviceConfig.java to
packages/modules/ConfigInfrastructure, We need to add
ConfigInfrastructure lib dependency to Android.bp as DeviceConfig APIs
will not be part of the non-updatable part and will not be part of the
base module_current SDK so we have to add an explicit dependency.

Test: m
bug: 253019048
Change-Id: I29f993342e1baf4e75b30c8d99de10bc087a582b
2022-11-23 11:41:43 +00:00
Mark
0e38307b4b Remove dead code: updateUpstreamIPv6LinkProperties in InitialState
mRaemon only be created at BaseServingState#enter() and set to null at
BaseServingState#exit(). Thus, updateUpstreamIPv6LinkProperties just be
no-op in InitialState.

Test: atest TetheringTests MtsTetheringTestLatestSdk CtsTetheringTest
Change-Id: I0b8403a2acffb1aa0f40d2ad8721d4eff7c63ff0
2022-11-23 08:22:32 +00:00
Hungming Chen
e28d70804d EthernetTetheringTest: remove isEthernetTetheringSupported
isEthernetTetheringSupported() has been not used since
using TetheringManager#isTetheringSupported in aosp/2143272.

Bug: 258637850
Test: EthernetTetheringTest
Change-Id: Ifc560613301393eeadb6df11688944b2dc629c35
2022-11-17 10:59:33 +08:00