Commit Graph

2423 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
852709e1cd Merge "Split NetworkUtils and NetworkUtilsInternal" am: caa437cae0 am: 15befc3d9e am: a0ac08e394
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1513140

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ief9d6a1fae360dbe1c43d5d6bac4dad5850c004b
2020-12-23 02:22:35 +00:00
Remi NGUYEN VAN
caa437cae0 Merge "Split NetworkUtils and NetworkUtilsInternal" 2020-12-23 01:19:27 +00:00
Chiachang Wang
ebd47651f1 Merge "[IT03] Add replacement methods for network activity" am: 5cb10d24d0 am: 59dd3432f7 am: 4c7befb656
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1523338

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0da6d452e989f7a89e33230cabfdc89c1a49ce6d
2020-12-22 06:58:05 +00:00
Chalard Jean
e294449129 Merge "Move module utils to the module package." 2020-12-21 05:35:09 +00:00
Chiachang Wang
b4bba7179b [IT03] Add replacement methods for network activity
Reference for NMS in ConnectivityManager should be removed for
incoming CS mainline. The API for listening network activity
should not go into NMS. As an alternative, the registry requests
should be sent to CS and handled by CS. Add necessary alternative
in IConnectivityManger first. The detail implementation will be
added in the follow up commits.

Bug: 170598012
Test: m
Change-Id: If4d24b937feb88a61f22073af2f671cf20298364
2020-12-21 03:48:54 +00:00
Chalard Jean
fa159c1755 Move module utils to the module package.
Test: FrameworksWifiTest FrameworksNetTest
Change-Id: If5d1e4a58fb2d6d9544e6d01995dabe445cf1f25
Merged-In: I067eeecd458c34b7f2fbfa439072682661ac750c
2020-12-16 11:44:22 +09:00
Sarah Chin
cf44f2fe10 Move phone ID to extra for action provision
Previously, the phone ID was appended to the broadcast in DCT and sent
to ConnectivityManager. Instead of sending both as an action, send the
phone ID as an extra instead to make the action a protected broadcast.

Test: manually verify a SecurityException when action provision is sent
Test: atest DcTrackerTest
Bug: 172459128
Change-Id: Ic4129def86949d7191d15056852718dadbd72fba
Merged-In: Ic4129def86949d7191d15056852718dadbd72fba
2020-12-15 10:55:22 -08:00
Remi NGUYEN VAN
6ebd98efc1 Add TcpKeepalivePacketData to SystemApi am: 11511b31f6 am: 349ba03274 am: 7240fd9ea1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1494038

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1aa9deefefcaf75959463e8a8a87bfeefb98f0ee
2020-12-15 11:42:19 +00:00
Sarah Chin
1be00b7b29 Merge "Move phone ID to extra for action provision" 2020-12-15 11:07:25 +00:00
Remi NGUYEN VAN
349ba03274 Add TcpKeepalivePacketData to SystemApi am: 11511b31f6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1494038

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ibe3df65b4e12ecda5d95737f3b1ea18dabc2461d
2020-12-15 09:38:38 +00:00
Remi NGUYEN VAN
3a86e4690e Merge changes from topic "tcp_keepalive_fix"
* changes:
  Use API TcpKeepalivePacketData in ClientModeImpl
  Add TcpKeepalivePacketData to SystemApi
2020-12-15 09:02:55 +00:00
Chiachang Wang
9f994053b3 Merge "Remove hidden deprecated getActiveNetworkQuotaInfo" am: 6443bf4c41 am: 8413fe564e am: 53ffa8edac
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1527738

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3f3b1e288635d84e93115fddbbafb5321f55646e
2020-12-15 08:55:43 +00:00
Sarah Chin
cab74db6c0 Move phone ID to extra for action provision
Previously, the phone ID was appended to the broadcast in DCT and sent
to ConnectivityManager. Instead of sending both as an action, send the
phone ID as an extra instead to make the action a protected broadcast.

