Commit Graph

58 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
85a4e07826 Add visibility for core tests
Allow core tests to use hidden connectivity APIs. Benchmark tests in
particular cannot be run without these.

Ignore-AOSP-First: Avoiding merge conflicts, cherry-pick will follow
Bug: 197717846
Test: m
  (cherry-picked from ag/16772124)
Change-Id: Ia01f24317d14b063f9a7e24c3ada11b140641c50
Merged-In: Ia01f24317d14b063f9a7e24c3ada11b140641c50
2022-02-09 23:08:37 +08:00
Aaron Huang
720ad7c026 Have connectivity targets be visible to Frameworks[Vcn|Ike]Tests
(cherry picked from commit 7174ac3d86)
Bug: 204153604
Ignore-AOSP-First: part of large topic that only builds internally
Test: build, FrameworksVcnTests, FrameworksIkeTests
Change-Id: I40740200fe4a7476a21bb5330429a11c97e38fb8
Merged-In: I40740200fe4a7476a21bb5330429a11c97e38fb8
2022-02-08 14:31:27 +00:00
Lorenzo Colitti
eb8d8554bb Rename NetworkUsageStatsTest and move to networking CTS tests.
NetworkUsageStatsTest is the CTS test for the NetworkStatsManager
public APIs. Rename it to NetworkStatsManagerTest, since that is
a better name for it.

Also move it to the networking CTS tests, where it will run on
presubmit on every supported Android version (S, T), and can
access hidden networking APIs. This is important because
NetworkStatsManager is being mainlined in T.

Bug: 204830222
Test: atest CtsNetTestCases:NetworkStatsManagerTest
Change-Id: Ie0fd267aa8bf94594fcc939a8493bef8ab14d3fe
2022-02-01 11:24:39 +00:00
Remi NGUYEN VAN
6a20eeda42 Reorganize connectivity framework dependencies
Allow framework-connectivity to depend on framework-connectivity-t
stubs, and framework-connectivity-t to depend on prebuilt (to avoid
circular dependencies) framework-connectivity stubs to compile its own
stubs, and framework-connectivity.impl to compile its implementation.

Also reorganize jarjar rules so that service and framework jar can use
static libraries in framework-connectivity without packaging their own,
reducing duplicate code.

Bug: 204830222
Test: m
Change-Id: I75c34986e7c479de23cdb2e9b360fa1fede018c9
2022-02-01 13:33:48 +09:00
Paul Hu
a77cad355b Merge "Build framework-connectivity-tiramisu library" 2022-01-20 03:02:56 +00:00
Siim Sammul
cd4c8228bd Include "generate_transaction_name" in the aidl build rules for
Connectivity as otherwise method names are not visible in the collected
binder latency data.

Test: N/A
Bug: 208515821
Change-Id: I0e6c6dcd4663f0abe473d39f7de4c718ac3fb66f
2022-01-06 15:21:13 +00:00
paulhu
802ab9760f Build framework-connectivity-tiramisu library
- Move nsd APIs and build framework-connectivity-tiramisu library
- Add nsd associated hidden apis
- Build service-connectivity-tiramisu-pre-jarjar library for
  T+ services.
- Move ConnectivityServiceInitialiizer to service-t directory
  to create S+ service instances which can avoid dependency on
  lower sdk library.

Bug: 206893064
Test: atest FrameworksNetTests CtsNetTestCases
CTS-Coverage-Bug: 207804007
Merged-In: I9628716f5c38047ff4ea2346b27589077259c436
Change-Id: I9628716f5c38047ff4ea2346b27589077259c436
2021-12-17 00:04:24 +08: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
Chalard Jean
dece0d805f S- not to crash on NetworkInfo(null) or setDetailedState(null)
When NetworkInfo(null) or setDetailedState(null, any, any) are
called, S used to not crash but plant a null bomb for later
which may explode in some calls (notably, parceling) : see the
bug referenced below for details.

