Commit graph android_packages_modules_Co.../core/java/android
Message SHA1
[CM] Fix NPE due to unvalidated callback value
When unregistering callback due to ON_UNAVAILABLE did not check for
a non-null callback.

Bug: 132950880
Test: atest ConnectivityServiceTest
Change-Id: I8f3322963f322e6690f1403681bf66e8b38b35f8

Etan Cohen   commited 2019-05-22 04:56:09 +00:00
b58e366f2d
Move keepalive constants to their right place
The constants CMD_{ADD,REMOVE}_KEEPALIVE_PACKET_FILTER are too
high in the file and not in order. These constants should be
moved back to their rightful place.

Bug: 123987395
Test: 1. m -j 2. m -j doc-comment-check-docs
Change-Id: I44c827d3a2011cf7c66c0444566e14192fec1b1b

junyulai   authored and   Junyu Lai   commited 2019-05-21 00:23:41 +00:00
654be392b6
Merge changes Ibcb91105,I0218f367
* changes:
  Limit unprivileged keepalives per uid
  Support customization of supported keepalive count per transport

Junyu Lai   authored and   Gerrit Code Review   commited 2019-05-10 05:47:23 +00:00
6a5c545890
Support customization of supported keepalive count per transport
This change specifies the required minimum supported keepalives
in SDK, and allows OEMs to customize supported keepalive count
per network through resource overlay.

Bug: 129371366
Test: 1. m -j doc-comment-check-docs
      2. atest FrameworksNetTests

Change-Id: I0218f3674628c13ead63fc9a873895ba7f113033

junyulai   commited 2019-05-10 00:36:58 +08:00
4dca18aa31
[CS] Unregister callback as part of onUnavailable dispatch
The onUnavailable semantics promise that it is equivalent to calling
the unregister callback method. But - it doesn't unregister the callback
allowing it to be reused. Fixed.

Additionally, modified the unregisterNetworkCallback method to not fail
on duplicate unregistration (since a callback could now self
unregister). Instead simply print a log.

Bug: 130651445
Test: atest ConnectivityServiceTest
Change-Id: I4c54b003a733eb0b1e4fd8674ed13081b1bef8e3

Etan Cohen   commited 2019-05-09 02:41:40 +00:00
6cb6599ddd
Merge "Move NattKeepalivePacketData out of the framework"
Aaron Huang   authored and   Gerrit Code Review   commited 2019-04-24 04:00:56 +00:00
d3ee38785b
Add configurability of LinkProperties, meteredness for Test Networks
This commit adds the ability to pass in LinkProperties and meteredness
for additional testing use cases.

Bug: ?
Test: Compiles. Test utility only.
Change-Id: Idf6c3bcae2dea5e61c0418b72b889496919be8ba

Benedict Wong   commited 2019-04-19 10:46:56 -07:00
6259ad2be9
Move NattKeepalivePacketData out of the framework
For implementing parcelable interface for NattKeepalivePacketData.
Move this class out of framework.jar and move to services.jar

This class is used in telephony-common.jar and it also loads
service.jar.

Bug: 33530442
Test: - build pass
      - atest NetworkStackTests
      - atest ConnectivityServiceTest

Change-Id: Id2fdec5c4015d2cefd8a93e0cfdcc3c304fc9b64

Aaron Huang   commited 2019-04-20 00:37:19 +08:00
f7adc47367
Merge "Fix DnsResolver API could not bypass private DNS correctly"
Luke Huang   authored and   Gerrit Code Review   commited 2019-04-16 09:03:22 +00:00
9c138c7a13
Merge "Restrict access to dangerous methods to <= P"
Chalard Jean   authored and   Gerrit Code Review   commited 2019-04-16 05:17:20 +00:00
861e9b56bd
Fix DnsResolver API could not bypass private DNS correctly
Bug: 130594022
Test: atest DnsResolverTest
Change-Id: Ibf3edac3075d921d189237c485871efb869b320b

Luke Huang   commited 2019-04-16 11:57:45 +08:00
4c349d2ed2
Revert "Revert "Block incoming non-VPN packets to apps under fully-routed VPN""
This reverts commit bc571c7cc8.

Reason for revert: Rolling forward, will fix tests in same CL stack.

Bug: 114231106
Bug: 130397860
Test: FrameworksNetTests
Change-Id: Ia8a0c99b4e1fd5dff26c881715cd876618ca4321

Lorenzo Colitti   commited 2019-04-12 19:52:32 +09:00
bad9d911b8
Merge "Revert "Block incoming non-VPN packets to apps under fully-routed VPN""
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2019-04-12 10:25:46 +00:00
27a60a1aff
Revert "Block incoming non-VPN packets to apps under fully-routed VPN"
This reverts commit 4773027064.
This change does not have any topic: not reverting the other 2 commits in the original topic.

