Commit graph

12,433 commits

Message SHA1
Remove Preconditions usage in TestNetworkSpecifier
Preconditions is a hidden API utility. It can be easily replace by
inline checks.

Bug: 177046265
Test: m
Change-Id: I3f722075fb9c74e12e40348ba4faad2f0fa67178
Merged-In: I3f722075fb9c74e12e40348ba4faad2f0fa67178

Remi NGUYEN VAN   commited 2021-03-22 00:02:10 +00:00
508d3cf1d6
Revert "Revert "Remove connectivity dependency on Preconditions""
Preconditions.checkNotNull is deprecated to be replaced by
Objects.requireNonNull, and other methods can easily be replaced by
inline checks.

Preconditions is an internal API class that should not be used by
unbundled jars.

Bug: 177046265
Change-Id: I3a67d266b32142c034520acbcdc30f7213db5e13
Merged-In: I3a67d266b32142c034520acbcdc30f7213db5e13
Test: m

Remi NGUYEN VAN   commited 2021-03-22 00:01:43 +00:00
acd6de1364
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

Remi NGUYEN VAN   commited 2021-03-18 00:29:08 +09:00
1142754c99
Merge "Add ConnectivitySettingsManager"
Paul Hu   authored and   Gerrit Code Review   commited 2021-03-17 14:57:32 +00:00
3e17e82ab1
Merge "Remove Protocol.BASE_* usage in Connectivity"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-17 14:53:26 +00:00
7ffb87e4ce
Merge "Remove Settings.Global.TCP_DEFAULT_INIT_RWND on CS"
Paul Hu   authored and   Gerrit Code Review   commited 2021-03-17 14:44:17 +00:00
3d136c56ca
Merge "Remove extra comment"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-17 12:16:09 +00:00
be83a4afc5
Remove Protocol.BASE_* usage in Connectivity
ConnectivityManager and NetworkAgent do not share their handler with any
other component, so there is no reason to use addresses that do not
overlap. Protocol.BASE_* was written to allow for interaction "between
different StateMachine implementations without a conflict", but the
classes do not use StateMachine, and they do not have such interactions.

Bug: 177046265
Test: atest FrameworksNetTests
Change-Id: I18c341d4a2c01cb9559d682a9ad1ff259e6b5855

Remi NGUYEN VAN   commited 2021-03-17 20:56:50 +09:00
a711b3f96c
Merge "Modify the comment of getPrivateDnsMode"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-03-17 11:25:18 +00:00
de9a3af4de
Merge "Remove usage of networkAttributes"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-17 11:24:28 +00:00
5ccc21eb9b
Remove Settings.Global.TCP_DEFAULT_INIT_RWND on CS
TCP_DEFAULT_INIT_RWND setting has never been set before, CS
always read the tcp receive window size from
net.tcp.default_init_rwnd then set to net.tcp_def_init_rwnd.
Thus, remove the unnecessary setting from CS, and the property
doesn't need to set either. Because aosp/1639922 migrate the
properties, the default value has been set to kernel already.

Bug: 182538166
Test: atest FrameworksNetTests
Change-Id: I13e175ab4dea72446af7df4a25e307e5934fa813

paulhu   authored and   Paul Hu   commited 2021-03-17 11:14:35 +00:00
0620c858ae
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

Remi NGUYEN VAN   commited 2021-03-17 10:58:08 +00:00
eade234e2a
Add ConnectivitySettingsManager
This class is used to manager the connectivity module related
settings.

Bug: 182538166
Test: make
Change-Id: I5e02e719ce0d305d7c8a45fefb850d7b981f07eb

paulhu   commited 2021-03-17 18:24:16 +08:00
1510c9c29f
Modify the comment of getPrivateDnsMode
Bug: 172183305
Test: m
Change-Id: I2f1b44cf2a362b42f052ea5d34a5cec03d46e661