To help catching these errors earlier a patch was made to crash
as soon as one of these methods is called with a null argument,
but this will also crash incorrect use on existing code that
may never actually step on the mine, crashing code that used not
to crash. For safety, implement the new behavior only on T.

Bug: 145972387
Test: NetworkInfoTest
Change-Id: Ib710497d83b2d26439c2bd4d2f572310db97d6fd
2021-11-15 21:18:25 +09:00
Orion Hodson
f59ce8f0cc Merge "Remove dependency on stable.core.platform.api.stubs" am: f15f2769b4 am: cfa0d8026b
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1751523

Change-Id: I626a0817b64678929054fd26aa0ca22372ca2f2c
2021-07-01 19:29:04 +00:00
Victor Chang
c3815ee358 Remove dependency on stable.core.platform.api.stubs
Bug: 183097033
Test: m droid
Change-Id: I06cbc7e06e112d61575fad6ad0783348c94e3df2
2021-06-29 22:31:05 +01:00
Remi NGUYEN VAN
3912c80e99 Add framework-connectivity-test-defaults
The defaults follow the same pattern as framework-wifi-test-defaults to
allow unit tests to build against hidden API in Connectivity.

(clean cherry-pick of history in downstream branch)

Bug: 171540887
Test: m
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ia8531f672820fcc8968f98494903e486c4e42652
2021-06-08 19:54:27 +09:00
Remi NGUYEN VAN
e70cd84601 Merge framework-connectivity impl and stub targets
Instead of using api_only: true, use a single java_sdk_library to
generate both framework-connectivity stubs and
framework-connectivity.impl.

Original change (project moved):
I76d7cf1ba31a3f38ae6b9facbf1b668860c8c165

Bug: 183600168
Test: m
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: I07d8c4c92c91939b8e8890fdb5db517b75faee2c
2021-06-08 15:24:05 +09:00
Remi NGUYEN VAN
da43ef0b68 Add min_sdk_version to connectivity targets
All targets need min_sdk_version 30 to be included in the tethering
APEX. They will actually never be used on SDK 30 and are only loaded on
31, but this is necessary to be included in com.android.tethering.

Original change (project moved):
I190fd1f3c9fabff057d0a2bd7f45b63a4fe447b3

This also includes changes to the lint baseline to make it match actual
filenames.

Bug: 171540887
Test: m
Test: m lint-check
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: I24198565bc98d85d0c036be02e3a6c311b5bb2a3
2021-06-08 15:23:40 +09:00
Remi NGUYEN VAN
ccd2a6aeb4 Revert "Add min_sdk_version to connectivity targets"
This reverts commit 0b900c91f6.

Reason for revert: Broke errorprone: b/190454846

Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: I21de7e7e06daa5f4a688b4246986f8d44da97c91
Fixes: 190454846
2021-06-08 04:50:01 +00:00
Remi NGUYEN VAN
0b900c91f6 Add min_sdk_version to connectivity targets
All targets need min_sdk_version 30 to be included in the tethering
APEX. They will actually never be used on SDK 30 and are only loaded on
31, but this is necessary to be included in com.android.tethering.

Original change (project moved):
I190fd1f3c9fabff057d0a2bd7f45b63a4fe447b3

Bug: 171540887
Test: m
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: I3db00acc79b11058a1c235916b9bfe6c759afda5
2021-06-08 09:28:26 +09:00
Remi NGUYEN VAN
0ad52839e7 Revert "Add min_sdk_version to connectivity targets"
This reverts commit 326f7bb023.

Reason for revert: broke errorprone:
"Error: Call requires API level 31 (current min is 30)"

Bug: 190350403
Change-Id: Ib778ba7a882dabc4d42ab9689e1cc51d09d9be62
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
2021-06-07 08:56:05 +00:00
Remi NGUYEN VAN
326f7bb023 Add min_sdk_version to connectivity targets
All targets need min_sdk_version 30 to be included in the tethering
APEX. They will actually never be used on SDK 30 and are only loaded on
31, but this is necessary to be included in com.android.tethering.

