Commit Graph

153 Commits

Author SHA1 Message Date
Maciej Żenczykowski
c41291ba48 remove spurious libbpf_bcc
TreeHugger: builds
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Iaa0b513437d67aa61a38df410d8639f7fceed583
2023-04-24 20:10:00 +00:00
Mark
53e71c3f3f Allow jarjar com.android.server*
Jarjar com.android.server* and adjust the test by jarjar
FrameworksNetTestsLib to make sure the test cases still can access
package sope fields. Don't auto-jarjar non-connectivity module tests
in FrameworksNetTests because some non-connectivity module test cases
rely on service.core and service.net. The reason why not auto-jarjar
whole ConnectivityCoverageTests because tethering doesn't adopt
auto-jarjar-gen yet. The coverage test must jarjar the same as module so
that test coverage can calculate correctly.

Remove com.android.server* from proguard becasue it already be covered
by android.net* after jarjar'ed.

Move MetricsTestUtil to non connectivity module test group because it
only be used for IpConnectivityEventBuilderTest which is non connectivity
module test. Only jarjar the util without jarjar the caller make the test
failure.

Bug: 248001529
Test: atest ConnectivityCoverageTests FrameworksNetTests

Change-Id: I8439341ef4c03f29697fdf34557ea8ef2825d691
2023-02-14 15:43:43 +00:00
Aaron Huang
361e617b93 Make sure device is awake to verify the launcher is shown
If the screen is off while running the test, it will
cause test fail because the test cannot verify the
launcher is shown. Thus, wake up the device first to
verify if the launcher is shown or not.

Bug: 261860642
Test: this
Change-Id: Icda8a2c6fdc97caf1986bb812ca366d9c9fde03f
2023-02-06 12:13:26 +08:00
Paul Hu
03a51d5674 Move mDNS code to service-connectivity-t
Instead of using a separate service-mdns library, move the code to
service-connectivity-t.

service-connectivity-t is chosen because it has access to hidden API of
classes that were made updatable in T, such as NsdServiceInfo and
NsdManager. mdns code can be there as it is only loaded on T+.

Bug: 241738458
Test: atest
Change-Id: I7eb6c9ab8bf0e0a614ea2994c6ed80a1a780241f
2023-01-13 16:42:48 +08:00
Remi NGUYEN VAN
3568fddb36 Add MdnsProber
MdnsProber is an implementation of MdnsPacketRepeater that will be used
to send probes for service names before advertising them, to know if
they are already in use.

Bug: 241738458
Test: atest
Change-Id: I4e5f779b891e2c665ba7f752fb5fbd4255070725
2022-12-14 11:36:55 +09:00
Thiébaud Weksteen
11490a1474 Relocate NetworkManagementServiceTest to framework
Bug: 259341026
Test: TH
Change-Id: Ie06d906fa8bc65d6af3511280bc01b2859edde79
2022-12-05 14:48:44 +11:00
Daniel Peykov
2bf3a3831b Update uiautomator references in packages/modules/Connectivity
* Replace "androidx.test.uiautomator" (v2.2.0) with
  "androidx.test.uiautomator_uiautomator" (v2.3.0).

Bug: 247008528
Test: presubmit
Change-Id: Ic274f81492d5a11b73de0a6d6a11c5cb16ddedea
2022-10-04 21:59:30 +00:00
Maciej Żenczykowski
49cbeae43b Merge "remove duplicate jni include" am: 918b56c96d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2175367

Change-Id: I9010d20b00a59e87883739d19161bde1ea0656ad
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-08 18:36:50 +00:00
Maciej Żenczykowski
05dccd52f9 remove duplicate jni include
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I33be8bbaa395177e3706abaf1201f4bd96eaf7d2
2022-08-08 09:38:10 +00:00
Treehugger Robot
4b104cf5a2 Merge "Revert "Add mdns tests to ConnectivityCoverageTests"" am: 2575e05740
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2169303

