Commit graph android_packages_modules_Co.../Tethering/tests
Message SHA1
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
Fix TetheringManager memory leak
TetheringCallbackInteranl is inner class which explicitly reference
TetheringManager object. This causes TetheringManager can't be GC. Using
static nested class which has its own lifecycle and weak reference
TetheringManager object.

Still have a leak inside Tethering that TetheringCallbackInternal is
never unregistered. Currently it rely on binder died to remove the
reference, which usually happen in kill process. If process keep alive,
the TetheringCallbackInternal would not be freed even TetheringManager is
gone. Will have follow CL to fix this.

Bug: 177265744
Bug: 191798390
Bug: 187972579
Test: 1. lunch Settings with ON/OFF tethering, dump java heap.
      2. close Settings and restart Settings again, dump java heap.
      3. Compare java heap between step 1 and step 2.
Change-Id: I0e2a21b7988115098a033a581cd98da8bffe2791

markchien   commited 2021-10-14 14:02:11 +08:00
1110b725a0
Move runDhcp to TetheringTester am: f320c21120
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1817921

Change-Id: I74d5c4a6c88fb26e35218f05ef468fa125a340d4

markchien   authored and   Automerger Merge Worker   commited 2021-09-30 15:00:11 +00:00
97ac1a93fa
Move runDhcp to TetheringTester
This is a no-op CL which add TetheringTester and move runDhcp related
logic to it.

Test: atest EthernetTetheringTest
Change-Id: Ib1c5647b2bd5a1b27c976450d3aa265aff8f5b70

markchien   authored and   Mark Chien   commited 2021-09-30 12:57:30 +00:00
f320c21120
Rename mTapPacketReader to mDowntreamReader am: 0bd10760a8
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1824633

Change-Id: I1cde888d4502463bbd6d49a3b76f3f8a6d676483

markchien   authored and   Automerger Merge Worker   commited 2021-09-30 12:48:20 +00:00
7ea99be9d6
Merge "Support set test network to tethering upstream" am: 473d864d20
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1797991

Change-Id: Ifd5c76a943886dfe55e9b68eeb77931dae6fe204

Mark Chien   authored and   Automerger Merge Worker   commited 2021-09-30 12:48:15 +00:00
da862b2a35
Rename mTapPacketReader to mDowntreamReader
Test: atest EthernetTetheringTest
Change-Id: I2905aba449a2625caf6a82b27b9e43b06191da9f

markchien   authored and   Mark Chien   commited 2021-09-30 12:36:28 +00:00
0bd10760a8
Support set test network to tethering upstream
Test: atest EthernetTetheringTest

Change-Id: Ief2a92bc6c573a6bb75c72b7a0630e5c0accfa73

markchien   authored and   Mark Chien   commited 2021-09-30 10:14:58 +00:00
2fbd3e72d3
Merge "Replace inexact alarm setRepeasting with setExact alarm" am: 507de1cac6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1793479

Change-Id: Ia989bed2395130329ce5946cb7ece91089fc8571

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-08-30 14:01:49 +00:00
096498601e
Merge "Replace inexact alarm setRepeasting with setExact alarm"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-08-30 13:42:25 +00:00
507de1cac6
Refactor the offload permission check and add tests am: b344870ea0
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1803422

Change-Id: I857de882e6f613d3bf57d271532f761be10bf988

Hungming Chen   authored and   Automerger Merge Worker   commited 2021-08-27 05:02:15 +00:00
5dbbd2f132
Refactor the offload permission check and add tests
- Rename the conntrack destination port check function
- Use CollectionUtils.contains to check the denied ports
- Add tests for the streams with ftp and pptp tcp port are
  not able to be offloaded

Bug: 195914327
Test: atest TetheringCoverageTests
Change-Id: I7e2591bea1f6db46271efb0c30970fb8d4efe1e4

Hungming Chen   commited 2021-08-26 21:21:05 +08:00
b344870ea0
Give EthernetTetheringTest the restricted networks permission. am: 8fbadf4ac5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1807157

Change-Id: I13defb1e00586393e91ca19100cf437482a64090

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2021-08-24 08:54:53 +00:00
c1256c4cf3
Give EthernetTetheringTest the restricted networks permission.
This test fails on devices where physical Ethernet interfaces are
available but marked restricted, like cuttlefish.

Bug: 197462993
Test: test-only change
Change-Id: I15c991b2e43e2d5e823dcdcfbd74adfd9b2f6f08

Lorenzo Colitti   commited 2021-08-24 15:18:54 +09:00
8fbadf4ac5
Replace inexact alarm setRepeasting with setExact alarm
Use exact alarm to fix entilement recheck delay problem while device
asleep.

