Commit graph android_packages_modules_Co.../framework
Message SHA1
Merge changes from topic "revert-1387135-st02-CRMRFENEPA"
* changes:
  Revert "[ST02.1] Add TYPE_CNAME constant to DnsResolver"
  Revert "[ST02.2] Use the getters of DnsHeader"

Anton Hansson   authored and   Gerrit Code Review   commited 2022-09-09 07:58:06 +00:00
3483b9b35c
Revert "[ST02.1] Add TYPE_CNAME constant to DnsResolver"
Revert submission 1387135-st02

Reason for revert: Usage of TYPE_CNAME in a library shared among
modules does not interact well with current module release process

Reverted Changes:
Ib5616c65c:[ST02.2] Use the getters of DnsHeader
I5e58f99b0:[ST02.1] Add TYPE_CNAME constant to DnsResolver
I0c1547cbc:[ST02] Add methods for synthesizing DNS packets

Change-Id: I5aa9f28f1268f966f62041193ceb7c8bef994579

Remi NGUYEN VAN   commited 2022-09-08 11:01:05 +00:00
110bbdaa3e
Revert "[ST02.2] Use the getters of DnsHeader"
Revert submission 1387135-st02

Reason for revert: Usage of TYPE_CNAME in a library shared among
modules does not interact well with current module release process

Reverted Changes:
Ib5616c65c:[ST02.2] Use the getters of DnsHeader
I5e58f99b0:[ST02.1] Add TYPE_CNAME constant to DnsResolver
I0c1547cbc:[ST02] Add methods for synthesizing DNS packets

Change-Id: Ia35cb3e21cd90e036a07018e2d9c1ee662ce86a2

Remi NGUYEN VAN   commited 2022-09-08 11:01:05 +00:00
c7043880ef
Merge changes from topic "st02"
* changes:
  [ST02.2] Use the getters of DnsHeader
  [ST02.1] Add TYPE_CNAME constant to DnsResolver

Junyu Lai   authored and   Gerrit Code Review   commited 2022-09-07 02:25:41 +00:00
7119e9cf5e
Merge "Straighten out NetworkAgentConfig's equals()"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-09-01 18:23:21 +00:00
110ec66819
Straighten out NetworkAgentConfig's equals()
Bug: 244312404
Test: FrameworksNetTests
Change-Id: I154f3b2ab898d6f428ccf9efa9ab90992beb1f9f

Chalard Jean   authored and   Jean Chalard   commited 2022-09-01 08:14:49 +00:00
333eaa930f
[ST01] Attributes data usage of test network by specifier
Currently, data usage of all test networks are all attributed to
the same NetworkIdentity, which does not allow services to
distinguish upload & download traffic of different test networks.

Thus, this CL put specifier that comes along with
TestNetworkAgent into wifiNetworkKey field to build different
NetworkIdentity to attribute data usage to different for
individual networks. And allow querying test network usage with
wifiNetworkKeys.

Bug: 139774492
Test: atest FrameworksNetTests
      atest android.net.cts.ConnectivityManagerTest
Change-Id: I1bb38fd20781eaf3105735440a04b27bef36fcae

Junyu Lai   commited 2022-08-29 13:55:08 +08:00
c9f1ca62d9
[ST02.2] Use the getters of DnsHeader
Bug: 139774492
Test: atest DnsPacketTest DnsResolverTest
Change-Id: Ib5616c65cce9668e7c6a00571c34ece7b4d8ab39

Junyu Lai   commited 2022-08-25 14:06:30 +08:00
ec2b24784f
[ST02.1] Add TYPE_CNAME constant to DnsResolver
This would be needed for subsequent patches that synthesizing DNS
packets for testing purpose.

Bug: 139774492
Test: atest DnsPacketTest DnsResolverTest
Change-Id: I5e58f99b09b693f167178e56f008be8b42d9417a

Junyu Lai   commited 2022-08-25 11:11:52 +08:00
822ab28a9b
Removing SuppressLint on NetworkRequst
Removing @SuppressLint("NewApi") on NetworkRequest when setting a
network specifier as it is no longer needed.

Bug: 228538826
Test: unit and CTS
Change-Id: Id79298c524536088e530e7ba3d2febce2f33685b

James Mattis   commited 2022-08-12 16:10:29 -07:00
52cc8542ec
Merge changes I1cf472bd,Ibdaf2b23,I6967ad6f,I65f522c2,I0f220d1f, ...
* changes:
  Make the temporary NC sanitized instead of inlining
  Remove the legacy int from FullScore.
  Remove accessors for legacy int score from NAI
  Log the creation time of network agents
  Show time taken by the rematch
  Address some IDE warnings in ConnectivityService
  Copy arguments from NetworkAgent registration early