Change-Id: I01712aaabecca9486fb9669fcf9f3ba8518322d5
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-29 06:50:32 +00:00
Paul Hu
67db37d2a3 Revert "Add mdns tests to ConnectivityCoverageTests"
This reverts commit 3d686a1c3a.

Reason for revert: Revert this CL because we have got the mdns code coverage data.

Change-Id: Iffc202a9418876b577bf76b2d2a27fa0fc0b34a5
2022-07-29 01:50:24 +00:00
Paul Hu
b687cef5e4 Merge "Add mdns tests to ConnectivityCoverageTests" am: 2d87d6431e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2164647

Change-Id: I6ab3ca81329341089d274fdae72f1f8b2b958956
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-28 04:08:39 +00:00
Paul Hu
3d686a1c3a Add mdns tests to ConnectivityCoverageTests
In order to know the test coverage status of mdns code. Add mdns tests
to ConnectivityCoverageTests temporarily.

Test: atest ConnectivityCoverageTests FrameworksNetTests
Change-Id: I0449f0363cc68e4c95c91c78bb21bccbb41adaa9
2022-07-26 10:37:38 +00:00
Chiachang Wang
8003ddb079 Merge changes from topic "appExclusionPackage" am: 5b4ad7c47a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2106025

Change-Id: Ica923dd09dbe9963296f1aa0917106ae090ad52a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-30 02:00:10 +00:00
Chiachang Wang
5b4ad7c47a Merge changes from topic "appExclusionPackage"
* changes:
  Test VPN app exclusion
  Add VpnTestBase for VPN test common code
2022-06-30 01:34:54 +00:00
chiachangwang
7f5d04962b Test VPN app exclusion
Initialize the VpnManagerServiceTest and verify app exclusion
design.

Bug: 231373589
Test: atest FrameworksNetTests
Change-Id: Icf3994a58de7b2fcc6fafe9712b5ac94e6c2c134
2022-06-29 06:15:41 +00:00
Xin Li
e9ece30105 Merge tm-dev-plus-aosp-without-vendor@8763363
Bug: 236760014
Merged-In: Ic05ca7fe4adaa94f79e59758569f7595ab4c4f54
Change-Id: Id2ed4b3865be3c959c4cb62a31fba318f5b6fd77
2022-06-28 21:23:32 +00:00
Paul Hu
3e1f4489bf Add mdns files and unit tests
- Put mdns code to service/mdns because we don't want to impact
  coverage for code that's not yet in use.
- Also fix some lint errors
  - Common typo errors
  - Lines longer than 100 characters
- Update IgnoreUpTo from S to SC_V2 because the tests should be
  ignored until T.

Bug: 232766079
Test: atest FrameworksNetTests
Change-Id: I19af3bf7ae004bd37960f2ad9014cf0c6a804c8d
2022-06-28 09:54:39 +08:00
Remi NGUYEN VAN
2bd25cdc84 Merge "Fix service resolve on tethering downstreams" am: 5eaefa21bf am: d0a31d8e08
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2110084

Change-Id: I14bf75238dd36a9d5c834f26964d1e861d1e714e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-06-01 06:09:12 +00:00
Remi NGUYEN VAN
5eaefa21bf Merge "Fix service resolve on tethering downstreams" 2022-06-01 05:31:14 +00:00
Remi NGUYEN VAN
1a8ee102d3 Fix service resolve on tethering downstreams
Tethering downstreams do not have NetworkAgents, and although they have
a netid of 99, Networks with netId 99 are not usable by apps for most
connectivity APIs.

Recent refactoring in NsdService adds the Network of a found service
into its NsdServiceInfo, and uses that network to resolve the service.
In that case the Network has netId 99 and resolving the service fails.

Avoid that problem by:
 - Keeping the Network field null when a service is found on a tethering
   downstream; this avoids giving apps a confusing and unusable Network
   with netId 99
 - Using the interface index found during discovery to resolve the
   service, if the app uses the NsdServiceInfo that was obtained from
   discovery to resolve. If not, all interfaces will be used to resolve,
   as per legacy APIs.