lucaslin   commited 2021-03-17 14:53:35 +08:00
73c9860a06
Merge "Change the parameter type from ContentResolver to Context"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-03-17 06:35:21 +00:00
8d638d9434
Merge changes I335e82e2,I84ba363d,I8f18083b,I854a952d,I00e23441
* changes:
  Remove per-user preference when the user is removed
  Expose the enterprise per-profile networking API.
  Implement setNetworkPreferenceForUser.
  Public API for per-profile network preference.
  Add tests for setNetworkPreferenceForUser

Chalard Jean   authored and   Gerrit Code Review   commited 2021-03-17 05:48:18 +00:00
bf97a3ab5e
Merge "Remove MessageUtils usage in VpnTransportInfo"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-17 00:14:10 +00:00
0b33d35188
Merge "Move LocationPermissionChecker to libs/net"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-17 00:13:21 +00:00
6dde6eceab
[VCN14] Expose registerBestMatchingNetworkCallback
Test: m -j doc-comment-check-docs
Bug: 175662146
Change-Id: Ie67dd2f4f8d973de37bc64a03908d7cbb7c2b7ad

junyulai   commited 2021-03-16 21:30:56 +08:00
bd62226850
[VCN13] Implement tracking best matching network
This is done by:
  1. In requestNetwork, provide a basic permission check.
  2. rematchNetworksAndRequests: no change, since non listen
     requests will be automatically processed to track
     best satisfying network.
  3. applyNetworkReassignment: no change, since non-request
     will not be sent to factories.

Test: atest ConnectivityServiceTest#testRegisterBestMatchingNetworkCallback_noIssueToFactory
Test: atest ConnectivityServiceTest#testRegisterBestMatchingNetworkCallback_trackBestNetwork
Bug: 175662146
Change-Id: I8cf4ab334df6812d84cdda160e9b72b6f54062af

junyulai   commited 2021-03-16 21:30:55 +08:00
8cae3c748f
Merge "Replace interal okhttp APIs"
Paul Hu   authored and   Gerrit Code Review   commited 2021-03-16 12:18:49 +00:00
e3ed08a24d
Remove per-user preference when the user is removed
Test: new test for this
Change-Id: I335e82e29ec8f4c8da9def8b40153858cfd5bacb

Chalard Jean   commited 2021-03-16 12:14:12 +00:00
6bb468c476
Expose the enterprise per-profile networking API.
Also unify the listener for Oem settings, which have
never been released as public API (it is slated to be
released in S).

Test: FrameworksNetTests
Change-Id: I84ba363dd0ec03871c37b1c3a31e5557d9aa12e7

Chalard Jean   commited 2021-03-16 12:14:00 +00:00
cc9ad15cd2
Implement setNetworkPreferenceForUser.
Test: FrameworksNetTests
Change-Id: I8f18083b5857289892fe8adea5f5ea3f5dbe0809

Chalard Jean   commited 2021-03-16 12:13:46 +00:00
9d96818bf2
Public API for per-profile network preference.
This patch defines the API, but does not make it public
yet as there is no implementation yet.

Test: none so far
Change-Id: I854a952dfe35cc80847eb62f522b1667b8e9b8a0

Chalard Jean   commited 2021-03-16 12:13:27 +00:00
03433057cb
Add tests for setNetworkPreferenceForUser
Test: this
Change-Id: I00e2344118408da307439a0a993eb67cb17bf777

Chalard Jean   commited 2021-03-16 12:11:27 +00:00
38a4e7fb76
Merge "Remove NETWORK_STACK_UID check"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-03-16 11:26:24 +00:00
5f7eb9024e
Change the parameter type from ContentResolver to Context
Context is more useful than ContentResolver, it can provide more
information if we want to change the behavior in the future.

Bug: 172183305
Test: atest FrameworksNetTests
Change-Id: I5702c7d74b862a76558b94f1abe2c6df9eb7f097
Merged-In: I5702c7d74b862a76558b94f1abe2c6df9eb7f097