Reason for revert: broke FrameworksNetTests presubmit: b/130397860

Change-Id: Iff41d9fe97fafea44680c8d67d1ce19277548cc0

Remi NGUYEN VAN   commited 2019-04-12 09:05:40 +00:00
bc571c7cc8
Merge "API council feedbacks for DnsResolver"
Luke Huang   authored and   Gerrit Code Review   commited 2019-04-12 00:45:18 +00:00
3436bc64ca
Merge "Block incoming non-VPN packets to apps under fully-routed VPN"
Rubin Xu   authored and   Gerrit Code Review   commited 2019-04-11 16:46:16 +00:00
fd20f8da0a
API council feedbacks for DnsResolver
To address the API review feedback provided by
the API council.

Bug: 129261432
Test: atest DnsResolverTest
Change-Id: I3de11c913682abf790850b45cd5d50ac28b3fc5c

Luke Huang   commited 2019-04-11 22:17:20 +08:00
81cec00c55
Merge "Add support for TAP interfaces in TestNetworkManager."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2019-04-11 11:45:40 +00:00
144e714d79
Merge changes I98573a5c,Ic7394f24
* changes:
  Enable checks for MANAGE_TEST_NETWORKS in TestNetworkService
  Cleanup of Test Network service

Benedict Wong   authored and   Gerrit Code Review   commited 2019-04-10 17:06:17 +00:00
0855a3c457
Block incoming non-VPN packets to apps under fully-routed VPN
When a fully-routed VPN is running, we want to prevent normal apps
under the VPN from receiving packets originating from any local non-VPN
interfaces. This is achieved by using eBPF to create a per-UID input
interface whitelist and populate the whitelist such that all
non-bypassable apps under a VPN can only receive packets from the VPN's
TUN interface (and loopback implicitly)

This is the framework part of the change that build the whitelist.
The whitelist needs to be updated in the following cases:
* When a VPN is connected and disconnected
    This will cover the change to allowBypass bit, since that can't be
    changed without reconnecting.
* When a VPN's NetworkCapabilites is changed (whitelist/blacklist app changes)
* When a new app is installed
* When an existing app is removed
* When a VPN becomes fully-routed or is no longer fully-routed

New user/profile creation will automatically result in a whitelist app change
transition so it doesn't need to be handled specially here.

Due to the limitation of the kernel IPSec interacting with eBPF (sk_buf->ifindex
does not point to the virtual tunnel interface for kernel IPSec), the whitelist
will only apply to app VPNs but not legacy VPN connections, to prevent breaking
connectivity with kernel IPSec entirely.

Test: atest PermissionMonitorTest
Test: atest android.net.RouteInfoTest
Test: atest com.android.server.ConnectivityServiceTest
Test: atest HostsideVpnTests
Bug: 114231106
Change-Id: I143b03d60e46cb1b04732b4a4034f5847b4d1b1a

Rubin Xu   commited 2019-04-10 17:05:54 +01:00
4773027064
Merge "Fix comment on StaticIpConfiguration#getDomains"
Treehugger Robot   authored and   Gerrit Code Review   commited 2019-04-10 06:30:55 +00:00
4aca98b5f5
Add support for TAP interfaces in TestNetworkManager.
Test: builds, boots
Change-Id: I88bfd7f37c0ba0228f8288fe92212618ce134e4f

Lorenzo Colitti   commited 2019-04-10 13:29:41 +09:00
93fac2892e
Cleanup of Test Network service
This follow-up change performs some cleanup changes without affecting
functionality

Bug: 72950854
Test: Compiles, CTS tests using this pass
Change-Id: Ic7394f24f11d713c9374b438182e29d2a02ea236

Benedict Wong   commited 2019-04-09 16:34:35 -07:00
8856354a8a
Restrict access to dangerous methods to <= P
Test: make
Fixes: 130143562
Change-Id: I1a6a472f83cf00a1ab174a9c5e67d3e9357a0c45

Chalard Jean   commited 2019-04-09 15:47:25 +09:00
a3b77516bc
Merge "Move attach*Filter() and addArpEntry() methods to NetworkStack"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2019-04-05 06:38:08 +00:00
82b74785d7
Merge "Some cleanups for Tethering"
Mark Chien   authored and   Gerrit Code Review   commited 2019-04-03 10:16:25 +00:00
7cf4907b89
Move attach*Filter() and addArpEntry() methods to NetworkStack
The SocketUtils.attach*Filter and SocketUtils.addArpEntry methods
were added there because they could not be added as JNI inside
the NetworkStack. This was not possible because on Go devices,
the NetworkStack was a jar library. But now, Go also uses an APK.
Hence, move these methods to the NetworkStack.

