Commit graph android_packages_modules_Co.../Tethering/tests
Message SHA1
Merge "[DU04-4]Appropriate changes to the NetworkPolicyManager API"
Frank Li   authored and   Gerrit Code Review   commited 2022-03-16 12:28:24 +00:00
cd9fe9b220
Merge "Add a carrier config to block tethering."
Tom Hsu   authored and   Gerrit Code Review   commited 2022-03-16 07:26:39 +00:00
1c12d0790e
Add a carrier config to block tethering.
When KEY_CARRIER_SUPPORTS_TETHERING_BOOL=false, it will behave as if
entitlement check failed and a system notifcation shows up if user
tries to turn on tethering from Settings UI.

Bug: 161206517
Test: manual
Change-Id: I78da390ecb0c8f4f68285ef16da80653f136c11e

Meng Wang   authored and   tom hsu   commited 2022-03-16 12:40:24 +08:00
a84bb2d8ba
[DU04-4]Appropriate changes to the NetworkPolicyManager API
Divide the NetworkPolicyManager API
notifyStatsProviderWarningOrLimitReached into the following two APIs:
1. notifyStatsProviderWarningReached()
2. notifyStatsProviderLimitReached()

Bug: 216474563
Test: atest NetworkStatsServiceTest NetworkPolicyManagerTest
            NetworkPolicyManagerServiceTest OffloadControllerTest
Change-Id: I473b8b677d492a7076e63f445b3a3be24d25e14d

Frank   commited 2022-03-16 12:23:34 +08:00
9ff8eb1829
Merge changes I5af6ce96,Ibc1f6813
* changes:
  Refactor make{Tether4Key, Tether4Value ConntrackEvent} helper
  BpfCoordinatorTest: refactor upstream and downstream setup functions

Nucca Chen   authored and   Gerrit Code Review   commited 2022-03-11 18:05:14 +00:00
3938102448
Merge "Make isTetheringSupported respect all tethering downstreams"
Mark Chien   authored and   Gerrit Code Review   commited 2022-03-07 05:56:20 +00:00
8dcc3000fd
Make isTetheringSupported respect all tethering downstreams
Currently if wifi, usb and bluetooth tethering is not supported,
isTetheringSupported would return false. Then ethernet, ncm tethering
and wifi p2p would also not be supported anymore. Make
isTetheringSupported respect all tethering downstreams after T.

Also remove redundant code:
1. tethering always has upstream configuration, checking whether has
upstream configuration for isTetheringSupported is useless.
2. Remove TetheringDependencies#isTetheringSupported because it don't
have any caller.

Test: atest TetheringTests
Change-Id: I3db5ce410c064d37c9e9e704fce2a2b68705834e

markchien   commited 2022-03-07 10:55:51 +08:00
259d5c08a8
Merge changes from topic "dedup-interfaceparams"
* changes:
  Remove unused InterfaceParams jarjar rule
  Deduplicate InterfaceParams

Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-03-05 08:23:55 +00:00
a63535bfd1
Deduplicate InterfaceParams
CS should use InterfaceParams from frameworks/libs/net.

Test: builds
Bug: 222448728
Change-Id: I1f45d3171b265461a8724b4be7b212c030b63fe9

Patrick Rohr   commited 2022-03-04 16:53:51 +01:00
9f371f024b
Merge "Pass whole TetheringConfiguration to IpServer"
Mark Chien   authored and   Gerrit Code Review   commited 2022-03-03 11:54:59 +00:00
9edd999725
Pass whole TetheringConfiguration to IpServer
This is a no-op CL that passing whole TetheringConfiguration to IpServer
to reduce the number of IpServer constructor parameters.

Bug: 170056953
Test: atest TetheringTests
Change-Id: I4ec17f7ecaefd7f275139ad9c7f7551635b192c9

markchien   authored and   Mark Chien   commited 2022-03-03 11:54:24 +00:00
b961d3d70f
Merge "Remove tether_enable_select_all_prefix_ranges flag"
Mark Chien   authored and   Gerrit Code Review   commited 2022-03-03 09:40:27 +00:00
a3728e97ca
Remove tether_enable_select_all_prefix_ranges flag
The tether_enable_select_all_prefix_ranges is added from M2020-12
for quick roll back the feature. Since feature is landed over a year
without any problem, remove the flag now.

