Commit Graph

1484 Commits

Author SHA1 Message Date
junyulai
0835a1eaea [KA04] Expose TCP socket keepalive API
The new set of API allows applications to request keepalives
offload for established TCP sockets over wifi.

However, the application must not write to or read from the
socket after calling this method, until specific callbacks are
called.

Bug: 114151147
Test: atest FrameworksNetTests FrameworksWifiTests NetworkStackTests

Change-Id: I3880505dbc35fefa34ef6c79555458ecf5d296a4
2019-02-06 22:51:42 +09:00
Chalard Jean
6e55aca3fa Merge "[KA03.5] Add stable AIDL parcelable for TcpKeepalivePacketData" 2019-02-06 09:19:07 +00:00
Treehugger Robot
39d46d221b Merge "Deprecate getActiveLinkProperties." 2019-02-06 08:32:10 +00:00
Remi NGUYEN VAN
94ff95bbcd Add API for NetworkStack to start captive portal
Endpoints protected with INTERACT_ACROSS_USERS_FULL, such as
startActivityAsUser, should only be used by modules signed with the
platform cert. The NetworkStack needs to have the system server start
the application so this restriction can be applied.

Bug: 123846255
Test: flashed, captive portal works from primary and secondary user
Change-Id: Ib3e427b3fd03ced80c02985e795f79b096a2ec9a
2019-02-06 16:38:32 +09:00
Chalard Jean
97021a1eeb Deprecate getActiveLinkProperties.
There are other, more idiomatic ways to do this. Deprecating this
with usage limited to P will curb usage and reduce the maintenance
load.
This also deprecates the extra EXTRA_NETWORK_TYPE, which has
survived from an old world but has only been used in deprecated
broadcasts for some time.

Bug: 109783091
Test: eyeball current.txt
Change-Id: I87b74833bb4ec362ee3fd07511a66d318c29067d
2019-02-06 15:44:44 +09:00
junyulai
80d0356311 [KA03.5] Add stable AIDL parcelable for TcpKeepalivePacketData
Bug: 114151147
Test: atest FrameworksNetTests
Change-Id: I057dde79013b9eda5037b9a44f8eee06cc07352e
2019-02-06 14:07:39 +09:00
markchien
e5591ce2fa [KA03] Support tcp keepalive offload
When offload is starting, socket will be switched to repair
mode. Read and write on the socket will not be allowed until
repair mode is turned off. If remote packet arrives, repair
mode will be turned off automatically and a callback will
be raised to indicate that socket is ready to read from.

Bug: 114151147
Test: -atest FrameworksNetTests
      -manual

Change-Id: I0c335865912e183e7ad32a8ea12188f02ccde5fd
2019-02-06 12:22:22 +09:00
junyulai
011b1f15c2 [KA02] internal cleanup and refactor for SocketKeepalive
In previous change, the new SocketKeepalive API was exported.
But internally, old PacketKeepalive names and structures are
still used.

This change rename them properly for code consistency and also
refactor KeepalivePacketData to support different types of
KeepalivePacketData.

Bug: 114151147
Test: 1. atest FrameworksNetTests
      2. atest FrameworksWifiTests
      3. atest FrameworksTelephonyTests

Change-Id: Ia9917d12987e91e87e34ffb3f126e7bc7c9c187e
Merged-In: Ia9917d12987e91e87e34ffb3f126e7bc7c9c187e
2019-02-05 20:13:47 +09:00
Remi NGUYEN VAN
af8e41c434 Merge changes from topic "bindprocess-resolv"
* changes:
  Allow use of bindProcessToNetwork only to change private DNS bypass.
  Allow bypassing private DNS via bindProcessToNetwork.
2019-01-31 07:52:04 +00:00
Mark Chien
029be80b79 Merge "Add get last entitlement value callback API" 2019-01-31 07:23:31 +00:00
markchien
0f45bb9d3d Add get last entitlement value callback API
The callback would be used to notify entitlement value. If the
cache value indicates entitlement succeeded, it just fire
callback with cache value instead of run entitlement check.

Bug: 120887283
Test: atest FrameworksNetTests
Change-Id: I8afe928423bd75c54c61533a50a5c0814922ceb1
2019-01-31 12:31:55 +08:00
Lorenzo Colitti
3c766ebc4d Allow use of bindProcessToNetwork only to change private DNS bypass.
Currently it is not possible to change private DNS bypass by
doing:

  setProcessDefaultNetwork(network.getPrivateDnsBypassingCopy());
  setProcessDefaultNetwork(network);