Change-Id: I1d88a0f0be23f2b15d5103fa092b9bf982329d7c
Fix: 129433183
Test: atest NetworkStackTests FrameworksNetTests

paulhu   commited 2019-04-03 17:49:36 +08:00
fd7c030082
Fix comment on StaticIpConfiguration#getDomains
Add consistency with setDomains().

Test: m
Change-Id: I9ff2de98cec2caf903310d7e8eb7b32362c0e151

Remi NGUYEN VAN   commited 2019-04-03 15:55:15 +09:00
9ed32081bf
Merge "Fix API in CaptivePortal, StaticIpConfiguration"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2019-04-03 06:51:35 +00:00
cf0f380f4e
Some cleanups for Tethering
Bug: 126481523
Test: -build, flash, boot
      -FrameworksNetTests

Change-Id: I904646efa87eb5434124c7828aca4ab09c5dc38e

markchien   commited 2019-04-03 13:56:00 +08:00
42e22097c3
Merge "Address leftover comments on 923337 and 930217."
Paul Hu   authored and   Gerrit Code Review   commited 2019-04-02 07:39:04 +00:00
a9b8e31cf8
Fix API in CaptivePortal, StaticIpConfiguration
- Add documentation to CaptivePortal#logEvent
 - Add paragraph breaks to StaticIpConfiguration class javadoc
 - Format javadoc for API documentation
 - Move setters to a builder and hide fields for apps targeting P or
   older
 - Document StaticIpConfiguration getters and builder setters
 - Add documentation for StaticIpConfiguration#getRoutes

Bug: 129362244
Bug: 129433304
Test: built, flashed, booted, WiFi working
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: Ia66c1097f01ca87d02eba3456547aedb1e480186

Remi NGUYEN VAN   commited 2019-04-02 10:43:04 +09:00
04c58fe907
Address leftover comments on 923337 and 930217.
- Restrict unprivileged apps to use
  NetworkRequest.Builder#setSignalStrength.

- Remove the "throws NullPointerException" in
  CaptivePortalProbeSpec constructor.

- Remove the null check in LinkProperties.

- Add annotataion into all ConnectivityManager.NetworkCallback
  methods.

Change-Id: Id275cac1d6a30d7515cd7b113394f5e8a0179314
Fix: 129097486
Test: atest FrameworksNetTests

paulhu   commited 2019-04-01 16:24:10 +08:00
1a40765101
Merge "Fix ApfCapabilities, LinkAddress, RouteInfo, IpPrefix API issues."
Paul Hu   authored and   Gerrit Code Review   commited 2019-04-01 07:20:53 +00:00
1f041d1443
Fix ApfCapabilities, LinkAddress, RouteInfo, IpPrefix API issues.
Fix: 129362082
Fix: 129361362
Fix: 129360330
Fix: 129362379
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: I05fbc6f98207d5cf002e3cbc5829040af7d6be52

paulhu   commited 2019-04-01 10:23:51 +08:00
895a741bf1
Minor change for async DNS API
do the minor changes to address comments before

Bug: 129395490
Test: atest DnsResolverTest
Change-Id: I56e2e5bc4352ff5c979579247a333a41950079da

Luke Huang   commited 2019-03-29 18:12:26 +08:00
293ffaa081
Unremove DnsResolver#query method used by external developers
This method was removed as part of addressing API council feedback in b/129261432
Add back previous DnsResolver#query which is already being used by developers.

Bug: 129395490
Test: atest DnsResolverTest

Change-Id: Ic956db204f3940d39d42e1b11dda39e57d356fad

Luke Huang   commited 2019-03-29 18:12:26 +08:00
fb5afabcb8
Fix cancellation race problem for aysnc DNS API
This problem might cause double-close fd and result in app crash
or unexpected behaviour

Bug: 129317069
Test: atest DnsResolverTest
      manual test with delaying response callback/cancel
Change-Id: I223234f527edafc51d34fa6be390419c05def8d8

Luke Huang   commited 2019-03-28 19:46:56 +08:00
e17bb2dff4
Block unpriviledged apps which create keepalives with null fd
Currently, socketKeepalive implementation is accepting null fd
due to backward compatibility with legacy packet keepalive API.
However, due to lack of the fd, the service cannot guarantee the
port is not reused by another app if the caller release the port
for any reason.