Test: manually verify a SecurityException when action provision is sent
Test: atest DcTrackerTest
Bug: 172459128
Change-Id: Ic4129def86949d7191d15056852718dadbd72fba
2020-12-15 00:25:01 -08:00
Chiachang Wang
6443bf4c41 Merge "Remove hidden deprecated getActiveNetworkQuotaInfo" 2020-12-15 07:02:54 +00:00
Chiachang Wang
7fe67c1961 Remove hidden deprecated getActiveNetworkQuotaInfo
getActiveNetworkQuotaInfo has never been in API surface since it
was introduced. It became essentially functionless since android O,
so there should be no usage dependency upon the hidden method,
In order to support ConnectivityService mainline, remove the
useless function to prevent necessary dependency.

Bug: 172183305
Test: atest FrameworksNetTests
Change-Id: Ia685b3260256d465ef614b2f577d13344074c787
2020-12-15 06:45:50 +00:00
Remi NGUYEN VAN
11511b31f6 Add TcpKeepalivePacketData to SystemApi
This is consistent with NattKeepalivePacketData, which is also a
subclass of KeepalivePacketData.

TcpKeepalivePacketData is already used by the wifi module, but
statically linked.

Bug: 172789687
Test: m
Change-Id: I6aee1ae205987521bea4a3838bbece279ffa0e37
2020-12-14 18:43:44 +09:00
Paul Hu
19606c6e32 Merge "Expose TcpRepairWindow as module-lib API" am: ec942a8e70 am: 3988f15290 am: 3bee0fbcc8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1519961

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iae69946c88267eca4c350d902df0af50fca9de5b
2020-12-11 11:04:22 +00:00
Chalard Jean
d2c548d880 Merge changes from topic "remove_legacy_NA" am: 71ab824707 am: a698a47ada am: 7ba18da6b6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1456097

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If9cd6ce929a7103d2d6b7195a71ee64ea0a4ee0a
2020-12-11 11:03:36 +00:00
Paul Hu
ec942a8e70 Merge "Expose TcpRepairWindow as module-lib API" 2020-12-11 05:37:10 +00:00
Chalard Jean
71ab824707 Merge changes from topic "remove_legacy_NA"
* changes:
  Remove support for legacy network agents
  Remove deprecated constructors for NetworkAgent
  Migrate NetworkAgentWrapper to the new NA API
  Cleanup TestNetworkService
2020-12-11 02:32:57 +00:00
Lorenzo Colitti
358aeea9d3 Merge changes I6eb6d92b,I638e29fd,I2348b7a3 am: 0da448710c am: 3ff54c739f am: 5bbcd79710
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1521657

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I430d7069e1dfbe89780cb459fff9e1eb63daa349
2020-12-10 09:18:35 +00:00
Lorenzo Colitti
0da448710c Merge changes I6eb6d92b,I638e29fd,I2348b7a3
* changes:
  Add a convenience method to update a network's capabilities.
  Disallow NetworkAgents from changing the owner UID.
  Observe mOwnerUID in NetworkCapabilities#equals.
2020-12-10 08:11:52 +00:00
Serik Beketayev
8a826845a3 Merge "[Mainline Migration] Migrate NetworkUtils" am: 8339b3ded3 am: 59f81edbdb am: 402f439ac1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1498168

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Id0749108e03d88af0b8c50a36f1a4ca28b9a40ce
2020-12-10 01:05:32 +00:00
Lorenzo Colitti
cb9bbf2c80 Observe mOwnerUID in NetworkCapabilities#equals.
Currently, NetworkCapabilities's equals and hashCode methods
ignore mOwnerUID. This is confusing because it is inconsistent
with pretty much every other member of this class.

Bug: 175188445
Test: atest CtsNetTestCases:NetworkAgentTest \
            CtsNetTestCases:Ikev2VpnTest \
	    CtsNetTestCases:VpnServiceTest HostsideVpnTests \
	    CtsNetTestCases:android.net.cts.ConnectivityDiagnosticsManagerTest \
	    ConnectivityServiceTest com.android.server.connectivity.VpnTest
