Commit graph android_packages_modules_Co.../staticlibs
Message SHA1
Make sure no suppressed expression is present when they shouldn't
In fact the test already passes, because addSuppressed contains
an explicit test that if this === argument, then it doesn't add
it. But otherwise that's a bug in tryCleanup

Test: NetworkStaticLibTests
Change-Id: I202790bbe8d82445c5affdd9076561c2c6ea9b59

Chalard Jean   commited 2021-11-24 17:07:28 +09:00
bfbcacef6d
Replace assert with assertTrue in CleanupTest
Test: NetworkStaticLibTests
Change-Id: I9b403d4d3491a5ee34b69d1fa4767defdaff70c2

Chalard Jean   commited 2021-11-24 16:34:24 +09:00
cf858ba920
Merge "Enable strict_updatability_linting in frameworks/libs/net"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-11-22 02:48:24 +00:00
a37d20ed00
Merge "Fix libs/net tests package"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-11-19 15:38:36 +00:00
1f8da2f79a
Fix libs/net tests package
Move test classes that were not in the same com.android.module.util
package as their associated class into the right package, and make
net-utils-service-common visible to tests.

Bug: 207020032
Test: atest ConnectivityCoverageTests
Change-Id: Iabe86a7d4c2437b3d01d68d53fb01d4e3c05a02b

Remi NGUYEN VAN   commited 2021-11-19 18:33:12 +09:00
0cf724af27
Enable strict_updatability_linting in frameworks/libs/net
Enable the strict_updatability_linting here first as a prior
commit to enable strict_updatability_linting in connectivity
modules.

Bug: 188851968
Test: m lint-check ; atest NetworkStaticLibTests
Change-Id: Idac98a1c85bf5bb86269b1daad2b444cfb58db8a

Chiachang Wang   commited 2021-11-19 15:41:27 +08:00
7068c88921
switch to using OWNERS from master branch of Connectivity module
Test: N/A
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: If8c59abaf706b4c787be6454c08be3e26212ba21

Maciej Żenczykowski   commited 2021-11-17 10:58:14 -08:00
307c3db71d
Merge "Add net-utils-annotations lib"
Paul Hu   authored and   Gerrit Code Review   commited 2021-11-17 03:22:45 +00:00
eae8038cd7
[LSC] Add LOCAL_LICENSE_KINDS to frameworks/libs/net
Added SPDX-license-identifier-Apache-2.0 to:
  common/testutils/app/connectivitychecker/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Change-Id: I9e25f435ce9835f12a167e6c57e33f6d87c159de

Bob Badour   commited 2021-11-11 10:10:56 -08:00
891a3b9fb7
Merge changes from topics "rename-libbpfmapjni", "rename-libtetherutiljni"
* changes:
  Separate bpf and struct util from netlink util library
  Use JniUtil.getJniLibraryName to find library name
  Add JniUtil to identify jni library by package name

Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2021-11-11 13:19:48 +00:00
da1b5e08ce
Separate bpf and struct util from netlink util library
1. Separate bpf and struct libraries from netlink library.
2. Rename bpfmap jni library to respect its java side library.
3. Add README to explain the rules of adding shared jni library.
4. Also allow packages/modules/Connectivity to use bpf library.

Bug: 205088391
Test: atest TetheringTests
      atest CtsTetheringTest
      atest TetheringPrivilegedTests
      atest ConnectivityCoverageTests
Change-Id: I6e668818bede63b241cd901c0967f401613ddaf6

markchien   commited 2021-11-11 18:50:53 +08:00
f3448f905a
Use JniUtil.getJniLibraryName to find library name
Bug: 205088391
Test: atest TetheringTests
      atest CtsTetheringTest
      atest TetheringPrivilegedTests
Change-Id: Ie865f6ef828a7a706ed76cafadc0403511a28cff

markchien   commited 2021-11-11 18:33:19 +08:00
a5cbda3ca8
Add JniUtil to identify jni library by package name
Bug: 205088391
Test: atest NetworkStaticLibTests
Change-Id: I4ace7803f246bb396f53d878064fec1204e7c1ef