lucaslin   authored and   Lucas Lin   commited 2021-03-16 09:26:57 +00:00
1162662032
Remove NETWORK_STACK_UID check
NETWORK_STACK_UID check was introduced by aosp/1134635, and it
assumed that wifi factories/agents will be running on the network
stack process, but it didn't eventually. It runs in the system
server instead. So remove this check.

Bug: 170598012
Test: atest FrameworksNetTests
Change-Id: Ie11268738e364e252f18876f7a4a0dc064ca8b9c

lucaslin   authored and   Lucas Lin   commited 2021-03-16 09:16:38 +00:00
2d72a13e60
Merge "Add comments to describe the value of converting hex to decimal"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-03-16 08:31:10 +00:00
26f778d2bd
Merge "Have a new API to get private DNS mode"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-03-16 07:39:35 +00:00
11a286c9b5
Remove usage of networkAttributes
networkAttributes is a legacy configuration that is now only used to
configure which legacy type networks are supported, and what the restore
timer is for that network type, for the deprecated
startUsingNetworkFeature API.

Use a dedicated resource for the restore timers, and build supported
legacy network types using hasSystemFeature for wifi, wifi p2p,
bluetooth, proxy types, and TelephonyManager.isDataCapable for the
mobile types.

Bug: 146206136
Test: atest FrameworksNetTests
Change-Id: I3a771d3de6c5e912f18d2834e3a50af797ac4991

Remi NGUYEN VAN   commited 2021-03-16 16:01:40 +09:00
9f9922813f
Merge "[NS01] Add NetworkScore"
Chalard Jean   authored and   Gerrit Code Review   commited 2021-03-16 06:36:07 +00:00
98de10a7a1
Merge "Add ParseException constructors to API"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-16 06:25:16 +00:00
ef7b38b334
Merge "Create ServiceConnectivityResources"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-16 02:29:31 +00:00
eb46aa1c58
Replace interal okhttp APIs
Connectivity is becoming a mainline module in S but mainline
modules are not allowed to use non-formal APIs. Thus, replace
internal okhttp APIs to stable libcore APIs which are created for
using HttpURLConnectionFactory.

Bug: 182238821
Test: atest FrameworksNetTests
Change-Id: I56ba1b9e6e94f9c6519c3f1c8f0c5993fccbe185

paulhu   commited 2021-03-15 23:06:15 +08:00
e5852fbc9a
Merge "Call clearCallingIdentity when calling registerNetworkProvider in TNS"
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-03-15 13:09:14 +00:00
85bea4887f
Merge changes from topic "pacproxy-service"
* changes:
  Make PacProxyService be a system service
  Revert^2 "Refactor setCurrentProxyScriptUrl to a void method"

Aaron Huang   authored and   Gerrit Code Review   commited 2021-03-15 11:49:45 +00:00
267bebc6a9
Merge changes from topic "jni-errno-exception"
* changes:
  Using jniThrowErrnoException in android_util_Process
  Using jniThrowErrnoException in android_os_SharedMemory
  Using jniThrowErrnoException in android_net_NetworkUtils

Sorin Basca   authored and   Gerrit Code Review   commited 2021-03-15 11:16:14 +00:00
685a40571c
Add comments to describe the value of converting hex to decimal
Bug: 172183305
Test: N/A
Change-Id: Id274295d6c8c97d3014214f875168ff968f79bb6

lucaslin   authored and   Lucas Lin   commited 2021-03-15 09:55:39 +00:00
286330701c
[NS01] Add NetworkScore
As attested by numerous TODOs in the code, a new way of
representing network quality and policy is needed instead
of an int.

An int representing the quality of the network requires
all parties using it to know how all other parties are
using it, and implementation details about the decision
algorithm. For all intents and purposes, the selection
is left to individual network factories who try to
achieve a desired result while piecing together all
possible states of the system.