Paul Hu   authored and   Gerrit Code Review   commited 2022-08-10 01:41:43 +00:00
a3340c1355
Merge changes I036b7f23,I53c58e7b
* changes:
  Improve the JavaDoc for FIREWALL_CHAIN_OEM_DENY_x.
  Allow tests to set the NetworkAgent's callbacks when creating it.

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-08-04 09:50:53 +00:00
bdedaacd88
Remove the legacy int from FullScore.
This is a nice cleanup and will clear misunderstandings where
people mistakenly look at it in the logs.
Unfortunately it can't be removed from NetworkScore because there
are public APIs, and it's even used to transmit invincibility in
a legacy spur.

Bug: 238139913
Test: ConnectivityServiceTest
Change-Id: Ibdaf2b235b994383d5f8f42f1780b04bda80c93a

Chalard Jean   authored and   Paul Hu   commited 2022-08-04 06:45:39 +00:00
0158fe9fd1
Improve the JavaDoc for FIREWALL_CHAIN_OEM_DENY_x.
State that the chains are equivalent and independent.

As requested by API council.

Fix: 235973271
Test: documentation-only change
Change-Id: I036b7f23a40d038920f308c81daf7532afbae242

Lorenzo Colitti   commited 2022-08-03 09:24:28 +00:00
f683c40939
Opportunistic comment fix
Test: comment only
Change-Id: Icdf8980ebb64e42afe9c7ebc86ea605f897e47ba

Chalard Jean   commited 2022-08-03 14:46:09 +09:00
0c7ebe9e44
fix native jni method signature - these are all static methods
See packages/modules/Connectivity/framework/src/android/net/NetworkUtils.java,
11 are 'static native' and 1 is 'native static'

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic6392452ce6f760db0f4300e0a35a33b9487c931

Maciej Å»enczykowski   commited 2022-07-28 18:08:22 +00:00
0da1b4d4f2
Merge "Use java BpfMap in BpfNetMaps#replaceUidChain"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-07-27 13:21:50 +00:00
6bcb3c290c
Use java BpfMap in BpfNetMaps#replaceUidChain
Bug: 217624062
Test: atest BpfNetMapsTest
Change-Id: Ib2a2c2646834110a3eeeb786a4ea7a3f85718be8

Motomu Utsumi   commited 2022-07-27 06:01:47 +00:00
9be2ea0080
NetworkProvider: improve documentation of unregisterNetworkOffer
Add a warning to unregisterNetworkOffer to inform users that this method
executes asynchronously.

Test: documentation only change
Change-Id: Ic4742bf570ebcd4d00b0b259c35fd46688494517

Patrick Rohr   commited 2022-07-25 13:31:14 -07:00
c886983669
Revert "NetworkProvider: Do not propagate callbacks for unregistered offers"
This reverts commit 546c722511.

Test: TH
Change-Id: I2c8a8e7faf407a0dae17074d2d435669e16b5e79

Patrick Rohr   commited 2022-07-25 13:31:14 -07:00
4a4498c1d4
Merge "TestNetworkService: add support to disable DAD on test interfaces"
Patrick Rohr   authored and   Gerrit Code Review   commited 2022-07-21 22:19:26 +00:00
e6162aca71
TestNetworkService: add support to disable DAD on test interfaces
DscpPolicyTest does not have an IpClient, so it relies on assigning the
LinkAddresses at interface creation. If DAD is enabled, the global
address cannot be used immediately, so the test packet selects the wrong
source address. There is no obvious way to fix this without disabling
DAD as the TestableNetworkCallback receives the LinkProperties update
before the address can be used.

This functionality will also be useful in ethernet tests, which
currently have to block for a long time.

Test: atest DscpPolicyTest
Bug: 235559605
Change-Id: Id7788df5e92ebd8eaf4619a23f44135ea4a2144e

Patrick Rohr   commited 2022-07-21 10:20:16 -07:00
336bb5cf6d
Use jarjar rule generator for connectivity rules
(This rolls forward part of a previous change, now that jarjar was fixed
to not get very slow when the number of rules increases).

Autogenerate connectivity jarjar rules at build time, to avoid issues
with forgotten jarjar rules or hard-to-diagnose errors introduced by
incorrect rules.

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: Ib1bd939b71c0171d945fc01b96195d2f620ff13b

Remi NGUYEN VAN   commited 2022-07-20 19:57:11 +09:00
e55a88d30f
Merge "Revert EXCLUDED_ROUTES to only keep RTN_UNICAST"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-07-16 01:43:04 +00:00
16e244ed0f
Revert EXCLUDED_ROUTES to only keep RTN_UNICAST
Revert the previous change to filter out all non-RTN_THROW routes when
EXCLUDED_ROUTES is disabled, as that behavior is CTS tested for T, and
has been used by T for a while. The previous change already ensured that
there is no behavior change on S, so this is the safest approach.