markchien   commited 2021-11-11 18:33:04 +08:00
a14fb38df4
Merge "Move TETHERING_MODULE_NAME to libs/net"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-11-10 04:09:49 +00:00
47b2acb829
Move TETHERING_MODULE_NAME to libs/net
The constant is useful for both Connectivity and Tethering when they
want to check the APEX version. Include it in DeviceConfigUtils, as this
is what it will be used for.

Bug:
Test: atest ConnectivityServiceTest
Change-Id: Ib7a7677ca2954974613df25a105a65fe5d971afc

Remi NGUYEN VAN   commited 2021-11-08 17:37:12 +09:00
6e33f78dfd
Merge "Add data structures to parse netlink route messages."
Xiao Ma   authored and   Gerrit Code Review   commited 2021-11-05 09:41:19 +00:00
c9bcec238c
Add data structures to parse netlink route messages.
Bug: 163492391
Test: atest NetworkStaticLibsTests
Change-Id: If8c960849f4840b7c516c0d2579da8a805978e13

Xiao Ma   commited 2021-11-05 07:21:29 +00:00
2c0b10cb0a
Merge "Add ConnectivityCheckTargetPreparer"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-11-05 04:27:47 +00:00
342d2bc68f
Add ConnectivityCheckTargetPreparer
ConnectivityCheckTargetPreparer is a tradefed target preparer that uses
the connectivitychecker app to verify device configuration, before
running any test.

The connectivitychecker app verifies that the device has a
pre-configured wifi configuration and can connect to it (except for
virtual devices where it may create the configuration itself), and
verifies that the device has a data-enabled SIM card inserted.

Checks are skipped if the device is not wifi- or mobile data-capable,
and can be skipped for local testing by running with:

  atest X -- --test-arg \
    com.android.testutils.ConnectivityCheckTargetPreparer:disable:true

Test: atest CtsNetTestCasesLatestSdk
Change-Id: I5b6d34a6c393863af23af57ff026b15973e9e784

Remi NGUYEN VAN   commited 2021-11-04 19:57:21 +09:00
c02dcd721a
Add net-utils-annotations lib
- Move PolicyDirection into frameworks/libs/net
- Add net-utils-annotations lib for those methods that are using
  PolicyDirection annotation.
- Add net-utils-annotations-srcs for including PolicyDirection to
  their filegroup.

Bug: 203634639
Test: m
Change-Id: I7b8b3bdcc3be5fca9baa5a9ce656756843e03527

paulhu   commited 2021-11-01 18:06:48 +08:00
721ce5f4f0
bpfmap: Move to Common Util Location
Multiple packages need access to bpf maps. Moving to common
location to allow access from all necessary packages.

Test: atest BpfMapTest
Bug: 179733303

Change-Id: Idae7b620c15c781b2e7980c3a3157f396cfaf66e

Tyler Wear   commited 2021-10-29 12:38:05 -07:00
aafd9c18fb
Merge "Remove some usage of the framework-annotations filegroup"
Chalard Jean   authored and   Gerrit Code Review   commited 2021-10-28 01:55:35 +00:00
c02a31e57a
Merge "Move static utils to the static library"
Chalard Jean   authored and   Gerrit Code Review   commited 2021-10-28 01:55:12 +00:00
68bb44645b
Remove some usage of the framework-annotations filegroup
We should be using the lib instead.

Unfortunately net-utils-framework-common can't do the
same move just yet because many targets depend on it
that only build against system_current.

Test: builds
Change-Id: I9f70f4cc31e0270cc05ef71ba1803c2d088937d6

Chalard Jean   commited 2021-10-27 20:08:27 +09:00
d580242a14
Move static utils to the static library
These classes used to live as a static utility in the
NetworkStack module, but that's not the right place for
them.