Bug: 171269957
Test: atest TetheringTests
Change-Id: I3ef414a47dd0a1f80ea2d378601ccd7c14067318

markchien   commited 2022-03-02 21:58:50 +08:00
23a5f18adb
Rename framework-connectivity-tiramisu to framework-connectivity-t
Bug: 215434166
Test: build, flash, device boot to home.
Merged-In: I9ebedf8813cbfa30d979bc35a3b2306715be682b
Change-Id: I9ebedf8813cbfa30d979bc35a3b2306715be682b

paulhu   commited 2022-03-01 09:44:21 +08:00
537f72061a
Merge changes from topic "ms52-movenetstats"
* changes:
  Update API files to unhide MATCH_PROXY.
  Update tests for NetworkStats code move.
  Add setPollForce to module API
  Add JNI stats libraries to apex Android.bp
  Add JNI stats libraries to connectivity
  [MS62.2] Add NetworkStatsService into service initializer
  [MS54.8] Add hiddenapi-unsupported-t.txt to apex Android.bp
  [MS54.3] Move NetworkStats to updatable sources

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2022-02-28 05:32:23 +00:00
cebdfba1bb
[MS54.3] Move NetworkStats to updatable sources
This CL builds NetworkStats related codes with the
connectivity module instead of platform.

Test: TH
Bug: 197717846
Change-Id: I4eeb7ea9cfc3139991caf0fc22474e0052a0391c
Merged-In: I4eeb7ea9cfc3139991caf0fc22474e0052a0391c

Junyu Lai   commited 2022-02-28 03:24:19 +00:00
eb6f4bef96
Merge "Notify linkproperties change in all scenarios"
Mark Chien   authored and   Gerrit Code Review   commited 2022-02-25 11:13:12 +00:00
cc0dc24205
Notify linkproperties change in all scenarios
In scenarios where linkproperties event is received on default internet
callback, linkproperties are cached and network state is updated with
new link properties but Tethering class is notified about the change.
Later when event is received on mobile request or listen all cb, since
the network state is already updated with these linkproperties, change
in link properties will not be notified. This results in tethering
failures where the ip addresses of the tethering interface will not be
updated.

This change handles this issue by triggering the link properties change
in all scenarios.

Update the correponding test case as well.

Tests: Builds, Boots, TetheringTests
Bug: 216281561
Change-Id: I7452ed07d2665843c86141764b71aab0c00417fe

Pavan Kumar M   commited 2022-02-25 12:29:10 +05:30
68e96aba07
Refactor make{Tether4Key, Tether4Value ConntrackEvent} helper
Used for reducing the increasing amount of helper in the
follow-up commits.

Tether4Key, Tether4Value ConntrackEvent need many arguments to build
a testing instance. Any new argument combination may require a new
helper. It is hard to compare the difference while reading the code.

Test: atest BpfCoordinatorTest
Change-Id: I5af6ce9609b97d124227750cd1c5337796982c58

Hungming Chen   commited 2022-02-22 21:32:52 +08:00
4aa94e6f9c
BpfCoordinatorTest: refactor upstream and downstream setup functions
This is preparation for tetherOffloadRule4Clear test.

- Upstream interface can be set {null, cellular (rawip), wifi (ether)}
- Allow that add up to two downstream interfaces which has one client
  on each of them.
- Change mBpfDownstream4Map and mBpfUpstream4Map from mocked instance
  to TestBpfMap for further rule check.
- Remove startPolling() from initBpfCoordinatorForRule4() because
  upstream information is updated by updateUpstreamNetworkState now.

Test: atest TetheringCoverageTests

Change-Id: Ibc1f68131410b7cec379ab4e310b90ad85f25d31