This fixes HostsideLinkPropertiesGatingTests.

Bug: 239046959
Test: atest LinkPropertiesTest CtsHostsideNetworkTests
Change-Id: I55e078cdc06341f4957fe7bc743c0022b2c7d3da

Remi NGUYEN VAN   commited 2022-07-15 16:46:14 +09:00
48380e4132
Merge "Correct javadoc usage"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-07-15 07:41:33 +00:00
b7f81e4a6d
Correct javadoc usage
"{@see" aren't rendered properly. Replace them with "See {@link"
or @see depending on the usage.

Bug: 238753273
Test: make doc-comment-check-docs ; Check the doc result
Change-Id: I70cb2f36e7c5fa8102b5949054df5184d755202c

chiachangwang   commited 2022-07-15 03:44:46 +00:00
9473c59980
Merge "Let LinkProperties#getRoutes() keeps returning all routes before T"
Natasha Lee   authored and   Gerrit Code Review   commited 2022-07-14 14:12:55 +00:00
5006349209
Let LinkProperties#getRoutes() keeps returning all routes before T
Starting from T, VpnService supports exclude routes, which will
make the caller to get both of include routes and exclude routes
from LinkProperties#getRoutes(), and it's not expected to get the
exclude routes before T in production code even though the code
returns all routes.

But there is a CTS - LinkPropertiesTest#testRouteAddWithSameKey()
will try to add an exclude route and check if the result of
LinkProperties#getRoutes() contains that exclude route or not.
And the test is failed now since LinkProperties#getRoutes() will
only return include route if compat feature - EXCLUDED_ROUTES is
disabled. (EXCLUDED_ROUTES is enabled starting from target SDK T)

To fix this test failure, let LinkProperties#getRoutes() keeps
returning all routes if SDK is before T. This avoids changing
behavior on S, and even though there is still a behavior change
when upgrading to T, apps are unlikely to be relying on such
behavior, especially outside of tests.

Bug: 238061814
Test: Run "atest CtsNetTestCases:LinkPropertiesTest" on S build
      with mainline module which contains this patch.
Change-Id: Iac4362c4fe347ee3f06d5b21b0325fa69a7f27b6

Remi NGUYEN VAN   commited 2022-07-14 18:54:05 +09:00
66c27c18a2
Merge "Correct javadoc for ConnectivityManager#requestNetwork"
Chiachang Wang   authored and   Gerrit Code Review   commited 2022-07-14 08:18:44 +00:00
1c7f6f89b2
Merge "Revert QosCallbackException constant values"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-07-14 02:50:09 +00:00
fc307eab4b
Revert QosCallbackException constant values
The constants are used for the NetworkAgent.sendQosCallbackError system
API, so changing their values changes the behavior of that API. This is
observed when running S CTS against the latest version of the
connectivity module: testQosCallbackOnError fails because a
SocketNotConnectedException ends up being reported, instead of an
UnsupportedOperationException.

Revert the constants to their values before change ID:
I7102ae9ba7cb9e1cc8d06b252aad4dad75860f3e

Bug: 238061856
Test: cts-tradefed run cts -m CtsNetTestCases \
          -t android.net.cts.NetworkAgentTest
      using a CTS v12.1 package.
Change-Id: Iaa12729d9e7dc627a6654a6fa47b8248e0cd3049

Remi NGUYEN VAN   commited 2022-07-14 02:49:29 +00:00
bd7a485826
Correct javadoc for ConnectivityManager#requestNetwork
Fix: 238753273
Test: make doc-comment-check-docs ; Check the doc result
Change-Id: I41c35b9cb31dcf3a372a61ad84f19295b0bc0ceb

chiachangwang   commited 2022-07-14 02:43:03 +00:00
e9c44ce718
Merge "TestNetworkManager: add support for configuring tap link addresses"
Patrick Rohr   authored and   Gerrit Code Review   commited 2022-07-09 02:08:36 +00:00
e548be264b
NetworkProvider: Do not propagate callbacks for unregistered offers
Previously, after calling unregisterNetworkOffer(), onNetworkNeeded() /
onNetworkUnneeded callbacks are still being called until CS's handler
thread has finished running. While this behavior could be taken care of
in the network provider implemention (e.g. the ethernet service), it is
much simpler to deal with in NetworkProvider.java.

As NetworkProvider.java wraps the passed callback object inside a proxy
that it forwards to CS, it should be as simple as adding a boolean to
the proxy that is checked inside the executor thread before the
implementation's callback is called. Since for every call to
registerNetworkOffer() with a new callback object a new proxy object is
created, this should be safe. Even if the callback object is reused on
the user side (such as ethernet service does right now), this should be
okay, as the implementation will only receive callbacks from the active
proxy.