The point of this patch is to *not* require topics, as
any change in this space will very quickly spin out of
control and become unmanageable. As such, this starts
with creating equivalent classes in a single, easier to
manage change. Followup changes will migrate users of
the old classes to use these ones instead. Finally, the
old classes can be removed. This way, work can be
broken down into separate changes and be checked in
little by little, rather than one huge topic with many
changes doing everything in one go, which is unlikely
to be manageable.

There are no code changes from the originals, but a
number of reorganizations, most of them unavoidable.

• Vertical spacing (these classes fix it)
• Package names/imports are adjusted
• Added @hide on NetlinkMonitor
• Move all contents of RouteUtils to NetdUtils, because
  all methods depend on INetd, and some of the targets
  do not/cannot depend on netd-client
• Restrict the files used by the filegroup
  net-utils-framework-wifi-common-srcs, since that
  target does not necessarily provide all dependencies
  to all its users.
• Don't move NetworkMonitorUtils, since it depends on
  SdkLevel, and net-utils-framework-common-srcs is
  using **/*.java. It would have been possible to list
  explicitly all files actually necessary in this
  filegroup, but NetworkMonitorUtils is actually only
  used by the networking modules and not the framework.
  Eventually it should move but it doesn't have to
  be in this patch, which is complicated enough as
  it is.
• RouteUtils is now empty, because some new methods
  will be added to it soon and it is less expensive
  to keep it empty than to remove it now and add it
  again later.
• Merge NetdUtils, and unify the constants.
Some changes to satisfy checkstyle :
• Remove unused imports
• Reorder modifiers in InterfaceController
• Remove {} in IpNetworkMonitor
• Remove redundant public modifier in IpNetworkMonitor
• Add javadoc to a few methods
• Add whitespace around | in InterfaceParams
However, don't rename members in IpNeighborMonitor
like checkstyle would prefer because this would make
migration to this more involved.

Test: NetworkStaticLibsTests NetdStaticLibTests
Change-Id: I439121cba5d7ea95aa4d6c80ea25207c316880a0

Chalard Jean   commited 2021-10-27 20:08:05 +09:00
b61091b30b
Merge "Add a withCleanCallingIdentity equivalent to module utils"
Junyu Lai   authored and   Gerrit Code Review   commited 2021-10-26 12:23:09 +00:00
39990fdd70
Merge "Add data structures to parse netlink IP address messages."
Xiao Ma   authored and   Gerrit Code Review   commited 2021-10-25 08:54:19 +00:00
a397d8998b
Add data structures to parse netlink IP address messages.
Bug: 163492391
Test: atest NetworkStaticLibsTests
Change-Id: I85f1b80925fa4a9397df931902d6de189902da72

Xiao Ma   commited 2021-10-21 02:06:36 +00:00
c81f6db429
export bpf headers to Connectivity Service
Export BPF headers to connectivity service for use with
VendorConnectivityService aidl.

Bug: 179733303
Change-Id: Ibc098facde54aeb621e53b73ac59eb6416ba9ebb

Tyler Wear   authored and   Maciej Żenczykowski   commited 2021-10-20 01:02:31 +00:00
ae05481b9a
Add a withCleanCallingIdentity equivalent to module utils
Binder#withCleanCallingIdentity is a very useful utility but
it's not public and won't be made public. Thus, make one
in the connectivity module utils for later use.

Test: TH
Fix: 177369996
Change-Id: I3fd0949b7457f9d8bca8613c2bae7ef7a35a5c4c

junyulai   commited 2021-10-19 14:13:41 +08:00
ec363d1d50
Add data structures to parse netlink link messages.
Bug: 163492391
Test: atest NetworkStaticLibsTests
Change-Id: Ida8c22a782eeaca738487d0dc041a459ef6bb936

Xiao Ma   commited 2021-10-15 05:19:16 +00:00
d99cf6fe74
Merge "[LSC] Add LOCAL_LICENSE_KINDS to frameworks/libs/net"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-10-08 00:33:40 +00:00
d1efe27ad3
Merge "Merge Android 12"
Xin Li   authored and   Gerrit Code Review   commited 2021-10-07 23:50:23 +00:00
d82f1270bb
[LSC] Add LOCAL_LICENSE_KINDS to frameworks/libs/net
Added SPDX-license-identifier-Apache-2.0 to:
  common/netd/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Change-Id: Ic163988eea096e967a8d04624772b2eff350026d

Bob Badour   commited 2021-10-07 11:58:21 -07:00
957b694ed6
Merge "Move netd AIDL to frameworks/lib/net"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-10-07 08:26:47 +00:00
92a234644b
Move netd AIDL to frameworks/lib/net
Clean move system/netd/server/aidl_api/ and
system/netd/server/binder/

$ diff -qr frameworks/libs/net/common/binder/netd/aidl_api/ system/netd/server/aidl_api/
$ diff -qr frameworks/libs/net/common/binder/netd/src/ system/netd/server/binder/
Only in system/netd/server/binder/: com

Bug: 201488997
Test: atest netd_integration_test
      atest netd_unit_test
Ignore-AOSP-First: the netd change(same topic) would not automerger from
aosp.
No-Typo-Check: this is a simple code move with no other changes.
BYPASS_INCLUSIVE_LANGUAGE_REASON=this is a simple code move with no other
changes and these files are frozen anyway

Change-Id: Id5bb63794aff4025355c587b372c3ff5b1054da6
Merged-In: Id5bb63794aff4025355c587b372c3ff5b1054da6

markchien   commited 2021-10-07 14:43:03 +08:00
38c3248623
Merge "Zero out the non-prefix bits in NetUtilsTest" am: 5619ef3387
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1556262

Change-Id: I35fa4f887d941ec11922329855796f4d18dd5630

Taras Antoshchuk   authored and   Automerger Merge Worker   commited 2021-10-06 08:52:18 +00:00
a888a013bf
Merge "Zero out the non-prefix bits in NetUtilsTest"
Taras Antoshchuk   authored and   Gerrit Code Review   commited 2021-10-06 08:28:42 +00:00
6c9685c876
Merge changes from topic "testStatsProvider-cp" am: 8dc319b30f
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1843374

Change-Id: Ifd7c922d474aa701e53bd2393495a4cfaef7ecb6

Junyu Lai   authored and   Automerger Merge Worker   commited 2021-10-05 10:26:39 +00:00
df424c18fa
Merge changes from topic "testStatsProvider-cp"
* changes:
  Add getter for quotaBytes
  Add OnSetWarningAndLimit into TestableNetworkStatsProvider

Junyu Lai   authored and   Gerrit Code Review   commited 2021-10-05 10:14:43 +00:00
89bd9975ce
Add getter for quotaBytes
Since the counter part test is in internal branch only.
Change the member of OnSetLimit makes it fail to build on the
rvc+aosp branch.
Thus, add a getter for backward compatibility since the rvc test
does not recognize limitBytes.

This change also addresses some nullability confusions that are
not going to happen.

Test: m gts && atest \
          GtsNetworkStackHostTestCases:NetworkStatsHostTest#testNetworkStatsProvider
      on R & S codebase.
Bug: 191327585
Change-Id: I91dc8cb2297ca503c49b78bf1102cc5572d16530

Junyu Lai   commited 2021-10-05 10:14:24 +00:00
749459c3bd
Add @NonNull and @Nullable annotations in NetlinkMessage. am: bd0937d7a0
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1843134

Change-Id: I30e586277e69ed3ffd9d0d9fb4dc49793b33a887

Xiao Ma   authored and   Automerger Merge Worker   commited 2021-10-01 15:43:23 +00:00
4b529ce99d
Add OnSetWarningAndLimit into TestableNetworkStatsProvider
This change also address left comments at ag/15010113.

Test: m gts && atest \
      GtsNetworkStackHostTestCases:NetworkStatsHostTest#testNetworkStatsProvider
Bug: 191327585
Merged-In: I100668cc6d4cecbaff29d027d37d313dd48854f3
Change-Id: Ib1f3820fe8502b939d36cef29bdb8dea428604b5
  (cherry-picked from ag/15061296)

Junyu Lai   commited 2021-10-01 10:13:23 +00:00
16b160bfcb
Add @NonNull and @Nullable annotations in NetlinkMessage.
Add @NonNull and @Nullable annotations on StructNlMsgHdr and parse
function to give the caller a clear indication the StructNlMsgHdr
should be non-null and safe to call its public method, avoid throwing
NPE; the same for parse code, which might return null and caller
should check the nullability of return value.

Bug: 163492391
Test: atest NetworkStaticLibsTests
Change-Id: I0cdf6e611a2b5398b048ffc02ec8fb5f8f8a73db

Xiao Ma   commited 2021-10-01 03:58:26 +00:00
0705d22e1f
Zero out the non-prefix bits in NetUtilsTest
Bug: 186082280
Test: atest NetworkStaticLibTests:NetUtilsTest
Change-Id: Ia6e1546b579fccc4fdf969031b389e64b8bb88c5

Taras Antoshchuk   commited 2021-09-21 11:33:05 +02:00
de6f90ddbd
Merge "Implement DevSdkIgnoreRule with SdkLevel" am: 20bad35bc3
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1827474

Change-Id: I4b6165b1eff5cdc92e69f6ee8574a157d9f8bf7b

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-09-17 10:20:27 +00:00
b999f5fa4b
Merge "Implement DevSdkIgnoreRule with SdkLevel"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-09-17 10:07:32 +00:00
52f1cc6f4f
Add a new utility to improve stack traces from automatic testing am: 6b56526bec
Original change: https://android-review.googlesource.com/c/platform/frameworks/libs/net/+/1821095

Change-Id: I587f022c0a53dc56e654738686e222d384039500

Chalard Jean   authored and   Automerger Merge Worker   commited 2021-09-17 07:59:31 +00:00
63e8809f5b
Implement DevSdkIgnoreRule with SdkLevel
DevSdkIgnoreRule currently considers a build with SDK 30, version code T
as being S, but it is generally considered as being T for development
that happens in that branch.

Change the implementation of DevSdkIgnoreRule to be consistent with the
SdkLevel utility.

Test: tests using DevSdkIgnoreRule
Change-Id: Ie81b84dff8fef8eac2cfe9694f0265e5bf11b3e6

Remi NGUYEN VAN   commited 2021-09-17 16:11:45 +09:00
c2a28e0490
Add a new utility to improve stack traces from automatic testing
A common pattern in tests is to use try-finally to make sure
cleanup is executed. This is necessary in CTS in particular to
make sure the test does not leave the device in a bad state.

The problem with using try-finally in this manner is that any
exception thrown in the finally{} block will override any thrown
in the try{} block. If the exception in finally{} is caused by
the one from try{}, then the stack trace reported by the tools
is the consequence and not the cause, making it difficult to
interpret the stack trace of automated tests.

So today, code has to make sure that either the code in
finally{} can't throw, or can't be affected by any code in
try{}, and both of these are really difficult to ensure in
presence in finally{} of code the tester does not control.

What we'd want ideally is a structure like try-finally, that
guaratees the code in finally{} is executed in all cases,
but that bubbles up the exception from try{} if any, and
will still bubble up any exception from finally{} if the
try{} block hasn't thrown.

That's what this new tool does.

Usage from Kotlin is like try-finally :
tryTest {
  testing code
} cleanup {
  cleanup code
}

Usage from Java can't be made as nice, but it's relatively okay :
testAndCleanup(() -> {
  testing code
}, () -> {
  cleanup code
});

Bugs listed below are some tests that have been affected by
this issue and have unhelpful traces.

Test: new test for this code
Bug: 198586720
Bug: 198998862
Change-Id: I54b30a7d53772feeade99274b6120a79707ad1c9

Chalard Jean   commited 2021-09-17 12:21:09 +09:00
5872cb8dbd