Original change (project moved):
I190fd1f3c9fabff057d0a2bd7f45b63a4fe447b3

Bug: 171540887
Test: m
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ied5faa1a370cbc8836f46388fdb9b42d2a263232
2021-06-01 18:43:03 +09:00
Remi NGUYEN VAN
4be92df27b Build connectivity JNI against libc++_static
Instead of including the whole libc++ library by linking it dynamically,
use the static version so that unused symbols can be stripped.

This allows reducing the APEX size by 1MB (3.7MB -> 2.7MB), as otherwise
libc++ is included twice for 32 and 64 bit variants.

Original change (project moved):
Ia66d795cf23d6f45997278300c103976433f7c5c

Bug: 171540887
Test: Device boots and has connectivity, size reduced

Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ie1c5b2ea274238a226ad2d827148439fd5758bb5
2021-06-01 18:40:25 +09:00
Remi NGUYEN VAN
8d1a96d9ea Remove dependency on libnetd_client
NetworkUtils can just use the NDK to achieve the same.

Also make sure network handles can have the local nameservers flag, for
the JNI API, and create/parse them accordingly in Network.

Original change (project moved):
I2e7b78263f7ca0cab9458854858a7423f6bd2854

Bug: 171540887
Test: atest CtsNetTestCases (in particular MultinetworkApiTest,
          DnsResolverTest, NetworkTest)
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: I7a523aac93094beef6ff40d50678c12fe8840940
2021-06-01 18:40:06 +09:00
Remi NGUYEN VAN
a5e1148a4b Add NDK API for getprocnetwork
The API is the getter couterpart for setprocnetwork.
Use it in NetworkUtils so that the NDK API can be the source of truth
for the process network.

Original change (project moved):
Ie8f68cf1fa57deddb63324c1abf3d6fd5b0ef500

Bug: 171540887
Test: atest CtsNetTestCases
      Tests in change I311b58585033c2ca50ce5477ea9cd94b6f127507
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Iaf255f4aa29fd2ae02770baea5548ee8d5d407f2
2021-06-01 18:38:53 +09:00
Aaron Huang
cff22949d2 Remove framework-connectivity-annotations library
This library can be removed because the annotations are no longer
used out of module.

@RestrictBackgroundStatus and @MultipathPreference are defined
in connectivity mainline module. Annotate these in non-updatable
platform is not going to be manageable long term. For example,
if the module gets updated and the annotation gets more values
then it's a problem in non-updatable platform. So, it should
not have IntDef cross module boundaries.

Ignore-AOSP-First: AOSP doesn't include this change yet
Bug: 183972925
Test: build
Change-Id: I63f1fde73c4ffdaff9fda914e33cbb5a110ba64e
2021-06-01 06:47:47 +00:00
Baligh Uddin
3684713b8a Merge history of packages/Connectivity
Modified License Import for:
- Tethering/common/TetheringLib/Android.bp
- framework/Android.bp
- service/Android.bp
- tests/common/Android.bp
- tests/deflake/Android.bp
- tests/integration/Android.bp
- tests/smoketest/Android.bp
- tests/unit/Android.bp
- tests/unit/jni/Android.bp

BUG: 186628461
TEST: TH
Merged-In: I7b5fd61cd551c7010f5b8ceabbfdd04f30f648dd
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ia2185820f485e8ad2d3626a96eab7f5a874736cf
2021-05-24 05:45:18 +00:00
Baligh Uddin
2afd0986d3 Merge history of packages/Connectivity
Modified Visibility / Includes for:
- Tethering/common/TetheringLib/Android.bp