Hungming Chen   commited 2022-02-22 21:32:38 +08:00
154b1e467d
Fix EthernetTetheringTest testTestNetworkUpstream flaky
The test assume the first tethering upstream would be test network. But
if there are mutiple networks available, this is a wrong assumption
because of race condtion. If tethering choose upstream while wifi or
celluar is available but test network may not available for tethering yet
(it depend on the NetworkCallback from ConnenectivityService), the first
upstream may not be the test network.

Bug: 215224286

Test: atest EthernetTetheringTest
Change-Id: Idfa972008643f1fb5119179383b06e2c8f65c667

markchien   commited 2022-02-22 12:42:15 +08:00
95cb089853
Merge "BpfBitmap Test"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2022-02-18 01:55:43 +00:00
b194d551bf
BpfBitmap Test
Privileged test case for BpfBitmap.

Test: atest BpfBitmapTest
Bug: 179733303
Change-Id: I9c32d8843176815a725eccfd1f0400ec129cd94d

Tyler Wear   commited 2022-02-15 22:19:58 +00:00
c23ffbdf7e
Add test for IPv4 UDP forwarding rules in BPF map
Parse the dumpsys output strings to check that the IPv4 UDP
forwarding rule is added by the UDP conntrack event on
the tethering interface.

Test: atest EthernetTetheringTest
Change-Id: I2f04af72e51ca6b7a37ba51daa4f5125cb11144c

Hungming Chen   commited 2022-02-15 16:24:22 +08:00
a525e24fbc
Move Tether4Key and Tether4Value to common libs
EthernetTetheringTest needs to parse BPF map content for IPv4
forwarding rule tests. Move the struct class files to common
libs.

Compare Tether4{Key, Value}.java between frameworks/libs/net/common
and packages/modules/Connectivity/Tethering.
There is only the package name change as expected.

$ diff packages/modules/Connectivity/Tethering/src/com/android/networkstack/tethering/Tether4Key.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/Tether4Key.java
17c17
< package com.android.networkstack.tethering;
---
> package com.android.net.module.util.bpf;

$ diff packages/modules/Connectivity/Tethering/src/com/android/networkstack/tethering/Tether4Value.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/Tether4Value.java
17c17
< package com.android.networkstack.tethering;
---
> package com.android.net.module.util.bpf;

Test: atest TetheringCoverageTests

Change-Id: I73c180fa4129aefde1e64ecbafe928f388b061d6

Hungming Chen   authored and   Nucca Chen   commited 2022-02-09 10:45:37 +00:00
887a22cc4a
Extract TestBpfMap from BpfCoordinatorTest.
The class is being moved to a common test utils location in
another CL in this topic.

Test: atest BpfCoordinatorTest
Change-Id: Ibf8dae3e05aacaea4f7c3fe8229d87e1ad6a68d5

Lorenzo Colitti   authored and   Patrick Rohr   commited 2022-02-03 22:53:07 +01:00
1705eb9964
Add jarjar rule for com.android.testutils.TestBpfMap
TestBpfMap needs to be jarjar'ed to work with ConnectivityCoverageTests
which combines both framework tests and tethering tests (and their
respective jarjar rules).

Test: atest ConnectivityCoverageTests:BpfCoordinatorTest
Change-Id: Ie3e7f0be9aeb848978f0df97be48100c808086bc

Patrick Rohr   commited 2022-02-03 22:53:07 +01:00
3157918fc9
Use new bluetooth API to enable/disable bt tethering after T
This change only apply to the device after T.
Use new bluetooth API to change bluetooth tethering settings and the
new API provide the callback to to notify Tethering when bluetooth
interface is ready. Tethering doesn't use bluetooth interface status
change event from netlink to add/remove IpServer anymore.

Tag: #feature
Bug: 190438212
Test: TetheringTest
Change-Id: Iae92d98d500f83b116da7282cf1130fb8fecf53d

markchien   commited 2022-01-17 16:47:43 +08:00
69681d65a5
Merge "Bump tethering target sdk version to 31"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-01-13 05:00:02 +00:00
0d4f956b34
Bump tethering target sdk version to 31
Also add BLUETOOTH_CONNECT permission which is needed for access
PanService if target sdk 31+. The permission would be granted to
privilege application without prompt.

