Commit Graph

133 Commits

Author SHA1 Message Date
Maciej Żenczykowski
8bcaa2926d remove inprocess tethering
It is just a constant source of bugs, with no real tests,
let's stop pretending this is a supported configuration.

The only tested configuration is out-of-process tethering
updatable apex.

Test: TreeHugger
Bug: 279942846
(cherry picked from https://android-review.googlesource.com/q/commit:7a03c187f596049db96acdae3f00dc6ff5e9e672)
Merged-In: I4b659a3cd32b89a65549b56006b926a5ac755f7b
Change-Id: I4b659a3cd32b89a65549b56006b926a5ac755f7b
2023-05-08 21:15:43 +00:00
Spandan Das
b06f9d6b81 Add libnetd_updatable to tethering-module-sdk
System libraries and binaries (e.g. netd) have a dependency on this.
Adding it to the sdk module allows an external snapshotting script
to generate prebuilts stubs of this library and commit them to
prebuilts/module_sdk. This allows minimal branch setup to build against
the apis of libnetd_updatable without checking out its source code.

Bug: 273723791
Test: m tethering-module-sdk
Change-Id: I1f235d86abba2c37ca7d750dea7071227e1346fe
2023-04-13 19:37:48 +00:00
KH Shi
3d5e65cb48 Add Tetheroffload AIDL interface support
Add the AIDL HAL service interface support and abstract the HIDL/AIDL
interface implementations to allow OffloadController to talk to both
interfaces.

Bug: b/205762647
Test: atest com.android.networkstack.tethering
      atest ConnectivityCoverageTests
      atest ConntrackSocketTest
Change-Id: If7634a298d03668ed70b328f1ad6ca0ac0fe170b
2023-03-17 16:56:47 +08: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
Cole Faust
65b2ec8855 Merge "Remove usages of java_api_finder" 2022-12-02 19:31:31 +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
Harshit Mahajan
e210c27140 [TetheringGoogle] Remove explicit targetSdkVersion
Going forward targetSdkVersion would be set by build system.
It would be by default set to 10000 before SDK finalization,
and updated to the new API level after finalization.

Effectively it would mean:
1. '10000' in aosp and internal master
2. Finalized number in development branches like "33" in "tm-dev"
3. As sdk hasn't been finalised in "udc-dev", it would be "10000"
which would be automatically updated to finalized version after sdk finalization.

Removing the target sdk version declaration from the blueprint and manifest files.
More details can be found here go/mainline-modules-target-sdk-version-fix

Bug: b/242296003
Test: croot; sdks=`find ./out -name 'TetheringGoogle.apk' | grep -v .intermediates`; echo $sdks; for sdk in $sdks;do aapt2 dump badging `echo $sdk` | grep targetSdkVersion:; done
1. outputs 33 in tm-mainline-prod
2. outputs 10000 in master

Change-Id: I2657901f066a5220ae0f807846b32b9c41afcce9
2022-10-27 09:47:16 +00:00
Remi NGUYEN VAN
37dc1e2b57 Run R8 with necessary Tethering classpath classes
R8 emits "missing class" warnings when optimizing Tethering.apk
because Tethering packages the already built TetheringApiXLib, but does
not specify any classpath library, which are actually needed for R8.

This causes wrong optimizations, where R8 would sometimes strip out code
that it thinks is unused (because it considers it unreachable due to the
missing class, or it does not know the superclass of a callback and
thinks the overridden methods cannot be called).

Add the necessary classpath libraries to remove the warnings.

Bug: 226127213
Test: m
Change-Id: Icd639d2783a2adc21e05a3b44f276ad72ad1e2d3
2022-08-10 15:30:57 +09:00
Treehugger Robot
a79c227372 Merge "Dedup *fragments information common to apex and sdk" 2022-07-19 08:32:05 +00:00
Xiao Ma
59819aeb0e Deprecate filegroup tethering-module-utils-srcs in tethering.
tethering-module-utils-srcs filegroup only contains NetdUtils.java
class, import this class from netd-client static lib instead.

Bug: 238960524
Test: m
Change-Id: I7547c3a3a13e564408cdf8e702f3438530763381
2022-07-14 13:30:27 +09:00
Paul Duffin
1514c032f5 Dedup *fragments information common to apex and sdk
Previously, both the sdk and apex had to specify the same *fragments
property to ensure that building a system image from a prebuilt
version of the module (both APEX and sdk snapshots) would work.

This change avoids the duplication by adding the apex to the sdk which
allows the sdk to automatically export any APIs and related information
provided by the APEX. At the moment that just includes information from
*fragments properties but may expand in future.

Bug: 232401814
Test: # Build snapshots with a fixed build number
      BUILD_NUMBER=fixed packages/modules/common/build/mainline_modules_sdks.sh
      # Remove api diff files as they contain file stamps of generated files so
      # differ every time they are generated.
      find out/dist/mainline-sdks -name \*txt | xargs rm
      # Save the snapshots away.
      mv out/dist/mainline-sdks before-changes
      # Apply this change.
      # Repeat the first two steps above and then run the following to verify
      # that this change had no effect on the generated snapshot contents.
      meld before-changes out/dist/mainline-sdks
Change-Id: Id98a645a2cdb20bc4bcdc18de565691f1ce7f799
2022-07-13 13:07:46 +00:00
Xiao Ma
c81c066958 Make Tethering module depend on net-utils-device-common-ip.
NetworkStack module utils are duplicated to net-utils-device-common-ip,
delete the module utils source code and use net-utils-device-common-ip
instead.

Bug: 235901424
Test: atest TetheringTests
Change-Id: I19fe72a92d6de1084963c2b3a38d094f8da2a91e
2022-07-13 04:32:28 +00:00
Hungming Chen
01f2550ac4 Move struct {Clat*, Tether4*, TetherStats*} to connectivity module
Needed because these struct classes should not be exposed.
Only used for the connectivity module and its tests.

Bug: 234160319
Test: atest ConnectivityCoverageTests

The moved files are identical.

diff packages/modules/Connectivity/common/src/com/android/net/module/util/bpf/ClatEgress4Key.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/ClatEgress4Key.java
diff packages/modules/Connectivity/common/src/com/android/net/module/util/bpf/ClatEgress4Value.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/ClatEgress4Value.java
diff packages/modules/Connectivity/common/src/com/android/net/module/util/bpf/ClatIngress6Key.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/ClatIngress6Key.java
diff packages/modules/Connectivity/common/src/com/android/net/module/util/bpf/ClatIngress6Value.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/ClatIngress6Value.java
diff packages/modules/Connectivity/common/src/com/android/net/module/util/bpf/Tether4Key.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/Tether4Key.java
diff packages/modules/Connectivity/common/src/com/android/net/module/util/bpf/Tether4Value.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/Tether4Value.java
diff packages/modules/Connectivity/common/src/com/android/net/module/util/bpf/TetherStatsKey.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/TetherStatsKey.java
diff packages/modules/Connectivity/common/src/com/android/net/module/util/bpf/TetherStatsValue.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/TetherStatsValue.java
diff packages/modules/Connectivity/common/src/com/android/net/module/util/bpf/ClatEgress4Key.java frameworks/libs/net/common/device/com/android/net/module/util/bpf/ClatEgress4Key.java
(no diff)

Change-Id: I4ce8045150bdbf04c63c5262c58a0ebcc30d395c
2022-06-29 11:34:19 +00:00
Yi Kong
20a996e1e1 Fix linker error with upstream llvm
https://reviews.llvm.org/rGd07ff995917 changed behaviour of lld and is
no longer accepting single dash `-error-limit`. Update to the new flag
format.

Test: presubmit
Change-Id: I7a78128c56157414411d085086091b9d25be0186
2022-06-21 19:45:01 +00:00
Motomu Utsumi
2111cc0749 Merge "Remove NetworkPermissionConfig package" 2022-06-09 01:24:19 +00:00
Motomu Utsumi
ae27901118 Remove NetworkPermissionConfig package
Move declaration of MAINLINE_NETWORK_STACK permission from the
NetworkPermissionConfig package to the NetworkStack package.

Bug: 223649084
Test: m

(cherry picked from f2bf0335cd)
Merged-In: I7d0565d366892f18dfc510ccbbdbf1eab6f1932a
Merged-In: I1bb172919db1368e1b0a6560d63dc9e35686f89e

Change-Id: I2f8ac1a31b053803bf1b46b4cfcfbf297b8ebec3
2022-06-01 02:55:22 +00:00
Mark Chien
d25a1e05ae Bump tethering target sdk to 33
Note: to avoid missing some dependeices change only happen in T+, below
testing verification is perform by internal branch.

Test: atest TetheringTests
      atest TetheringIntegrationTests
      atest CtsTetheringTest
      atest MtsTetheringLatestSdk
      manually change entitlement check recheck period to 1 min and
      monitor schedule alarm works.
      Dogfood this change personally 7 days, major use hotspot sharing network to notebook to work.
Bug: 232193147
Change-Id: I3cba98f42ac1a9c0c1db4b2ad036aff714a428f3
2022-05-31 03:31:18 +00:00
Wayne Ma
7ecded8248 Injecting tethering stats into statsd
Fill in downstream type, upstream type, error code and user type to NetworkTetheringReported.

Bug: 153942334
Test: m, flash and boot
Test: atest TetheringMetricsTest
Change-Id: I6ba7d9e512b1ada519f44f9f3a95667e4b0f03c0
2022-05-09 19:35:53 +08:00
Wayne Ma
71d66396d2 Adding Tethering proto
Bug: 153942334
Test: m, flash and boot
Change-Id: I853d3a4dd914dd0c65a6c9e1749d8898da68540e
2022-03-24 17:40:31 +08:00
paulhu
537f72061a Rename framework-connectivity-tiramisu to framework-connectivity-t
Bug: 215434166
Test: build, flash, device boot to home.
Merged-In: I9ebedf8813cbfa30d979bc35a3b2306715be682b
Change-Id: I9ebedf8813cbfa30d979bc35a3b2306715be682b
2022-03-01 09:44:21 +08:00
Junyu Lai
eb6f4bef96 [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
2022-02-28 03:24:19 +00:00
Treehugger Robot
a828eb711c Merge "Move permissions allowlist for Tethering" 2022-02-15 04:43:27 +00:00
Andrei Onea
52eac028fc Move permissions allowlist for Tethering
The allowlist will now be in the apex instead.

Test: boots && check permissions.xml is bundled
Bug: 190375768

Change-Id: Ia7434cba54d2b51479e52323f22c7f454499991d
2022-02-10 15:04:46 +00:00
Maciej Żenczykowski
2f7dac1bad remove spurious headers
bpf_connectivity_headers already pulls in bpf_headers,
which already pulls in bpf_syscall_wrappers.

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ib22da8d433bd3187349f06f41ec064360c38982f
2022-02-02 16:38:36 -08:00
Patrick Rohr
8dfcb14be3 Remove libtcutils from dependencies as it is included in lib bpfjni
Test: builds && boots
Change-Id: Iacaed446655a606399188b8e5e4a5e98fefee121
2022-02-02 19:40:12 +00:00
Treehugger Robot
2be7b1d5fb Merge "Conditionally disable TetheringApiCurrentLib" 2022-01-28 05:21:22 +00:00
Remi NGUYEN VAN
f826bce37a Conditionally disable TetheringApiCurrentLib
The "current" targets are only necessary in branches that can use
non-stable APIs, and can fail to build otherwise.

Apply ConnectivityNextEnableDefaults so they are disabled on such
branches. Also deprecate NetworkStackNextEnableDefaults, so
ConnectivityNextEnableDefaults is used everywhere.

Bug: 190249673
Test: m
Change-Id: I1b152f3cc22f1bed6444d280f0066e480980e949
2022-01-27 18:49:19 +09:00
Roopa Sattiraju
27acf0b677 Adding bt dependency
Bug: 206121418
Test: Compile
Merged-In: I92f3971ba1bb7e873166482f7051dcd2b9df5bf2
Change-Id: I92f3971ba1bb7e873166482f7051dcd2b9df5bf2
2022-01-25 20:27:30 -08:00
Maciej Żenczykowski
612afc316a Merge "Move BpfUtils -- integrate TcUtils into Tethering module" 2022-01-14 02:53:15 +00:00
Patrick Rohr
a881ba3001 Move BpfUtils -- integrate TcUtils into Tethering module
Bug: 202086915
Bug: 157552970
Test: atest TetheringTests
Change-Id: Ibf9d8d568b9f890a22869e70384848e33a380d4f
2022-01-13 10:09:11 +01:00
Treehugger Robot
0d4f956b34 Merge "Bump tethering target sdk version to 31" 2022-01-13 05:00:02 +00:00
markchien
bf62258f8c 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
2022-01-12 07:24:16 +00:00
Jiakai Zhang
86c139aedb Dexopt service-connectivity.
`service-connectivity` is a jar that system_server loads dynamically.
Such jars can be dexopted now. This CL adds `service-connectivity` to a
`systemserverclasspath_fragment`, which does not actually add the jar to
the classpath, but tells the build system to dexopt it.

NOTE: The corresponding `exported_systemserverclasspath_fragments` needs
to be added to the `prebuilt_apex` once a new prebuilt is dropped.

Bug: 203198541
Test: m com.android.tethering
Change-Id: I53745baaf1bc7142cc12a1e6cd8d84c9b338ac9d
Merged-In: I53745baaf1bc7142cc12a1e6cd8d84c9b338ac9d
Merged-In: I9a009493fe0482967ab1f92516514715cfd457d6
2021-12-21 09:36:33 +00:00
Chiachang Wang
81bc609550 Merge "Enable strict_updatability_linting in connectivity src" 2021-12-08 02:36:16 +00:00
Ken Chen
5fabfd8dd0 Merge "[NETD-BPF#3] Relocate Tethering/bpf_progs and rename bpf_tethering_headers" 2021-12-02 12:54:01 +00:00
Chiachang Wang
3bc5276568 Enable strict_updatability_linting in connectivity src
Bug: 188851968
Test: m lint-check
Change-Id: I3cd06ea16f05cb37d9369a48dd0285d8239fd764
2021-11-26 10:31:58 +08:00
markchien
598a75ba8c 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
2021-11-24 12:20:23 +08:00
Ken Chen
bb57fa9eec [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
2021-11-20 18:31:08 +08:00
markchien
782a56809b Rename libbpfmapjni and include bpf common util library
1. libbpfmapjni.so is rename to libnet_utils_device_common_bpf.so
2. net-utils-device-common-bpf.jar is separated from
   net-utils-device-common-netlink.jar

Bug: 205088391
Test: atest TetheringTests
      atest CtsTetheringTest
      atest TetheringPrivilegedTests

Change-Id: If59b35b3429ebd597c18678499ff458183f89026
2021-11-11 13:49:15 +08:00
markchien
f967b11087 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
2021-11-10 14:07:24 +08:00
markchien
5a8c806e55 Separate tethering build target to Tethering and TetheringNext
To avoid much code diverge between aosp and its downstream, we need to
separate the build target which build with latest stable sdk in release
branch and build with unfreeze sdk in dev branch. So we could use new
API with APIshim in dev branch without impacting release branch.

BYPASS_INCLUSIVE_LANGUAGE_REASON=the wording is the file name of
existing file.
Bug: 204265450
Test: m
Change-Id: I949fd83b1eed7461e0b381193b190cf15080bc1b
2021-11-04 08:53:12 +00:00
Maciej Żenczykowski
bb4c6073ec Merge "bpfmap: Move to Common Location" 2021-11-04 01:50:15 +00:00
Tyler Wear
e8043ca762 bpfmap: Move to Common Location
Move bpfmap to frameworks/libs/net/common/native.

Bug: 179733303
Change-Id: Id08b216ec6a64968d66d7990f91ea7ce222a1154
2021-10-29 09:05:33 -07:00
William Escande
ea9e22e10b Dependency update for StateMachine
StateMachine was in a custom filegroup in base.
It's now built in stand-alone library in modules-utils.

Bug: 198418216
Tag: #refactor
Test: Build
Merged-In: I7499fad6c4c5076e2bd98f0d9f91c5f243fb1ed2
Change-Id: I7499fad6c4c5076e2bd98f0d9f91c5f243fb1ed2
2021-10-01 17:06:42 +02:00
Xiao Ma
09c0727e9e Import net-utils-device-common-netlink instead of netlink-client.
After moving all netlink-client stuff to frameworks/libs/net/common
and build it as an individual library, deprecate the netlink-client
lib and use net-utils-device-common-netlink instead.

Due to that the package name of netlink lib has changed, also update the
package name used in Tethering and ConnectivityService module.

Bug: 192535368
Test: atest TetheringTests TetheringIntegrationTests
Change-Id: Ic2078caf67a640836d98c5a2e4ca89939adcb896
2021-07-21 09:10:22 +00:00
Junyu Lai
69bc4fede1 Merge "[SP32] Try to get 1.1 OffloadControl hardware if available" 2021-06-22 20:31:18 +00:00
Anton Hansson
a12ffacf6c Add tethering bootclasspath fragment to its sdk
This subsumes the java_sdk_library in the sdk.

Bug: 188427719
Test: build_mainline_modules.sh
Change-Id: Ib2ebb3893135b4dd91812f1f1b0915540cfd64cb
Merged-In: Ib2ebb3893135b4dd91812f1f1b0915540cfd64cb
(cherry picked from commit 3669599dec)
2021-06-14 19:23:49 +01:00
Aaron Huang
3f69f1c418 Add required permission to Tethering
The permission of Tethering is moved to a separate xml file,
add the xml module to the required field of tethering app.

Bug: 151213404
Test: TetheringTests
Merged-In: I40b45a0f1b44fba0b68e94811d14725a59ed4e59
Change-Id: I40b45a0f1b44fba0b68e94811d14725a59ed4e59
2021-05-26 23:29:55 +08:00
junyulai
b95083ea6a No-op Refactoring of startTrackDefaultNetwork
While the actual part that track default request is inside
UpstreamNetworkMonitor, instead of passing it from Tethering,
move it into counter-part CL and use it from
UpstreamNetworkMonitor.

Since the current code is replaced by registerSystemDefaultCallback
in Android S, implement it inside the api30 shim implementation
to provide an unified interface to tethering.

Test: atest TetheringCoverageTests
Bug: 185952829
Change-Id: Iaf21b6b662aa6aba79c2b75379128b8523f81f02
2021-05-13 14:07:40 +08:00