Bug: 233979892
Test: atest NsdServiceTest
      Also manual test with 2 devices connected via hotspot
Change-Id: Idd176153b67ccbd1d4f1b1fd66dafaa2f3a9e27a
2022-05-31 13:06:22 +09:00
Paul Hu
8ecfaa7ea7 Add some non-connectivity-module-test back to ConnectivityCoverageTests am: 516d5dc0ea am: 68eb8042a6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2108067

Change-Id: Idb25eaa0d9a5b53b31b272951bd17a0af23ff9f7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-27 10:25:37 +00:00
Paul Hu
516d5dc0ea Add some non-connectivity-module-test back to ConnectivityCoverageTests
In S, the tests are listed in the non-connectivity-module-test
where their testing files are not in the connectivity module.
But some files move into the connectivity module in T. So some
tests can be removed from non-connectivity-module-test and will
be running on ConnectivityCoverageTests to count their code
coverage.

Also update some tests to make them compatible with
mockito-extended and ignore some tests which need to test with
T apis.

Bug: 234000451
Test: atest FrameworksNetTests ConnectivityCoverageTests
Change-Id: I47fb59334d00ae7fee91c5694548b3cf89b09b2d
2022-05-27 07:16:46 +00:00
Colin Cross
a2887bb928 Merge changes Ide01c994,Ia9f12a7b am: 708b1ab707 am: f2678a4464
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2100947

Change-Id: I0ba008426458e801983d1b45065f6b1736a34a82
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-18 19:00:04 +00:00
Colin Cross
ece3171cf0 Revert "Autogenerate connectivity jarjar rules"
This reverts commit 53eb35cd82.

Reason for revert: b/233081774, caused long build times in FrameworkNetTests

Change-Id: Ide01c994f694b55fc0e87bb0e81584ac44196e68
2022-05-18 18:30:27 +00:00
Remi NGUYEN VAN
ab1f8b5956 Merge "Autogenerate connectivity jarjar rules" am: 4cd92adf0e am: 2e4ab52a93
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2067233

Change-Id: Ib8e322bd7fcb893fbbb7c8f54e9a35c11a7d0f82
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-05-16 09:55:56 +00:00
Remi NGUYEN VAN
53eb35cd82 Autogenerate connectivity jarjar rules
Jarjar rules are hard to keep in sync with code, and hard to maintain
manually as the distinction between what should and should not be
jarjared is not always clear. This results in unsafe binaries that are
manually maintained, and developer frustration when something fails due
to incorrect jarjar rules.

Autogenerate jarjar rules at build time instead. This is achieved by
introducing a jarjar-rules-generator python-based library, which scans
pre-jarjar intermediate artifacts, and outputs jarjar rules for every
class to put it in a package specific to the module. The only exceptions
are:

 - Classes that are API (module-lib API is the largest API surface of
   the module)
 - Classes that have unsupportedappusage symbols
 - Classes that are excluded manually (for example, because they have
   hardcoded external references, like for
   ConnectivityServiceInitializer in SystemServer).

This change causes all classes in framework-connectivity(-t) and
service-connectivity to be jarjared into android.net.connectivity, but
still avoids jarjaring classes in com.android.server as before, to keep
it small.
For many classes this differs from the original jarjar rule.

Notes on implementation:

 - connectivity-jarjar-rules now has a subset
   framework-connectivity-jarjar-rules containing only the rules
   necessary for framework-connectivity. This is necessary because
   framework-connectivity cannot depend on rules generated based on
   service-connectivity, as there would be a dependency cycle
   (service-connectivity depends on framework-connectivity); Soong even
   crashes with a stack overflow.

 - framework-wifi.stubs.module_lib is added to
   framework-connectivity-pre-jarjar as it is necessary to build it (it
   is already in impl_only_libs in the defaults).
   It is unclear why framework-connectivity-pre-jarjar could build
   before that (possibly because it was only used as "lib" ?)

 - Fix package-private visibility; for example NattSocketKeepalive,
   TcpSocketKeepalive are not API so should be jarjared, but are used
   by ConnectivityManager which is not jarjared, so they are not in the
   same package after the change. Package-private members in the
   former 2 need to be public to be accessible. Changes in this commit
   are all that is needed, as demonstrated by followup commits that move
   the classes to a different package without further changes, and that
   enforce that no class in an API package gets jarjared.

 - framework-connectivity-internal-test-defaults is separated from
   framework-connectivity-test-defaults, for unit tests that need to
   access internal jarjared classes. Such tests need to use the jarjar
   rules themselves too, so this is only appropriate for connectivity
   internal unit tests.