Change-Id: I2348b7a35f32a931687f2d3c2fa57620a12fe06f
2020-12-09 19:33:32 +09:00
paulhu
e4a2c6ad2e Expose TcpRepairWindow as module-lib API
Connectivity service is going to become a mainline module which
will not be able to access hidden APIs. TcpKeepaliveController
is a part of CS mainline module, it uses TcpRepairWindow to
store tcp repair window info. Thus, expose TcpRepairWindow as
module-lib API to support the usage.

Bug: 172183305
Test: atest FrameworksNetTests
Change-Id: I1b6f5ae698f4b6e030a0f776aeafc774fa9f1437
2020-12-09 08:25:13 +00:00
Chalard Jean
74c32e10ab Remove support for legacy network agents
Test: FrameworksNetTests NetworkStackTests
Bug: 167544279
Change-Id: Ia950e16d991cd08d4b609d71aad61a4a4f7fda39
2020-12-08 19:43:11 +09:00
Chalard Jean
855c9c8f88 Remove deprecated constructors for NetworkAgent
Finally.

Now that mLegacy is always false, removing the support
for legacy agents, a follow-up change will remove
the member and all the associated code.

Test: FrameworksNetTests NetworkStackTests
Bug: 167544279
Change-Id: I6e2c27facdd3ecc232a0aa32bf57c33cb06f118e
2020-12-08 19:43:11 +09:00
Remi NGUYEN VAN
689c673aab Split NetworkUtils and NetworkUtilsInternal
NetworkUtils is planned to move to a dedicated JAR for connectivity
classes, while NetworkUtilsInternal would stay in the
frameworks-minus-apex JAR, in the com.android.internal.net package.

Bug: 171540887
Test: m, boots, wifi working
      atest FrameworksNetTests
Change-Id: I3d38d72ad23a4bf84af823c7baeb6fed25c0665f
2020-12-07 19:41:49 +09:00
Serik Beketayev
88bf984e07 [Mainline Migration] Migrate NetworkUtils
Migrating makeStrings(), numericToInetAddress() APIs

Bug: 173089079
Test: atest FrameworksNetTests
Change-Id: Ie914fd41bc3ce16d07f5d2768b89ce805b9245a9
2020-12-06 22:33:04 -08:00
Remi NGUYEN VAN
1ce3ea3908 Merge "Use IPV6_MIN_MTU from NetworkConstants in Ikev2Vpn" am: ab2944488f am: 1ebf8bfe18 am: 0249d5b5fa
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1512879

Change-Id: Id415ecdbf1509b9c2e1b3e50bb716e7368f83dfc
2020-12-04 05:14:21 +00:00
Remi NGUYEN VAN
ab2944488f Merge "Use IPV6_MIN_MTU from NetworkConstants in Ikev2Vpn" 2020-12-04 02:05:01 +00:00
Remi NGUYEN VAN
f6271f533e Merge "Do not query CS in NetworkProvider constructor" am: 6a6e5f8479 am: 0d1b3960e8 am: bcd4d930bc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1512873

Change-Id: I194f6fed28011702dd86676e5aa422129a903d9c
2020-12-03 03:47:02 +00:00
Remi NGUYEN VAN
6a6e5f8479 Merge "Do not query CS in NetworkProvider constructor" 2020-12-03 01:48:01 +00:00
Remi NGUYEN VAN
dffda33f86 Merge "Remove CaptivePortal deps on @hide MetricEvents" am: 465f25799c am: abbaff2736 am: 51dd9068c1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1513141

Change-Id: Ic0f0be93d4610f47c80efb90fdd68858d70d0be8
2020-12-02 12:43:12 +00:00
Remi NGUYEN VAN
465f25799c Merge "Remove CaptivePortal deps on @hide MetricEvents" 2020-12-02 11:12:56 +00:00
Remi NGUYEN VAN
336220dce3 Merge "Add ConnectivityManager.TYPE_PROXY to SystemApi" am: 5dccc26e60 am: d38176e41a am: f073553dcf
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1512885