Also remove the min_sdk_version 29 from AndroidManifest because it is
useless that the Android.bp already define min_sdk_version 30.

$aapt dump xmltree TetheringNext.apk AndroidManifest.xml
N: android=http://schemas.android.com/apk/res/android
  E: manifest (line=19)
    A: android:sharedUserId(0x0101000b)="android.uid.networkstack" (Raw: "android.uid.networkstack")
    A: android:versionCode(0x0101021b)=(type 0x10)0x1f
    A: android:versionName(0x0101021c)="Tiramisu" (Raw: "Tiramisu")
    A: android:compileSdkVersion(0x01010572)=(type 0x10)0x1f
    A: android:compileSdkVersionCodename(0x01010573)="Tiramisu" (Raw: "Tiramisu")
    A: package="com.android.networkstack.tethering" (Raw: "com.android.networkstack.tethering")
    A: platformBuildVersionCode=(type 0x10)0x1f
    A: platformBuildVersionName="Tiramisu" (Raw: "Tiramisu")
    E: uses-sdk (line=23)
      A: android:minSdkVersion(0x0101020c)=(type 0x10)0x1e
      A: android:targetSdkVersion(0x01010270)=(type 0x10)0x1f
    ....
    E: uses-permission (line=35)
      A: android:name(0x01010003)="android.permission.BLUETOOTH_CONNECT" (Raw: "android.permission.BLUETOOTH_CONNECT")

Bug: 204265450
Test: manual testing bluetooth tethering and TH
Change-Id: I6f821020679b9379cada29f6f0816187545a24fb

markchien   authored and   Mark Chien   commited 2022-01-12 07:24:16 +00:00
bf62258f8c
Add tethering IPv4 UDP forwarding test
This is a preparation for testing IPv4 BPF offload.
- Add an ARP responder.
- Add a basic UDP forwarding test.

Test: atest EthernetTetheringTest
Change-Id: I720a5a2c4b97493eb6a5570cecd73dfc1eabf5cd

Hungming Chen   authored and   Nucca Chen   commited 2022-01-03 07:16:16 +00:00
bb8e9dae7f
Merge "Support testing upload/download packets"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-12-23 04:22:59 +00:00
139f43509e
Reuse BluetoothPan object and use it under tethering handler thread
1. Instead of create BluetoothPan every time when tethering need to use
it, store it with mBluetoothPan and resue it.
2. Call BluetoothPan function under tethering handler thread.

Bug: 190438212
Test: atest TetheringTests

Change-Id: I40adece59960ec44a02dc438d6bd95483a0788af

markchien   commited 2021-12-16 12:12:07 +08:00
1e020903cc
Merge "[NETD-BPF#3] Relocate Tethering/bpf_progs and rename bpf_tethering_headers"
Ken Chen   authored and   Gerrit Code Review   commited 2021-12-02 12:54:01 +00:00
5fabfd8dd0
Support testing upload/download packets
This is a preparing CL to test the packets sent from clients and the
packets replied from remote side.

Bug: 183166581
Test: atest EthernetTetheringTest
Change-Id: I898de024c0d9ecf13d81023035242c4abf856702

markchien   commited 2021-11-29 18:02:24 +08:00
13e5a48cb7
Add defaults to enable/disable connectivity/tethering next
The defaults can be used to enable/disable connectivity next targets
depending on the branch, while minimizing merge conflicts.

The "next" target may use unstable APIs. It need to be disabled in the
branch which only have the last stable SDK available.

Also correct TetheringTestsLatestSdkLib which should use stable API.

Test: TH
Change-Id: I00d91bbd513277c1cedf67d18ac9f56cc4037309