Test: atest ConnectivityCoverageTests CtsNetTestCases
Bug: 217129444
Change-Id: Ied17c3955ea2fda130089265d02908937ad8af1e
2022-05-13 17:30:06 +09:00
Aaron Huang
d79f543df0 Merge "Fix NullPointerException happens in dumpCheckin" am: 6b7e457988 am: 44a02af11a am: a4d60dd2ad
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2059628

Change-Id: If9933b6aad05abf79e85f9172ba6eb6f8492d648
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-20 06:12:50 +00:00
Aaron Huang
c3a43b4063 Fix NullPointerException happens in dumpCheckin
Currently dumpCheckin passes a null object to create
the contructor of NetworkStatsCollection.Key but the
constructor requires non-null object. Thus, it caused
the NPE in dumpCheckin. To fix this exception, create
an NetworkIdentitySet() object instead of using an
null object.

Bug: 225131008
Bug: 226539404
Test: dumpsys netstats --checkin is fine
      FrameworksNetTests
Change-Id: I7f2dadf0647b3f42e0f667d96291d2ae37e23faf
2022-04-19 17:49:30 +08:00
Paul Hu
104c01390a Merge "Remove NativeDaemonConnector relevant files" am: 631c2387a6 am: 4eaeac9baa
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2059332

Change-Id: If12e2a9dff214da5541d4002b33d313898aa2b18
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-12 08:16:33 +00:00
Paul Hu
4eaeac9baa Merge "Remove NativeDaemonConnector relevant files" am: 631c2387a6
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2059332

Change-Id: I9eb51122c0d6ad5867e1ad7759c36933b10cc971
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-12 07:51:40 +00:00
Paul Hu
631c2387a6 Merge "Remove NativeDaemonConnector relevant files" 2022-04-12 07:37:16 +00:00
paulhu
cee953bd09 Remove NativeDaemonConnector relevant files
NsdService is using binder call to communicate with
mdnsresponder, so there is no one to use NativeDaemonConnector
now. Thus, remove NativeDaemonConnector relevant files.

Bug: 209894875
Test: atest FrameworksNetTests
Change-Id: Ic70d9417dc85c04c537e09d8f8586a762ac9a97b
2022-04-12 07:35:31 +00:00
Chiachang Wang
5e16c68d00 Merge "Update test for new IkeTunnelConnectionParams field" am: 5850372963 am: 73242c8a0e
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1976972

Change-Id: I25cd0a8614b8b1c400026f655b34b67fd5116e3e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-07 11:37:31 +00:00
Chiachang Wang
73242c8a0e Merge "Update test for new IkeTunnelConnectionParams field" am: 5850372963
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1976972

Change-Id: If20d5af24f2c9139ed3f41c62ecbec20433e1fba
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-07 10:45:24 +00:00
Chiachang Wang
5850372963 Merge "Update test for new IkeTunnelConnectionParams field" 2022-04-07 10:24:03 +00:00
Remi NGUYEN VAN
9dcc6c676d Merge changes Id533cdb4,I6a9ce3d6,I345bf073 into sc-mainline-prod am: c3315f2560
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/17530925

Change-Id: I9e1375f47ab85db92cf602f0be63bac0160aab78
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-01 08:29:40 +00:00
Remi NGUYEN VAN
40da62da48 Merge EthernetServiceTests into FrameworksNetTests
As per the TODO, merge EthernetServiceTests into the larger
FrameworksNetTests suite.