As the number of such cases and desires increases, this
becomes both intractable and unmaintainable. Indeed, at
this time in the codebase nobody can really predict exactly
how a given change in score will affect selection across
the board, and it is essentially impossible to figure out
the behavior of network selection by inspecting the code
because the moving parts are scattered throughout the
entire codebase.

Having an object encapsulating policy and quality values
will let us centralize the selection and make it again
possible to maintain without knowledge of all behaviors
of all network factories. It will also provide better
guarantees of respecting policy, and allow bugfixes that
were not possible before because they'd touch too many
parts of the code.

Test: FrameworksNetTests FrameworksWifiTests NetworkStackTests
Change-Id: I3185a6412b9b659798faf0c6882699e9c63cc115

Chalard Jean   commited 2021-03-15 09:49:47 +00:00
dd75352682
Merge "[CS15]Do not use hidden API of PlatformProperties"
Frank Li   authored and   Gerrit Code Review   commited 2021-03-15 08:01:26 +00:00
b9db86ff3b
Merge "Revert "Remove connectivity dependency on Preconditions""
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-15 07:30:20 +00:00
c407499db5
Revert "Remove connectivity dependency on Preconditions"
This reverts commit 1c17c88002.

Reason for revert: Build broken: b/182721112

Change-Id: Ibc84ec6d7900fdcf0bc14cd7036f9c08287711db

Remi NGUYEN VAN   commited 2021-03-15 07:27:44 +00:00
00c531f4e0
Merge "Replace InetAddress#parseNumericAddress"
Paul Hu   authored and   Gerrit Code Review   commited 2021-03-15 07:03:46 +00:00
67503fefc6
Make PacProxyService be a system service
PacProxyInstaller class is running a thread all the time and is
listening to intent ACTION_PAC_REFRESH so it would be better to
make it be a system service with a manager class PacProxyManager
which is obtained with getSystemService(PacProxyManager.class).
Besides, rename PacProxyInstaller to PacProxyService will
be easier to know it's the service for PacProxyManager.

ConnectivityService is going to be a mainline module and it
needs constructor of PacProxyService to be SystemApi.
However, in current design, it needs to pass a handler and
an int arguments to the constructor which would be difficult
to maintain if just expose the constructor directly.

So, define a listener for the event that the current PAC
proxy has been installed so that the handler and the int
arguments can be removed from the constructor.

Bug: 177035719
Test: FrameworksNetTests
Change-Id: I2abff75ec59a17628ef006aad348c53fadbed076

Aaron Huang   commited 2021-03-15 14:40:58 +08:00
b2ad4a95ba
Merge "Remove connectivity dependency on Preconditions"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-15 06:36:15 +00:00
83c34e272a
[CS15]Do not use hidden API of PlatformProperties
ConnectivityService is going to become a mainline module, and
it will not able to use hidden method anymore. Using PlatformProperties
as a static library instead of hidden API.

Bug: 170917042
Test: atest FrameworksNetTests
Merged-In: I3a3deca5d2e0f690db8c0061de2db2217376d268
Change-Id: I3a3deca5d2e0f690db8c0061de2db2217376d268

lifr   commited 2021-03-15 14:14:18 +08:00
51b9799737
Call clearCallingIdentity when calling registerNetworkProvider in TNS
The caller to create a TestNetworkService via
ConnectivityManager#startOrGetTestNetworkManager should have
passed the MANAGE_TEST_NETWORKS permission check and the caller
doesn't need to declare the permission to pass the permission
check of registerNetworkProvider. So call clearCallingIdentity
when calling registerNetworkProvider in TestNetworkService.

Bug: 181573283
Test: atest CtsNetTestCases:ConnectivityManagerTest#testRequestBackgroundNetwork
Change-Id: Ia28627dacf933d1937978ed9709b975c9a4660ce

lucaslin   authored and   Lucas Lin   commited 2021-03-15 03:29:29 +00:00
b0228dae26
Merge "Remove VpnType usage in VpnTransportInfo"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-03-15 01:52:30 +00:00
e7ea40527a