Change-Id: Ib51a3218d736ab905379f20fbb059bb97b2297ef
2020-12-02 10:55:57 +00:00
Remi NGUYEN VAN
5dccc26e60 Merge "Add ConnectivityManager.TYPE_PROXY to SystemApi" 2020-12-02 09:23:27 +00:00
Remi NGUYEN VAN
5f6285c9c7 Remove CaptivePortal deps on @hide MetricEvents
The legacy metrics are deprecated, and CaptivePortal is planned to move
to a connectivity-specific jar which cannot reference MetricsEvents.

Bug: 171540887
Test: m
Change-Id: I409375de3844a7fedef707cf9e19a106d82a8e3a
2020-12-02 13:17:09 +09:00
Lorenzo Colitti
c8f90ba551 Merge changes I982543cd,I41c3bf6c,Id3e5f6e1 am: 4fe79a3ff9 am: db7c229729 am: d5450e378b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1511316

Change-Id: I91ccdc9a5f4426d9c1623b869c0411b9af203c36
2020-11-30 15:05:48 +00:00
Remi NGUYEN VAN
daeafeef37 Add ConnectivityManager.TYPE_PROXY to SystemApi
This follows other TYPE_* constants like TYPE_WIFI_P2P that are
@SystemApi or public.
TYPE_PROXY has a use-case for the system to set network policies based
on proxy network templates. Although network types are deprecated, that
use-case needs to be supported and significant amounts of network
management would need to be rewritten to stop using network types.

The constant needs to be API as ConnectivityManager is planned to move
out of framework.jar, so only its formal API will be available to the
system server.

Bug: 174436414
Test: m
Change-Id: I266ed6bc59f5eb72302afe14472c93933733c8f8
2020-11-30 19:23:45 +09:00
Remi NGUYEN VAN
0b3d600ff6 Use IPV6_MIN_MTU from NetworkConstants in Ikev2Vpn
Instead of sharing the constant from LinkProperties, use the already
defined constant in the NetworkConstants class.

This allows Ikev2VpnProfile to allow depending on non-public
LinkProperties APIs, as LinkProperties is planned to move to
framework-connectivity.

Bug: 174436414
Test: m
Change-Id: I594bb7e81bc7681799c16eff621a5ffd1b29624c
2020-11-30 17:18:51 +09:00
Chalard Jean
fd64bac5b6 Migrate VPN to the public NetworkAgent API.
On top of being a cleanup this is useful for the S Network
Selection project that will need to enrich the Network
Agent API, and as such should not have to support legacy
agents.

Test: FrameworksNetTests NetworkStackTests
Bug: 167544279
Change-Id: Id3e5f6e19829c64074cd6a52c5f950cee56b860b
2020-11-30 16:15:18 +09:00
Remi NGUYEN VAN
7820e22137 Do not query CS in NetworkProvider constructor
ConnectivityService may not be available in a NetworkProvider
constructor, if it is created (but still unused) before
ConnectivityService starts.

As ConnectivityManager is only necessary in
declareNetworkRequestUnfulfillable, which should not be called often,
just query ConnectivityManager at that point.

This is necessary for VcnManagementService, which is started before
ConnectivityService and creates its NetworkProvider in its constructor.
Fortunately VcnManagementService does not call
declareNetworkRequestUnfulfillable at this point.

ConnectivityManager may be migrated to classic service getters that
cache "null" when the service was not available the first time it is
queried, so no system service must query it before it starts.

Bug: 171540887
Test: atest FrameworksNetTests:NetworkProviderTest
Change-Id: I8dadcd0e1360a9464192f330493e13aa69dd9fe2
2020-11-30 12:42:15 +09:00
Lorenzo Colitti
7e32c1dd34 Allow tests to create TRANSPORT_TEST|TRANSPORT_VPN networks. am: 4b4fcc7a72 am: 04c831319e am: bb06c82637
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1511312

Change-Id: I631909b5db9507c7e62d498015c49d325d13f258
2020-11-28 04:51:03 +00:00
Lorenzo Colitti
3286928783 Move applying underlying caps from Vpn to ConnectivityService. am: 220987b38d am: a27c332849 am: ed3589c104
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1501815