because the code will ignore the change. Fix this by ensuring
that we always call bindProcessToNetwork (which does not have
side effects) and then only performing the expensive operations
(flushing DNS cache, upating socket pools) if the netId changed.

Bug: 112869080
Test: None
Change-Id: I5e8999cb11d8b8c1e9eb583fa8b3932f212accff
2019-01-31 13:08:24 +09:00
Remi NGUYEN VAN
b591097458 Merge "Add SystemApi for captive portal metrics" 2019-01-30 22:24:12 +00:00
Pavel Grafov
4ed5cbd750 Nuke old setAlwaysOnVpnPackageForUser method.
All callers have migrated to 4-argument one.

Test: builds
Bug: 77468593
Change-Id: I253515f6b0100b675505646339e5b82d373c9429
2019-01-30 19:56:36 +00:00
Lorenzo Colitti
3a1cb9d615 Allow bypassing private DNS via bindProcessToNetwork.
Currently, bypassing private DNS requires calling the deprecated
setProcessDefaultNetworkForHostResolution. Allow apps to do this
via the non-deprecated binProcessForNetwork as well.

This has fewer backwards compatibility concerns than the
alternative approach of having setProcessDefaultNetwork call
setProcessDefaultNetworkForHostResolution. That approach would
have been problematic, for example, if an app did:

  cm.bindProcessToNetwork(network);
  ...
  cm.bindProcessToNetwork(null);

In this case, it would be difficult to know whether to clear the
resolver mapping as well: what if an app had also called
setProcessDefaultNetworkForHostResolution?

Similarly, it would be difficult to know what to do if an app did:

  cm.setProcessDefaultNetworkForHostResolution(network);
  cm.bindProcessToNetwork(null);

This approach does not have these concerns, and has no effect
on apps that don't call Network.getPrivateDnsBypassingCopy, which
regular apps don't have permission to use. It also provides a
path to deprecate setProcessDefaultNetworkForHostResolution.

Bug: 112869080
Test: atest android.net.cts.ConnectivityManagerTest android.net.cts.MultinetworkApiTest
Change-Id: I4158a37b6ed87a9a9b2677c526dcfee8af48e483
2019-01-31 00:55:47 +09:00
Remi NGUYEN VAN
fb43a914d3 Add SystemApi for captive portal metrics
The metrics go through NetworkMonitor in the NetworkStack so that they
can be upgraded to new metrics in the future.

Test: flashed, captive portal login works, metrics shown in events log
Bug: 112869080
Merged-In: I4bccfbd87bae5b2d65e45c7a5918aa45ab5d76e8
Change-Id: Ib5e2126788f8d56a00a56d7efcd33c5f9a37a6de
2019-01-30 22:54:27 +09:00
Remi NGUYEN VAN
6e82be4e4a Remove last NetworkStack usage of hidden APIs
Includes various small changes to stop using hidden APIs

Test: make NetworkStack
Test: flashed, booted, WiFi and tethering working
Bug: 112869080
Change-Id: Id2830795a444f484b377ed6437435a1cd833697a
2019-01-30 10:23:24 +09:00
Remi NGUYEN VAN
c7fe99fdbe Add NetworkUtils utilities to SystemApi
attach*Filter and addArpEntry are necessary for the NetworkStack but are
only usable for apps that have system permissions.
Also includes system API for IpPrefix, LinkAddress, LinkProperties,
Network, and static modifier in ApfCapabilities that were missed in
previous CLs.

Test: Builds, flashed, WiFi works
Bug: 112869080
Change-Id: If141ae6a2f9145f5af64ba002ca44938f39b90a9
2019-01-29 17:30:26 +09:00
Remi NGUYEN VAN
37053eb78e Merge "Add SocketUtils for NetworkStack" 2019-01-28 23:14:08 +00:00
Pavel Grafov
76e3e0052c Merge "Whitelist packages from VPN lockdown." 2019-01-28 20:15:49 +00:00
Remi NGUYEN VAN
a628730d0a Add SocketUtils for NetworkStack
These utilities can only be used for privileged apps. The underlying
implementation cannot be @SystemApi.