Modified License Import for:
- framework/Android.bp
- service/Android.bp
- tests/common/Android.bp
- tests/deflake/Android.bp
- tests/integration/Android.bp
- tests/smoketest/Android.bp
- tests/unit/Android.bp
- tests/unit/jni/Android.bp
Modified Lint mapping for:
- framework/lint-baseline.xml
- service/lint-baseline.xml

BUG: 186628461
TEST: TH
Merged-In: Ie82d0fb34bda77543e31c82660c6f315efa87f62
Change-Id: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
2021-05-24 04:40:14 +00:00
Aaron Huang
6a7e6ad55c Add ConnectivityAnnotations class
This change is to address API review, add respective
@IntDef for network policy API.

Typedef cannot be exposed as SystemApi so add
ConnectivityAnnotations class and add an annotation library
so that it can be used in module and platform.

Bug: 183972925
Test: m, build doc target framework-doc-stubs_annotations.zip
      and check the APIs have an attribute IntDef annotation
Change-Id: Ie3ec40cf48818edd422a4550377774eae387d3b2
2021-05-14 10:30:49 +08:00
Remi NGUYEN VAN
678277cc03 Move net unit tests to packages/Connectivity
Move the tests together with packages/Connectivity code, so both can be
moved to packages/modules/Connectivity together.

Also reorganize unit tests in a unit/ directory, as other tests
(integration/, common/ etc.) have been added in tests/net since they
were created. This makes the directory structure consistent.

Test: atest FrameworksNetTests
Bug: 187814163
Ignore-AOSP-First: needs per-branch move for merge conflicts
Change-Id: I254ffd1c08ec058d594b4ea55cbae5505f8497cc
2021-05-13 05:55:44 +00:00
Remi NGUYEN VAN
1fd558efee Move NetworkUtils JNI out of core/jni
Keep the utilities included via a library, but move them out of
core/jni, and prepare a library to package them together with
framework-connectivity.

Also remove unnecessary dependencies in framework-connectivity.

Bug: 171540887
Test: device boots and has connectivity

Merged-In: I0b55dfe92f3cb6e848d79ac7953756f39aaa2597

Change-Id: I0b55dfe92f3cb6e848d79ac7953756f39aaa2597
2021-05-11 13:02:39 +00:00
Remi NGUYEN VAN
e4d51c9710 Build framework-connectivity using module_current
framework-connectivity needs to build only against stable APIs.

Bug: 171540887
Test: m framework-connectivity.impl
Merged-In: I2d51d37d067bf6fe86e4dedf05855a2dd67ed57c

Change-Id: I2d51d37d067bf6fe86e4dedf05855a2dd67ed57c
2021-05-11 13:00:42 +00:00
Chiachang Wang
3270871367 Extend framework-connectivity.impl visibility
Allow netlegacy22.api to use hidden connectivity methods.

Bug: 182859030
Test: m
Change-Id: I92936afb9fb533ea3b426490eb9617389f99fc8b
2021-04-15 13:06:39 +08:00
Chiachang Wang
426a6de6b3 Extend framework-connectivity.impl visibility to more test
Allow captive portal tests to use hidden connectivity methods.

Bug: 182859030
Test: m
Change-Id: I2c51cbefa6d56c7ec53bacfffe735fa9d14c6510
2021-04-13 12:53:06 +08:00
Chiachang Wang
2320733615 Merge "Add visibility of framework-connectivity.impl for wifi test" into sc-dev 2021-04-06 00:23:37 +00:00
Remi NGUYEN VAN
df6ce19fa9 Merge "Reduce framework-connectivity footprint" into sc-dev 2021-04-05 02:15:32 +00:00
Remi NGUYEN VAN
deed4cbcf9 Reduce framework-connectivity footprint
Cleanup framework-connectivity to reduce its memory and storage usage:
 - Build libframework-connectivity-jni using standard C and removing
   dependencies on libc++. This saves about 100kB of storage (40+60kB
   on the 32+64 bit variants).
 - Remove dependency on protobuffer libraries, as their usage has been
   removed. This saves about 15kB of storage.