Test: atest NetworkProviderTest
Bug: 171872016
Change-Id: Iaf84b5801ad3ee44895e933763927151ea5824dd

Patrick Rohr   commited 2022-07-07 13:48:52 -07:00
546c722511
NetworkProvider: add missing synchronization
Adding missing lock to unregisterNetworkOffer() call.

Test: TH
Change-Id: Ia54664caaecb63e0bfa737903b48d08856fb4877

Patrick Rohr   commited 2022-07-07 13:48:52 -07:00
aecfab5f72
Merge "Reword comment for language quality"
Paul Hu   authored and   Gerrit Code Review   commited 2022-07-06 01:52:06 +00:00
e79157578b
Reword comment for language quality
This addresses a leftover comment to aosp/1919251

Bug: 238139913
Test: comment-only
Change-Id: Icfd054a1f9a4b928b222fb1a74af066c36c886b0

Chalard Jean   authored and   Paul Hu   commited 2022-07-06 01:51:35 +00:00
2ddcf603e2
Merge "Add @RequiresApi to LocationPermissionChecker"
Treehugger Robot   authored and   Gerrit Code Review   commited 2022-07-04 14:01:20 +00:00
07bb1d41d8
TestNetworkManager: add support for configuring tap link addresses
Without an IpClient, there is otherwise no way to configure IPv4
addresses on a tap interface in tests.

Test: TH
Change-Id: I6a788687708b2034c464befdfec9267ce3399d70

Patrick Rohr   commited 2022-06-30 14:47:51 -07:00
8af41fac2f
Merge "Refactor BpfNetMaps and getChainEnabled"
Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-06-30 06:48:10 +00:00
51a03d629e
Add @RequiresApi to LocationPermissionChecker
Add the required lib to the user of net-utils-framework-common-srcs
which has LocationPermissionChecker.

Bug: 158059172
Test: m
Merged-In: Id54de2bd94e8b5821814715683b5b2520f1f026e
Change-Id: Id54de2bd94e8b5821814715683b5b2520f1f026e
(cherry picked from commit d795228affd7e7ad828adb2bf4fbcb9093c3f377)

Jooyung Han   commited 2022-06-29 06:41:59 +09:00
c83755456f
Merge "TestNetworkManager: add note on kernel version expectation"
Patrick Rohr   authored and   Gerrit Code Review   commited 2022-06-27 18:45:29 +00:00
21be776580
Refactor BpfNetMaps and getChainEnabled
Address comments from aosp/2117045 and aosp/2131752
Rename USE_NETD to PRE_T
Rename getChainEnabled to isChainEnabled
Remove unnecessary parentheses
Fix comment

Bug: 217624062
Test: atest BpfNetMapsTest
Change-Id: Iaff8c9fc5f74de3fe41a7fb010355b1742fbce90

Motomu Utsumi   commited 2022-06-27 14:33:28 +00:00
25cf86fc95
Use java BpfMap in BpfNetMaps#setChildChain
Bug: 217624062
Test: atest BpfNetMapsTest android.net.cts.ConnectivityManagerTest#testFirewallBlocking

Change-Id: I13e96911eccd7d1d0545a156ddc2859bcaac09eb

Motomu Utsumi   commited 2022-06-24 09:11:58 +00:00
18b287d285
Add API to get current firewall chain status
This commit adds ConnectivityManager#getFirewallChainEnabled to read the
current firewall chain status

Bug: 208371987
Test: m
Change-Id: I1eadb69f953af5d031cd8dabde3e1f098cf0f4df

Motomu Utsumi   commited 2022-06-24 09:11:53 +00:00
be3ff1e923
TestNetworkManager: add note on kernel version expectation
Both setting the carrier up / down and creating an tun / tap interface
without carrier need TUNSETCARRIER to be present in the kernel.

Bug: 236783925
Test: documentation only change
Change-Id: Ie7f7d2c81c926adbc10b29b4b1748e47edaa4cb7

Patrick Rohr   commited 2022-06-23 09:30:25 -07:00
c924307408
Merge "Add jarjar rules generator"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2022-06-17 01:09:11 +00:00
49d6b5d80b
Merge changes Ic6ff7a3d,Iff9b9792
* changes:
  Refactor code and improve tests for VPN filtering
  Remove LOCKDOWN from FirewallChain IntDef

Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-06-16 01:32:20 +00:00
5d787feef0
Merge changes Ie1a91959,Ic189b2c0,I39d70e0a,Ibb5f1402
* changes:
  TestNetworkInterface: add support for MacAddress and MTU
  TestNetworkService: add support for creating iface without carrier
  TestNetworkService: Add support for toggling carrier on tun/tap
  TestNetworkService: Fix TestNetworkInterface parcel flags

Patrick Rohr   authored and   Gerrit Code Review   commited 2022-06-15 20:53:30 +00:00
929368eb1a