Test: m
Bug: 112869080
Change-Id: Idfa90561102e5b03ab2b79486d3ad46457128bf8
2019-01-28 20:11:27 +09:00
Remi NGUYEN VAN
8f8deae60f Merge "Move NetworkUtils used by NetworkStack" 2019-01-28 09:06:20 +00:00
Remi NGUYEN VAN
e167e117c1 Move NetworkUtils used by NetworkStack
Depending on usage move into NetworkStackUtils or shared
Inet4AddressUtils.

Test: atest FrameworksNetTests NetworkStackTests
Bug: 112869080
Merged-In: Ie20dcee375b377236004a7689890729493aca857
Change-Id: Ib8d000529872796022706a35050fdc2c7141f2ab
2019-01-28 13:45:17 +09:00
Remi NGUYEN VAN
8bd18cff9a Add NetworkStack networking deps to SystemApi
Cherry-pick with conflicts fixed in CaptivePortalLoginActivity imports.
Test: atest FrameworksNetTests
Bug: 112869080
Merged-In: Id59dc06fb85e4ac88098f56b621ec880610759ce
Change-Id: I3c05e8fdd70497426d4fa433295c4fbdad07d9c9
2019-01-28 13:28:35 +09:00
Pavel Grafov
3aeb3f3455 Whitelist packages from VPN lockdown.
Bug: 77468593
Test: atest com.android.server.connectivity.VpnTest
Change-Id: I9119c139ab07a761ce5dfd1365b70eb905fd32dc
2019-01-25 19:59:03 +00:00
Dan Albert
7e81ae73b4 Merge "Revert "Whitelist packages from VPN lockdown."" 2019-01-24 21:08:46 +00:00
Dan Albert
45f1a24661 Revert "Whitelist packages from VPN lockdown."
This reverts commit f1a610a1c2.

Reason for revert: broke pi-dev-plus-aosp

Change-Id: Iaf5c8aa4a8720eb2852da8cd91c81a77ccb92b68
2019-01-24 21:05:39 +00:00
Treehugger Robot
b11e29d4b3 Merge "Add API for proxy configuration over VPN." 2019-01-24 17:52:22 +00:00
Pavel Grafov
bec7854508 Merge "Whitelist packages from VPN lockdown." 2019-01-24 17:34:55 +00:00
Pavel Grafov
f1a610a1c2 Whitelist packages from VPN lockdown.
Bug: 77468593
Test: atest com.android.server.connectivity.VpnTest
Test: atest MixedDeviceOwnerTest#testAlwaysOnVpn
Test: MixedDeviceOwnerTest#testAlwaysOnVpnAcrossReboot
Change-Id: I7f6c5b9172063b588feacd6b9930a6cb88f764ab
Merged-In: I7f6c5b9172063b588feacd6b9930a6cb88f764ab
2019-01-24 16:17:11 +00:00
Irina Dumitrescu
de132bb6d6 Add API for proxy configuration over VPN.
Test: runtest -x
frameworks/base/tests/net/java/com/android/server/ConnectivityServiceTest.java
&& atest HostsideVpnTests
Bug: 76001058
Change-Id: Id4dde4a4103fd93bfbbacc52d0e5ade56ae67a6a
Merged-In: Id4dde4a4103fd93bfbbacc52d0e5ade56ae67a6a
2019-01-24 16:07:20 +00:00
Remi NGUYEN VAN
24f1f0be3c Merge "Add additional SystemApi for NetworkStack" 2019-01-24 09:55:01 +00:00
Junyu Lai
455df13823 Merge changes from topic "ka05"
* changes:
  [KA05] Export keepalive offload api for IpSec Nat-T file descriptor
  [KA01] export SocketKeepalive API for NAT-T keepalive
2019-01-24 05:06:39 +00:00
junyulai
d05a192fbe [KA05] Export keepalive offload api for IpSec Nat-T file descriptor
Adds system api of createSocketKeepalive to take file descriptor,
so privileged apps could use it without the need of IpSecService.

Bug: 114151147
Test: atest FrameworksNetTests
Change-Id: If926c21704b6ed73a0adfcadad732b97b42bacae
2019-01-24 00:40:25 +08:00
Remi NGUYEN VAN
d9f75865cf Add additional SystemApi for NetworkStack
Members in this CL were missed in earlier changes.

Test: m
Bug: 112869080
Merged-In: I8b5b80ea7b267357eb0387d504a2f78358d6d502
Change-Id: I8b9b15f8b91962f3ef554fd222a825e471806c9e
2019-01-24 01:01:13 +09:00
junyulai
4c95b08a23 [KA01] export SocketKeepalive API for NAT-T keepalive
The new set of API replace the PacketKeepalive system API
which is only specific for IPsec NAT-T keepalive packet. Allows
applications to request different types of keepalives through
the same set of API.