From local measurements, the reduced code size also improves memory
usage.

This also removes a jarjar workaround for net-utils-device-common, as
the library is no longer used either.

Bug: 184111895
Test: device boots, connectivity working
Change-Id: Ibfbd0fe1098293812ae24812621752a7a44f9130
2021-04-02 10:18:00 +00:00
Chiachang Wang
e9d848e7cb Add visibility of framework-connectivity.impl for wifi test
Add visibility to allow FrameworksWifiTests to access hidden
connectivity APIs.

Bug: 171540887
Test: m FrameworksWifiTests
Change-Id: I3cd377d7045e7e161d0813aa2d614dff1b5a311b
2021-03-31 09:33:21 +00:00
Remi NGUYEN VAN
173f8b129d Add framework-connectivity-test-defaults
The defaults follow the same pattern as framework-wifi-test-defaults to
allow unit tests to build against hidden API in Connectivity.

Bug: 171540887
Test: m
Change-Id: I58bb6574f7e95053e4a95f76d1025506749ec2b8
2021-03-31 17:19:57 +08:00
Remi NGUYEN VAN
75c959e718 Use connectivity APIs from framework-connectivity
Instead of compiling framework-connectivity source into
frameworks-minus-apex, have the APIs loaded separately from
framework-connectivity.

Bug: 171540887
Test: device boots, has connectivity
Change-Id: I8f07ff2082c3de80821e121807e66a43a870de7b
2021-03-25 06:34:52 +00:00
Remi NGUYEN VAN
71d64e746d Merge framework-connectivity impl and stub targets
Instead of using api_only: true, use a single java_sdk_library to
generate both framework-connectivity stubs and
framework-connectivity.impl.

Bug: 183600168
Test: m
Change-Id: I76d7cf1ba31a3f38ae6b9facbf1b668860c8c165
2021-03-24 23:52:58 +09:00
Remi NGUYEN VAN
b36fb99561 Add min_sdk_version to connectivity targets
All targets need min_sdk_version 30 to be included in the tethering
APEX. They will actually never be used on SDK 30 and are only loaded on
31, but this is necessary to be included in com.android.tethering.

Bug: 171540887
Test: m
Change-Id: I190fd1f3c9fabff057d0a2bd7f45b63a4fe447b3
2021-03-24 10:08:39 +00:00
Remi NGUYEN VAN
47cc651269 Build connectivity JNI against libc++_static
Instead of including the whole libc++ library by linking it dynamically,
use the static version so that unused symbols can be stripped.

This allows reducing the APEX size by 1MB (3.7MB -> 2.7MB), as otherwise
libc++ is included twice for 32 and 64 bit variants.

Bug: 171540887
Test: Device boots and has connectivity, size reduced

Change-Id: Ia66d795cf23d6f45997278300c103976433f7c5c
2021-03-24 10:08:39 +00:00
Remi NGUYEN VAN
6b0c407133 Remove dependency on libnetd_client
NetworkUtils can just use the NDK to achieve the same.

Also make sure network handles can have the local nameservers flag, for
the JNI API, and create/parse them accordingly in Network.

Bug: 171540887
Test: atest CtsNetTestCases (in particular MultinetworkApiTest,
          DnsResolverTest, NetworkTest)
Change-Id: I2e7b78263f7ca0cab9458854858a7423f6bd2854
2021-03-24 10:08:39 +00:00
Remi NGUYEN VAN
31f329e987 Add NDK API for getprocnetwork
The API is the getter couterpart for setprocnetwork.
Use it in NetworkUtils so that the NDK API can be the source of truth
for the process network.

Bug: 171540887
Test: atest CtsNetTestCases
      Tests in change I311b58585033c2ca50ce5477ea9cd94b6f127507