markchien   commited 2021-11-24 12:20:23 +08:00
598a75ba8c
[NETD-BPF#3] Relocate Tethering/bpf_progs and rename bpf_tethering_headers
The folder is currently used by tether offload only. Because we will
move netd.c and clatd.c to it, the folder should be moved to the upper
tier.

Also, rename bpf_tethering_headers to bpf_connectivity_headers so that
other connectivity code besides to tethering are justified to use it.

Bug: 202086915
Test: atest FrameworksNetTests
Change-Id: I95943c6e909f1fdca12604ef0c55d67c39ca686b

Ken Chen   commited 2021-11-20 18:31:08 +08:00
bb57fa9eec
Rename tethering jni and get the jni by its package name
tetherutiljni is renamed to com_android_networkstack_tethering_jni_util

Bug: 205088391
Test: atest TetheringTests
      atest CtsTetheringTest
      atest TetheringPrivilegedTests
Change-Id: Ifd1f4473625e33d3ebe190c9f8a2b5d54aa1ff49

markchien   commited 2021-11-10 14:07:24 +08:00
f967b11087
Rename tethering util folder and its package name
Move tethering util files from android.net.util into
com.android.networkstack.tethering.util. The goal is move all of
tethering internal files into its own namespace
com.android.networkstack.tethering.util.

Bug: 205088391
Test: atest TetheringTests
      atest CtsTetheringTest
      atest TetheringPrivilegedTests

Change-Id: I6559fb4f873b3cad5b210b10e49df1b6c6914a70

markchien   commited 2021-11-09 17:02:47 +08:00
d02f9af918
Fix TetheringPrivilegedTests crash
After separat BpfMap to a library, its package name is jarjar to
com.android.network.stack.util*. Also jarjar BpfMap of
TetheringPrivilegedTests to fix crash in jni registered.

Bug: 179733303
Test: atest TetheringPrivilegedTests
Change-Id: Ia9bc819a44fe26bf2ff7a46351ea60f2eeb02933

markchien   commited 2021-11-04 16:40:18 +08:00
45dc794fb4
Merge "bpfmap: Move to Common Location"
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2021-11-04 01:50:15 +00:00
bb4c6073ec
Merge "Replace "mts" with "mts-tethering"."
Kimberly Kreider   authored and   Gerrit Code Review   commited 2021-11-01 23:43:53 +00:00
200e42063c
bpfmap: Move to Common Location
Move bpfmap to frameworks/libs/net/common/native.

Bug: 179733303
Change-Id: Id08b216ec6a64968d66d7990f91ea7ce222a1154

Tyler Wear   commited 2021-10-29 09:05:33 -07:00
e8043ca762
Move to f/l/n instead of RouteUtils
Test: TetheringTests
Change-Id: I35b36538463a7fc2f02e142719c898d1694b2d6b

Chalard Jean   commited 2021-10-29 16:05:46 +09:00
adcec9ebbe
Replace "mts" with "mts-tethering".
Bug: 203466102
Test: build locally and verified contents
Change-Id: I7cccb54c0ad1a3bd8da0bcb7ad6474aa1e734299

Kimberly Kreider   commited 2021-10-20 18:16:59 +00:00
c5b3f34831
Merge "Unregister the tethering internal callback in finalize"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-10-20 08:40:08 +00:00
f8d1f3d1cd
Merge "Test TetheringManager could be GC after getting connector"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-10-20 07:48:10 +00:00
9d0c5419c9
Unregister the tethering internal callback in finalize
Bug: 177265744
Bug: 191798390
Bug: 187972579
Test: atest TetheringServiceTest
Change-Id: Ie7f9535b923db5073a59329ead22546a54e6ef47

markchien   authored and   Mark Chien   commited 2021-10-20 06:57:58 +00:00
819e19ea2a
Test TetheringManager could be GC after getting connector
There is pollingConnector thread which start polling connector if
TetheringManager is created earlier than TetheringService started(during
device boot up). TetheringManager won't be GCed if pollingConnector
thread do not finish its task yet.

Bug: 177265744
Bug: 191798390
Bug: 187972579
Test: atest TetheringServiceTest
Change-Id: Id8c7d10c5172e1d5de460c5311ff9c20261facef

markchien   authored and   Mark Chien   commited 2021-10-20 06:06:04 +00:00
e7b4a505aa
Merge "Fix TetheringManager memory leak"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-10-20 03:59:59 +00:00
d7d41a73e7