By using keepalives, applications could request system to
periodically send specific packets on their behalf, using
hardware offload to save battery power.

This change would only address interface change and test part of
original functionality. After all reference of PacketKeepalive
are removed, another change would be submitted to remove old
API.

Bug: 114151147
Test: atest FrameworksNetTests
Change-Id: I3367666810acc44d5ad20e19acd4bf936e8b5d9c
2019-01-23 23:17:17 +08:00
Remi NGUYEN VAN
4bcdcfebd4 Merge changes I1250730c,I7d00848c
* changes:
  Create a wrapper for IpClient
  Move IpClient to NetworkStack
2019-01-23 15:05:00 +00:00
Luke Huang
6fd9d58242 Merge changes from topic "Java async dns"
* changes:
  Add asynchronous DNS query API in Java
  Add jni method for DnsResolver
2019-01-23 08:48:23 +00:00
Remi NGUYEN VAN
290455ec58 Move IpClient to NetworkStack
Test: atest FrameworksNetTests NetworkStackTests
Bug: b/112869080
Change-Id: I7d00848c052382cd1b6ce458868bed6a1e9e8ec5
2019-01-23 16:44:21 +09:00
Remi NGUYEN VAN
1aa810b0f3 Merge "Add getAvoidBadWifi system API" 2019-01-23 01:13:01 +00:00
Luke Huang
6d23e740f8 Add asynchronous DNS query API in Java
DnsResolver for asynchronous DNS querying
DnsPacket for parsing answer

Test: built, flashed, booted
      atest DnsResolverTest
      atest DnsPacketTest

Change-Id: Id014bc7387dd940cfaa270f68e7d4d85fab320a0
2019-01-23 00:07:43 +08:00
Luke Huang
4e5831aecc Add jni method for DnsResolver
Test: built, flashed, booted
      atest DnsResolverTest

Change-Id: Iff730ec918f4db1ba0216f90a12550fe26e271d0
2019-01-23 00:07:43 +08:00
Remi NGUYEN VAN
27de63e494 Add getAvoidBadWifi system API
This helps remove the dependency on MultinetworkPolicyTracker from
IpClient.

Test: atest FrameworksNetTests NetworkStackTests
Bug: 112869080
Change-Id: If56791dbed564772f25a859f301b8b52d84e38a3
2019-01-22 15:57:34 +00:00
Remi NGUYEN VAN
44ed85862c Migrate ICaptivePortal to stable AIDL
Also add required API for the captive portal app to stop using hidden
members.

Test: atest FrameworksNetTests NetworkStackTests
Bug: 112869080
Merged-In: I62b457e709fa199822bb8f80b0eab990be4ded93
Change-Id: I62b457e709fa199822bb8f80b0eab990be4ded93
2019-01-23 00:53:13 +09:00
Pavel Grafov
5e135e2bdc Merge "Add API for VPN apps to query always-on and lockdown." 2019-01-22 14:43:06 +00:00
Remi NGUYEN VAN
109f8d5585 Add LinkProps and NetworkCaps methods to SystemApi
Added methods are used by the NetworkStack.

Test: atest FrameworksNetTests NetworkStackTests
Bug: 112869080
Change-Id: I8822d43c1a4981ca39289525685b3f975fb0e8d5
2019-01-22 16:57:16 +09:00
Remi NGUYEN VAN
a1e4e0bc23 Merge "Add NetworkMonitor constants to SystemApi" 2019-01-22 03:03:37 +00:00
Remi NGUYEN VAN
aa983b7f1c Merge "Add fields used by NetworkStack to the API" 2019-01-21 23:20:26 +00:00
Remi NGUYEN VAN
85b9665073 Add fields used by NetworkStack to the API
Test: m
Bug: 112869080
Change-Id: I59f6d5ae8a601b7496548b87f137a577f2365a37
2019-01-21 23:03:25 +09:00
Pavel Grafov
e87b7ceaa6 Add API for VPN apps to query always-on and lockdown.
Test: atest MixedDeviceOwnerTest#testAlwaysOnVpn
Bug: 72628179
Change-Id: I73cb0888f7049b12ab0cdfa62678c3846e074d3b
2019-01-21 13:48:45 +00:00