Thus, grant the null fd access only for priviledged apps.

This commit also address some comments from aosp/918533.

Bug: 126699232
Test: atest FrameworksNetTests
Change-Id: I0baf582ff4ca8af6082c3754e8dfbcd867f39792

junyulai   commited 2019-03-27 19:51:08 +08:00
828dad188c
Merge "Add nullability annotations"
Treehugger Robot   authored and   Gerrit Code Review   commited 2019-03-25 13:19:19 +00:00
539821c978
Merge "Fix SocketKeepalive APIs which do not meet API review requirement"
Junyu Lai   authored and   Gerrit Code Review   commited 2019-03-25 10:42:37 +00:00
66bc22760a
Fix SocketKeepalive APIs which do not meet API review requirement
Per API review, change the use of FileDescriptor to
ParcelFileDescriptor.
This change also fix nullability according to API review
feedbacks.

Fix: 126698610
Fix: 126699425
Fix: 126699232
Fix: 126700278

Test: 1. m -j
      2. atest FrameworksNetTests --generate-new-metrics 50
      3. m -j doc-comment-check-docs
Change-Id: I19476c50dd1ca290bf3f41973829da2bd229796a

junyulai   commited 2019-03-25 15:56:35 +08:00
7e06ad4ce9
Add nullability annotations
Add nullability annotations on the following methods:
 - StaticIpConfiguration#getRoutes
 - ValidationProbeEvent#getProbeName

Test: m
Bug: 128935825
Change-Id: I1c17d200f3125e684c4e4d67b2f7f079eda310b6

Remi NGUYEN VAN   commited 2019-03-25 16:46:34 +09:00
be381ab943
Merge "Separate NetworkMonitor/framework portal URL"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2019-03-25 02:50:37 +00:00
8ab472e77a
Merge "Fix API in CaptivePortal and ConnectivityManager"
Treehugger Robot   authored and   Gerrit Code Review   commited 2019-03-25 02:37:28 +00:00
8f4c739827
Fix API in CaptivePortal and ConnectivityManager
- Remove CaptivePortal constructor from SystemApi. This constructor was
   added in Q timeframe and ends up being unnecessary since
   CaptivePortal creation was refactored to ConnectivityService because
   of visibility issues on ICaptivePortal.
 - Rename getAvoidBadWifi to shouldAvoidBadWifi
 - Add permission annotation for shouldAvoidBadWifi

(already merged in internal as:
I09545c00af3519dbf141dd5951b28f49e37b3e80)

Test: flashed, WiFi and captive portal works
Bug: 128935314
Bug: 128935673
Merged-In: I09545c00af3519dbf141dd5951b28f49e37b3e80
Change-Id: I7395d4a4db6a64398a827692aee1956c011873e5

Remi NGUYEN VAN   commited 2019-03-25 01:43:48 +00:00
1fb7cabbfc
Separate NetworkMonitor/framework portal URL
The framework cannot return URLs used by the updatable NetworkStack,
which may use configurable URLs, changing URLs, or mechanisms not
involving URLs to detect captive portals. NetworkMonitor has already
been using random fallback URLs for a while that do not match the value
returned by ConnectivityManager#getCaptivePortalServerUrl.

With this change, the default value returned by the framework is
configured in framework resources as
config_networkDefaultCaptivePortalServerUrl. NetworkMonitor behavior may
change as it is an updatable component, but the current URL is
configured in NetworkMonitor resources as
config_captive_portal_http_url.

Test: flashed, booted, WiFi and captive portal working
Test: ConnectivityManager#getCaptivePortalServerUrl returns correct
      value.
Bug: 127908503
Change-Id: I371dedc5b22efa909d7fd58e1ebe9b8aaced9780

Remi NGUYEN VAN   commited 2019-03-22 15:11:14 +09:00
035f65367b
Merge "Support query cancellation for async DNS API"
Luke Huang   authored and   Gerrit Code Review   commited 2019-03-22 03:26:21 +00:00
6aea92f594
Merge "Fix Automated API Review issues."
Paul Hu   authored and   Gerrit Code Review   commited 2019-03-21 17:19:26 +00:00
acb5eca325
Fix Automated API Review issues.
These API's argument/return value must be marked either @NonNull
or @Nullable.

Bug: 126701148
Bug: 126699090
Bug: 126701058
Bug: 126700772
Bug: 126699941
Bug: 126701299
Bug: 126700007
Bug: 126700900
Test: atest FrameworksNetTests
Change-Id: Id030a9f1116178b96aa3d4614b10969a537b2fc4

paulhu   commited 2019-03-21 15:16:58 +08:00
3806853f94