Similarly to NetworkStats, NSD or IpSec tests, the tests are also marked
as "non-connectivity-module-test", where "module" actually refers to
modules being built for release (from an S-based branch) today. This is
necessary as the tests and associated code cannot build without T APIs.

Also add FrameworksNetTests to presubmit as non-connectivity-module
tests are not run in presubmit without this.

Test: TH
Merged-In: Id533cdb4ac184b963f570af299dea04754ba88e9
Change-Id: I9950fcb49fdc2217134a59e993941cbe5da0b556
2022-04-01 15:12:18 +09:00
Remi NGUYEN VAN
6ad9287432 Merge EthernetServiceTests into FrameworksNetTests
As per the TODO, merge EthernetServiceTests into the larger
FrameworksNetTests suite.

Similarly to NetworkStats, NSD or IpSec tests, the tests are also marked
as "non-connectivity-module-test", where "module" actually refers to
modules being built for release (from an S-based branch) today. This is
necessary as the tests and associated code cannot build without T APIs.

Also add FrameworksNetTests to presubmit as non-connectivity-module
tests are not run in presubmit without this.

Test: TH
Ignore-AOSP-First: Merged in topic, will be cherry-picked
Change-Id: Id533cdb4ac184b963f570af299dea04754ba88e9
2022-04-01 15:08:48 +09:00
Chiachang Wang
69aa988090 Update test for new IkeTunnelConnectionParams field
Bug: 184750836
Test: atest FrameworksNetTests
Change-Id: Iab55eba74b94f295a358c6e8474ebf9230c9b019
2022-03-31 14:45:59 +08:00
Patrick Rohr
2f9ab72177 Merge "Add test for EthernetNetworkUpdateRequest" am: 6758a5dfff am: 396091b4b1
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2012897

Change-Id: I3caea7ea56c7b020c3a13ecfe5e8978960b37a88
2022-03-09 10:12:36 +00:00
Patrick Rohr
396091b4b1 Merge "Add test for EthernetNetworkUpdateRequest" am: 6758a5dfff
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2012897

Change-Id: Ia159ef5459390bb49bb67be26022f942743a20ba
2022-03-09 09:48:38 +00:00
Patrick Rohr
6758a5dfff Merge "Add test for EthernetNetworkUpdateRequest" 2022-03-09 09:16:29 +00:00
Xin Li
dc0aa2e9bf [Resolved conflict] Merge "Merge Android 12L" am: e6953d54a5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2013399

Ignore-AOSP-First: automerger CL from AOSP
Change-Id: Ib5909fcd5078da0beaf399695bc25b28c4eb7918
2022-03-08 17:13:34 +00:00
Patrick Rohr
30d33f4ee3 Add test for EthernetNetworkUpdateRequest
Test: atest EthernetNetworkUpdateRequest
Change-Id: I2aeacca81f07cf2d73814d20fc9e63e9f1a65843
2022-03-08 16:29:43 +01:00
Jean Chalard
5d38c8ce06 Merge "Remove unused libraries" am: e4848734a9 am: 0e4e270314
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2005450

Change-Id: I547e9c82bff23c426418466cfa85321cbb3717fb
2022-03-02 08:41:05 +00:00
Jean Chalard
fb73190bd6 Merge "Remove unused libraries" am: e4848734a9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2005450

Change-Id: I831ada348828d28c4abcd961932bdbb7c0c4ec07
2022-03-02 08:21:36 +00:00
Jean Chalard
0e4e270314 Merge "Remove unused libraries" am: e4848734a9
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2005450

Change-Id: I94d1fa0167c143478938342f6d4d41e7a6bdf894
2022-03-02 08:19:29 +00:00
Jean Chalard
e4848734a9 Merge "Remove unused libraries" 2022-03-02 07:48:51 +00:00
Chalard Jean
1f3e110ae6 Remove unused libraries
Test: m, TH
Change-Id: I59c0f8ecc94837635758c7667ea6413a5e6a7e81
2022-03-02 14:32:38 +09:00