Change-Id: I924998ffa45ba630d8688007878f339264e7108e
2020-11-28 04:50:46 +00:00
Lorenzo Colitti
4b4fcc7a72 Allow tests to create TRANSPORT_TEST|TRANSPORT_VPN networks.
This CL allows an app that has the MANAGE_TEST_NETWORKS
permission to create test VPN networks.

The code enforces that such networks can never apply to any UIDs
and thus will never carry any traffic.

Bug: 173331190
Test: passes existing tests, moved tests pass
Change-Id: I5befea0e3b4b6dce4ca0c6a04471a055186b644c
2020-11-27 15:35:38 +09:00
Lorenzo Colitti
220987b38d Move applying underlying caps from Vpn to ConnectivityService.
Add support to ConnectivityService to track underlying networks
directly instead of through the Vpn class.

1. Communicate all information necessary to propagate underlying
   network capabilities to ConnectivityService via NetworkAgent.
   This includes:
   a. Underlying networks:
      - Add SystemApi for NetworkAgent to declare its underlying
        networks to ConnectivityService, and use it in Vpn.
      - Add a new declaredUnderlyingNetworks member to
        NetworkAgentInfo and store the underlying networks in it.
	Move propagation of underlying network capabilities to
	mixInCapabilities, which is a natural place for it.
   b. "Always metered" bit:
      - Communicate this to ConnectivityService via the existing
        NOT_METERED capability. Store it in a new declaredMetered
	boolean in NetworkAgentInfo to separate it cleanly from
	the NOT_METERED bit in the capabilities, which depends on
	whether the underlying networks are metered or not. In
	order to ensure that this is only ever changed when a NC
	update is received from a NetworkAgent, define a new
	processCapabilitiesFromAgent similar to the existing
        processLinkPropertiesFromAgent.

2. Ensure that propagating underlying network capabilities does
   not read the VPN's NetworkCapabilities. In order to do this,
   ensure that all relevant information on underlying networks
   and metering is sent to ConnectivityService at NetworkAgent
   registration time. CS still calls Vpn#updateCapabilities when
   a user is added/removed, but that is deleted in a future CL.

3. Slightly generalize propagating underlying network
   capabilities because there may be other network types that
   also have underlying networks that aren't VPNs (e.g., VCN).
   - Introduce a new supportsUnderlyingNetworks() boolean method
     in NetworkAgentInfo.
   - Rename updateAllVpnsCapabilities to
     propagateUnderlyingNetworkCapabilities.

This commit does not move the actual logic of calculating the
underlying capabilities out of Vpn.java. That can be done in a
subsequent change once CS stops calling getUnderlyingNetworks().

This commit also does not modify any of the other code in CS that
directly accesses VPNs' underlying networks.

Bug: 173331190
Test: passes existing tests in ConnectivityServiceTest
Test: CTS test in r.android.com/1511114
Test: atest CtsNetTestCases:Ikev2VpnTest HostsideVpnTests
Change-Id: I5f76cb1aa4866efed3d5c4590e931fdb0e994f8d
2020-11-27 15:35:38 +09:00
Benedict Wong
4b2cf9e7d2 Merge "Expose MIN_MTU_V6 as a public, @hide constant" am: 26aa9c68f7 am: f7e4ee16aa am: b4ad0c6822 am: be4ea27157
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1505072

Change-Id: Iaa9e9dc9c60369f6b96e21d1619cbf2c88b22013
2020-11-20 02:50:21 +00:00
Benedict Wong
26aa9c68f7 Merge "Expose MIN_MTU_V6 as a public, @hide constant" 2020-11-20 01:30:18 +00:00
Sarah Chin
f091281698 Merge "Clarify documentation on TEMP_NOT_METERED API" am: ca4f15b079 am: 783560bffd am: de759e0ebe am: b236e66cfc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1504954

Change-Id: Ibfc36bfcf1550cd27ff5449d5dbd7ee34c9937c7
2020-11-19 19:30:04 +00:00