Bug: 195370891
Test: atest TehteringTests
Change-Id: I409e603bf2b990657551e1140b50f69640c328d8

markchien   commited 2021-08-12 13:32:54 +08:00
52158b1d47
Merge "Import net-utils-device-common-netlink instead of netlink-client." am: 609e71a46c am: dd7e9e8800
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1753303

Change-Id: I4fb162f20f5816de1ee1b784cb39533362b34677

Xiao Ma   authored and   Automerger Merge Worker   commited 2021-08-04 07:56:23 +00:00
f29e0435a9
Merge "Import net-utils-device-common-netlink instead of netlink-client."
Xiao Ma   authored and   Gerrit Code Review   commited 2021-08-04 07:27:18 +00:00
609e71a46c
Merge "Throw an errno exception when open BPF map failed" am: 22d5336279 am: 84c87a49b1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1772440

Change-Id: Ib933a28d7ad5504def71e012a83b9080048fa37e

Nucca Chen   authored and   Automerger Merge Worker   commited 2021-08-03 09:00:34 +00:00
e17f852861
Merge "Throw an errno exception when open BPF map failed"
Nucca Chen   authored and   Gerrit Code Review   commited 2021-08-03 08:38:42 +00:00
22d5336279
Throw an errno exception when open BPF map failed
Needed because an invalid file descriptor should notify the caller to
stop using the object.

Bug: 190523685

Test: atest BpfMaptest
Change-Id: I70fb08b54b1c0caa4be4e3f07b59bf4f2397f39d

Hungming Chen   authored and   Nucca Chen   commited 2021-08-03 08:38:16 +00:00
1257e9bfff
Merge "Do not apply jarjar rules on intermediate libs" am: c1e68abd6f am: 4972bf1971
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1778569

Change-Id: I4bf35535002bc1ec90913a941923f9c6e0a1c72b

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-08-03 08:19:31 +00:00
96019d9353
Merge "Do not apply jarjar rules on intermediate libs"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-08-03 07:50:29 +00:00
c1e68abd6f
Do not apply jarjar rules on intermediate libs
Using jarjar on intermediate libraries causes issues when they are
combined with other libraries that use different jarjar rules, as the
resulting binary may contain multiple incompatible copies of the
classes. Instead, jarjar should be used on the final artifact, after
combining the libraries.

Ensure NetworkStackJarJarRules is not applied on intermediate libraries
like TetheringIntegrationTestsLib, but instead apply it on
TetheringIntegrationTests or CtsTetheringTest.

Bug: 192535368
Test: atest TetheringCoverageTests TetheringIntegrationTests \
          CtsTetheringTest
Change-Id: I248a533651984de81f676336c0e74e3788610bbb

Remi NGUYEN VAN   commited 2021-08-02 19:13:09 +09:00
0015f04ec7
Remove hidden ArrayUtils usage in TetheringTest am: 3dfafbb516 am: 53b6370ec6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1779756

Change-Id: I715be738618531ae541db589255129149cf4b306

Remi NGUYEN VAN   authored and   Automerger Merge Worker   commited 2021-07-29 07:40:07 +00:00
6a0a33dcf3
Remove hidden ArrayUtils usage in TetheringTest
Use CollectionUtils instead, which avoids using a hidden API.

Avoiding hidden API usage in tests is good in general, but this also
helps avoid jarjar problems where the com.android.internal.util package
is jarjared to some other package as some of its classes are included
in the module, and ArrayUtils cannot be found in the renamed package.

Bug: 192535368
Test: atest TetheringTest
Change-Id: I54dc8f6429d132a953ab1a674fe349fba4335936

Remi NGUYEN VAN   commited 2021-07-28 17:00:20 +09:00
3dfafbb516
Merge "Add TetheringPrivilegedTests to postsubmit" am: 94ef708b7d am: 6971e4811f
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1771186

Change-Id: I644b99720cf5af80c26f0f0ee12c49918f0895ef

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-07-26 09:15:51 +00:00
e3e529150f
Merge "Add TetheringPrivilegedTests to postsubmit"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-07-26 08:50:07 +00:00
94ef708b7d
Add TetheringPrivilegedTests to postsubmit
Also ignore DadProxyTest before S because it is only enabled from S.

To using ignore test rule, replace AndroidJunit with DevSdkIgnoreRunner.
It is fine because the we don't use the test UI (e.g. running test in UI
thread).

Test: atest TetheringPrivilegedTests
Change-Id: I701ee877520f78ded2394adbae1f4d9dd612d700

markchien   authored and   Mark Chien   commited 2021-07-26 02:17:19 +00:00
911cf8fecd