Change-Id: Ie8f68cf1fa57deddb63324c1abf3d6fd5b0ef500
2021-03-23 01:01:06 +00:00
Remi NGUYEN VAN
f96b26606a Add connectivity protos to framework-connectivity
The protos are built separately by framework-connectivity from framework
protos, keeping only android.net protos for the connectivity jar.

Bug: 171860710
Test: m framework-connectivity.impl
Change-Id: I2c4a37ff2ee9e8efde49885feeafa27dcff7ca2c
Merged-In: I2c4a37ff2ee9e8efde49885feeafa27dcff7ca2c
2021-03-20 22:51:35 +09:00
Remi NGUYEN VAN
c58c993dda Move NetworkUtils JNI out of core/jni
Keep the utilities included via a library, but move them out of
core/jni, and prepare a library to package them together with
framework-connectivity.

Also remove unnecessary dependencies in framework-connectivity.

Bug: 171540887
Test: device boots and has connectivity

Change-Id: I0b55dfe92f3cb6e848d79ac7953756f39aaa2597
2021-03-19 11:01:17 +00:00
Remi NGUYEN VAN
3b52af9c6e Build framework-connectivity using module_current
framework-connectivity needs to build only against stable APIs.

Bug: 171540887
Test: m framework-connectivity.impl
Change-Id: I2d51d37d067bf6fe86e4dedf05855a2dd67ed57c
2021-03-19 06:02:43 +00:00
Remi NGUYEN VAN
8c2d521b8d Add connectivity protos to framework-connectivity
The protos are built separately by framework-connectivity from framework
protos, keeping only android.net protos for the connectivity jar.

Bug: 171860710
Test: m framework-connectivity.impl
Change-Id: I2c4a37ff2ee9e8efde49885feeafa27dcff7ca2c
2021-03-18 08:07:20 +00:00
Remi NGUYEN VAN
2c196b6487 Merge "Add framework-connectivity.impl" am: 0fcb8d6db4 am: 5e478bf5bf am: 954160f749
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1635039

Change-Id: Ief30f77f949669d9b52ae3a6fe84f8db91179841
2021-03-18 04:36:38 +00:00
Remi NGUYEN VAN
5e478bf5bf Merge "Add framework-connectivity.impl" am: 0fcb8d6db4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1635039

Change-Id: I9956c78228c2d04e20edf6fee1061861e26978b9
2021-03-18 03:33:42 +00:00
Remi NGUYEN VAN
eb6aa22205 Add framework-connectivity.impl
The library will be included in the connectivity module APEX when
migrating its sources out of framework-minus-apex.

Bug: 171540887
Test: m
Change-Id: I1595521eaced6e6997c076bb56b06ffdd22a4fa0
2021-03-18 00:29:08 +09:00
Remi NGUYEN VAN
5b9dd87333 Remove extra comment
This fixes a merge conflict with downstream branches due to an
incomplete cherry-pick.

Bug: 171540887
Test: m

Change-Id: I27a8f20f1a1d83b472700648f3f5a68413a76ac3
Merged-In: I7432fe4c87cd3cab04dcb6185c9a4f3f84376549
2021-03-17 10:58:08 +00:00
Remi NGUYEN VAN
f15fc7f9a8 Split out the connectivity API surface
Split out connectivity APIs to connectivity module directories. This
prepares future move of the connectivity code into a mainline module,
but still keeps it implemented by framework-minus-apex for now: the API
stubs are moved to framework-connectivity.stubs, but the implementation
on device remains in the same place.

This allows moving the connectivity code in/out of APEX with minimal
changes.

BYPASS_INCLUSIVE_LANGUAGE_REASON=Moving files, can't modify released API

Bug: 171540887
Test: device boots, connectivity working

Merged-In: I21c42f032efa6c10e36c749df3183ce9679303a7
(cherry-pick from internal branch with API files conflicts)

Change-Id: I21c42f032efa6c10e36c749df3183ce9679303a7
2021-02-26 19:23:25 +09:00