Commit Graph

2427 Commits

Author SHA1 Message Date
Chalard Jean
426e1cca1a Merge "To support skip464xlat per Network" am: 698b80818c
am: e826aa52e4

Change-Id: I944738258051525b371bd17dd3ee7b411b82d12b
2018-10-24 17:19:51 -07:00
Nathan Harold
b265835d23 Merge "Move some members to the "Q blacklist"." am: 26f91069c1
am: 13c9e7e2f3

Change-Id: Ia2419cce28d26d9464da2a5172cb332b629e943e
2018-10-24 16:14:06 -07:00
Luke Huang
477db5fe1a Refactor UidRange by using stable aidl structure
Use stable aidl generated structure instead of UidRange

Test: runtest frameworks-net passes
Test: manual testing of UidRange related function works
Change-Id: Iaf1c10777dc1e71df2be2a57533a10257b12626b
2018-10-24 19:45:09 +09:00
Chalard Jean
698b80818c Merge "To support skip464xlat per Network" 2018-10-24 07:15:20 +00:00
Mathew Inwood
0e71d36c58 Move some members to the "Q blacklist".
Based on some analysis, these fields/methods are likely false positives.
Set maxTargetSdk=P so that any apps using them are required to migrate off
them in future. See the bug for more details.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Merged-In: I719b5c94e5b1f4fa562dd5d655953422958ad37e
Change-Id: I719b5c94e5b1f4fa562dd5d655953422958ad37e
(cherry picked from commit 2622bdf569)
2018-10-22 17:28:24 -07:00
Junyu Lai
304c26b590 Merge "Add new callback to inform blocking of network on specific uid." am: f41deeb4a9 am: 118cf0e236
am: b4e045b1b8

Change-Id: I2bec503c5ffac156b679a48c09591458ab716789
2018-10-19 09:47:40 -07:00
Junyu Lai
b4e045b1b8 Merge "Add new callback to inform blocking of network on specific uid." am: f41deeb4a9
am: 118cf0e236

Change-Id: I24b45f860992626968a6adfb0ff6b6389c85cf45
2018-10-19 09:26:39 -07:00
Junyu Lai
f41deeb4a9 Merge "Add new callback to inform blocking of network on specific uid." 2018-10-19 15:20:48 +00:00
Eran Messeri
7a906817f5 Merge "Enterprise Policy for Private DNS Setting" 2018-10-17 16:59:57 +00:00
Lorenzo Colitti
d96f450cb2 Merge "Change permissions checks for setAirplaneMode." am: 38149e3ea7 am: 65b71e6a20
am: 5fe041f889

Change-Id: Icfc55aefa11a5e1dd92382c2be94c7b63889aa8f
2018-10-15 08:49:52 -07:00
Lorenzo Colitti
5fe041f889 Merge "Change permissions checks for setAirplaneMode." am: 38149e3ea7
am: 65b71e6a20

Change-Id: Ibe5bbd51adae83e1bfb5a4ab43d29eb2ccd02a8b
2018-10-15 08:29:00 -07:00
Lorenzo Colitti
38149e3ea7 Merge "Change permissions checks for setAirplaneMode." 2018-10-15 13:36:45 +00:00
Eran Messeri
120511dbeb Enterprise Policy for Private DNS Setting
A new API for setting the Private DNS settings value programatically via
the DevicePolicyManager.

Since there are two separate settings for Private DNS, and the value
provided for the hostname needs to be validated, a new
DevicePolicyManager API is introduced.

Only a Device Policy Client in Device Owner mode may change these
settings.
The DPC may additionally set a user restriction (added in a separate CL)
to prevent the user from changing Private DNS settings.

Bug: 112982691
Test: atest com.android.cts.devicepolicy.DeviceOwnerTest#testPrivateDnsPolicy
Change-Id: I566437e4fe10e1346858149120c50b3c20ca073f
2018-10-15 11:53:22 +01:00
Lorenzo Colitti
c7da00d199 Change permissions checks for setAirplaneMode.
Require NETWORK_SETTINGS (or NETWORK_SETUP_WIZARD) instead of the
legacy CONNECTIVITY_INTERNAL permission. The users are as follows:

- The system callers (Phone, Settings, SystemUI, VrSettings) all
  have NETWORK_SETTINGS.
- SetupWizard has NETWORK_SETUP_WIZARD
- sl4a has NETWORK_STACK

Bug: 115302596
Test: builds, boots, airplane mode via SystemUI works
Change-Id: I8ca40182bd8b5e3fd9a82296c0cc28de30ed4baf
2018-10-12 16:35:46 +09:00
Yuuki Habu
addf827426 To support skip464xlat per Network
To add skip464exlat in NetworkMisc.
NetworkAgent can skip to start 464xlat if need.
(e.g. IMS PDN for Cellular can be disabled)

Device will treat the network as IPv6-only if it is set

Bug: 69949375
Test: Nat464XlatTest, ConnectivityServiceTest

Change-Id: I676a02cb92530d64f29f34e89482a934f3ec4553
2018-10-12 14:35:30 +09:00
Chalard Jean
972b3542f2 Merge "Add log for debugging ConnectivityManager" am: 12f8847e40 am: 7a6ad8e2a9
am: a13fd2333b

Change-Id: I23a34c21d05db126d8d2aacdeb700b3d2b2ed018
2018-10-11 21:29:52 -07:00
Chalard Jean
a13fd2333b Merge "Add log for debugging ConnectivityManager" am: 12f8847e40
am: 7a6ad8e2a9

Change-Id: I2d8604c172b26e474050afd45fba74dc6c2c18bc
2018-10-11 21:21:45 -07:00
Chalard Jean
12f8847e40 Merge "Add log for debugging ConnectivityManager" 2018-10-12 03:14:48 +00:00
junyulai
f2c67e4521 Add new callback to inform blocking of network on specific uid.
Currently, apps rely on querying NetworkInfo object to know
whether their network is blocked or not. There is no proactive
way to tell app when it is being blocked/unblocked. The only
event that app would receive is SocketException with
ECONNABORTED when their ongoing socket connection has been
blocked, which is not an elegant way to notify app.

Thus, this commit is trying to address this problem. Therefore,
with the uses of other callbacks, the need of
getState/getDetailedState in NetworkInfo could be completely
eliminated.

Test: runtest frameworks-net
      runtest -x NetworkPolicyManagerServiceTest.java
      cts-tradefed run cts -m CtsHostsideNetworkTests
      cts-tradefed run cts -m CtsNetTestCases -t \
              android.net.cts.ConnectivityManagerTest
Bug: 74575553

Change-Id: Iec96a3103d0aa9a505020eb89d69b89c0b694486
2018-10-11 16:31:10 +08:00
Lorenzo Colitti
5ea1a81e4b Merge "Make setAirplaneMode @SystemApi for SetupWizard." am: 772b75c26d am: c37dffde10
am: ff944740c3

Change-Id: I994f0ff3ad9a3833eb56da7614e3632452d5c476
2018-10-10 23:32:45 -07:00
Lorenzo Colitti
ff944740c3 Merge "Make setAirplaneMode @SystemApi for SetupWizard." am: 772b75c26d
am: c37dffde10

Change-Id: I8049e2484526104eba7fad92d2819eb94319fa84
2018-10-10 20:26:35 -07:00
Lorenzo Colitti
0bfef02a24 Make setAirplaneMode @SystemApi for SetupWizard.
Expose ConnectivityManager#setAirplaneMode and the
NETWORK_SETUP_WIZARD permission so that SetupWizard can call
setAirplaneMode.

Delete setAirplaneMode from the greylist because the permissions
checks on it, since at least 2013, have been for a privileged
permission (CONNECTIVITY_INTERNAL) that normal apps don't have.

Test: m
Bug: 115302596
Change-Id: I28f24d32c4b4b386407e9e0e3514ea9f8854f4a8
2018-10-10 17:50:05 +09:00
Soi, Yoshinari
b8102ef4d7 Add log for debugging ConnectivityManager
Add log to ConnectivityManager for better investigations of issue.
This patch adds StackTrace to the following APIs.

reportInetCondition()
reportBadNetwork()
reportNetworkConnectivity()
sendRequestForNetwork()
requestNetwork()
releaseNetworkRequest()
registerNetworkCallback()
unregisterNetworkCallback()

Bug: 116751720
Change-Id: I992292cd9d6f3d69c91ddbde5577591f9ec0f39b
2018-10-10 11:56:04 +09:00
Andrew Solovay
1ea270c94d resolve merge conflicts of a3e34fe9fe4e2a8d0932e574721e5a8b94396c5e to pi-dev-plus-aosp
Bug: None
Test: Eyeballed (comment-only change).
Change-Id: Ia644cde66376b2bddeb27bb2a147b3266037aa2c
Exempt-From-Owner-Approval: Docs-only change
Merged-In: Ia06e1fffd814671289a1caebd5962aedc18a28d7
2018-10-04 22:50:39 +00:00
Andrew Solovay
be99bca44d docs: Replacing {#link with {@link
Several java files had the typo {#link (for cross-references to other
Javadocs) instead of the proper {@link format. This was confusing the
new doc publish tool (Mivi) since that's the format used for {# Django
comments #}.

Fixed a couple of links that had other errors (which prevented building
once the {# -> {@ was done) and other typos.

Replaced throughout the frameworks/base project; I'll need a separate CL
for the AndroidX fixes.

Staged to:

go/dac-stage/reference/android/app/Instrumentation.html
go/dac-stage/reference/android/bluetooth/BluetoothAdapter.html
go/dac-stage/reference/android/bluetooth/BluetoothDevice.html
go/dac-stage/reference/android/bluetooth/BluetoothServerSocket.html
go/dac-stage/reference/android/inputmethodservice/InputMethodService.html
go/dac-stage/reference/android/view/KeyCharacterMap.html
go/dac-stage/reference/android/view/KeyEvent.html
go/dac-stage/reference/android/media/AudioManager.html
go/dac-stage/reference/android/net/wifi/WifiConfiguration.html

(Other files were not in the public Javadocs.)

Bug: 111925950
Test: make ds-docs
Exempt-From-Owner-Approval: Docs-only change
Change-Id: Ia06e1fffd814671289a1caebd5962aedc18a28d7
Merged-In: Ia06e1fffd814671289a1caebd5962aedc18a28d7
2018-10-04 18:20:51 +00:00
Andrew Solovay
f0254b7326 cherry-pick from pi-dev docs: Replacing {#link with {@link
Several java files had the typo {#link (for cross-references to other
Javadocs) instead of the proper {@link format. This was confusing the
new doc publish tool (Mivi) since that's the format used for {# Django
comments #}.

Fixed a couple of links that had other errors (which prevented building
once the {# -> {@ was done) and other typos.

Replaced throughout the frameworks/base project; I'll need a separate CL
for the AndroidX fixes.

(Other files were not in the public Javadocs.)

Bug: 111925950
Test: make ds-docs
Change-Id: Ia06e1fffd814671289a1caebd5962aedc18a28d7
Original Change-Id: Ia06e1fffd814671289a1caebd5962aedc18a28d7
Exempt-From-Owner-Approval: Docs-only change
2018-10-04 18:17:05 +00:00
Lorenzo Colitti
18880cc569 Merge "Make requestRouteToHost a no-op for system callers." am: 6b6feb8ff8 am: 2fc0c62d6a
am: 3b2cdecbca

Change-Id: I2999208487c2c15d7e158e690cf7a2ac4e7c3e6d
2018-09-30 23:47:25 -07:00
Lorenzo Colitti
2386291f56 Make requestRouteToHost a no-op for system callers.
Everything in the system should now be using proper multinetwork
APIs instead of this insecure and error-prone API.

Make this method do nothing when called by the system. For now,
keep the code around for backwards compatibility for apps
targeting Android releases before M.

Bug: 25824776
Bug: 25876485
Test: FrameworksNetTests pass
Test: CtsNetTestCasesLegacyApi22 pass
Test: CtsNetTestCasesLegacyPermission22 pass
Test: android.net.cts.ConnectivityManagerTest passes
Change-Id: I9b3557faccccc95c7b954db6a13b853b4c7edea0
2018-10-01 12:05:42 +09:00
Jeffrey Vander Stoep
9d2725c515 Merge "Add ConnectivityManager.getConnectionOwnerUid()" am: f8529dc891 am: 937c009070
am: c5dd800f8c

Change-Id: I8b8f6e74abc47f94231f3b9a1ab0db1ad0903a10
2018-09-21 15:36:28 -07:00
Jeff Vander Stoep
39a51e0191 Add ConnectivityManager.getConnectionOwnerUid()
Allow VPN apps to lookup the UID owner of a network connection.

Requires specifying the:
 - IP address and port for both the source and destination of a TCP
   connection.
 - IP address and port for either source and destination or just
   source for a UDP connection.
Only TCP and UDP protocols are supported. Only connections for UIDs
that apply to the calling VPN app will be resolved. This is intended
to replace direct app access to /proc/net/{tcp,tcp6,udp,udp6}.

The implementation uses netlink inet_diag sockets[1] to perform
the lookup on TCP sockets as well as UDP sockets when supported
(kernel has CONFIG_INET_UDP_DIAG=y).

[1] http://man7.org/linux/man-pages/man7/sock_diag.7.html

Bug: 9496886
Bug: 109758967
Test: atest HostsideVpnTests
Test: atest InetDiagSocketTest on Taimen with CONFIG_INET_UDP_DIAG
    and on Sailfish without CONFIG_INET_UDP_DIAG.
Change-Id: I2bbc7072dd091e2e653dadf6dc05024c04180f34
2018-09-21 06:16:09 +00:00
Mathew Inwood
2622bdf569 Move some members to the "Q blacklist".
Based on some analysis, these fields/methods are likely false positives.
Set maxTargetSdk=P so that any apps using them are required to migrate off
them in future. See the bug for more details.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Change-Id: I719b5c94e5b1f4fa562dd5d655953422958ad37e
2018-09-14 13:18:34 +01:00
Erik Kline
767b7f2021 Remove ResolveUtil from frameworks/base callers
Use the Private DNS bypass logic that was moved into Network.

Once all callers of ResolvUtil are updated to use this interface
ResolvUtil can be deleted.

Test: as follows
    - built, flashed, booted
    - runtest frameworks-net passes
    - connection to captive portal network detects portal correctly
      and the login activity functions as expected

Bug: 64133961
Bug: 72345192
Bug: 73872000
Bug: 78548486

Change-Id: If11ef2b5ffdc729f8449cf18dccd5f1eccbc51e6
2018-08-28 12:59:21 +09:00
Treehugger Robot
43afefcd97 Merge "Fix typo in IpConfiguration comment" 2018-08-24 03:43:38 +00:00
Blake Lawson
4253b45cbb Fix typo in IpConfiguration comment
Bug: NONE
Test: NONE
Change-Id: Ib2ce166532292266da17ec85c16e400afe4f9111
2018-08-23 08:43:07 -07:00
Remi NGUYEN VAN
aa3d9ac73b Add DhcpServingParams
Those parameters will be used to start DhcpServer or update its
configuration.

Test: runtest DhcpServingParamsTest.java
Bug: b/109584964
Change-Id: Id8d3dcf62d66dcb02accffa8d8500e30f07af452
2018-08-23 17:29:48 +09:00
Remi NGUYEN VAN
029434e9ac Add util to add an ARP table entry
This is to be used by the new DhcpServer to add ARP entries with new
addresses before sending unicast responses.

Test: manual: cat /proc/net/arp with implementation based on this
Bug: b/109584964
Change-Id: I3559893583aa3c49b188ad689a41ee2f3e9d9bf3
2018-08-23 16:01:44 +09:00
Mathew Inwood
c5b9bec94e Add @UnsupportedAppUsage annotations
For packages:
  android.net.wimax
  android.net.wifi.p2p.nsd
  android.net.wifi.p2p
  android.net.wifi.hotspot2.pps
  android.net.wifi.hotspot2.omadm
  android.net.wifi.hotspot2
  android.net.wifi.aware
  android.net.wifi
  android.net.util
  android.net.sip
  android.net.rtp
  android.net.nsd
  android.net.metrics
  android.net.lowpan
  android.net.http
  android.net.captiveportal
  android.net

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: Ie25423113ee1a8071cd5039382c00de6ce0af7fd
Merged-In: I520be7a4c79e68310c12e4f55bf66acaa94145a1
2018-08-14 14:44:29 +01:00
Treehugger Robot
bc63072e52 Merge "NetworkAgent: Send primitive integer in explicitlySelected" 2018-08-13 17:09:51 +00:00
Roshan Pius
00ef96bc0e NetworkAgent: Send primitive integer in explicitlySelected
|Boolean| object is not parcelable and hences crashes when the binder call
crosses a process boundary. Using a primitive integer instead to
represent the boolean value.

Bug: 112358948
Test: Device boots up and able to make wifi connection.
Change-Id: Iac69fd302e1f1338ed0da1446105ffc5855451cc
2018-08-10 07:44:33 -07:00
Roshan Pius
45190f8e7f Merge "NetworkAgent: Send primitive integer in score" 2018-08-10 14:33:07 +00:00
Roshan Pius
d594290fd9 NetworkAgent: Send primitive integer in score
|Integer| is not parcelable and hences crashes when the binder call
crosses a process boundary. Using a primitive integer should suffice
for sending the value to the server. There are no other usage of
|EVENT_NETWORK_SCORE_CHANGED| in the codebase.

Bug: 112358948
Test: Device boots up and able to make wifi connection.
Change-Id: I4c8fc17f4b803f69a4d882c71a8ce014a194d1ba
2018-08-09 07:10:27 -07:00
Remi NGUYEN VAN
c9f4d7be9e Merge "Add utils to convert Inet4Address <-> int"
am: 2587292cd1

Change-Id: I347d23f4682eca623e3b10f72bc9000b1c5954a3
2018-08-06 09:34:55 -07:00
Remi NGUYEN VAN
6e2a93cf9a Add utils to convert Inet4Address <-> int
The current utilities map the higher-order bytes of ints to the
lower-order bytes of IPv4 addresses, which makes applying masks and
generating series of addresses confusing.

For example, the current utilities would convert 1.2.3.4 to 0x04030201,
or generate 0x0080ffff for a /17 subnet mask. The utilities in this CL
convert 1.2.3.4 to 0x01020304, and a /17 subnet mask is represented as
0xffff8000.

Includes tests for all the above methods and migration of
NetworkUtilsTest to JUnit4.

Test: added tests pass
Change-Id: I5f5aa2e6e3b054b66b9dc507dab64f41be9139b1
2018-08-03 15:55:24 +09:00
Chalard Jean
24749e0b40 Merge changes I6abd2221,I2c149d29,I45d22857,I1f879b2c,If4986a25, ...
am: 6c0106b57f

Change-Id: I86bc83e2bd859b48017f12832e9ff0080ec162b8
2018-06-12 06:57:33 -07:00
Chalard Jean
040a41f850 Small cleanup of Network.
Test: runtest
Change-Id: I56dbd37bb8f890938d360f45835de72be4beb91a
2018-06-12 19:03:14 +09:00
Chalard Jean
d51966a41b Cleanup of LinkProperties.
Test: runtest
Change-Id: I7299de93a79901635ce755a2d933666ee43767d5
2018-06-12 19:03:07 +09:00
Chalard Jean
d5a1bfbef2 Merge changes Ifd7d73ad,Id79096fa
am: abf2a3f652

Change-Id: I263f51ba2aafdf8e19e020b2a4f6ff1b8238fa3c
2018-06-11 06:12:34 -07:00
Chalard Jean
d3930f170a Bugfixes in LinkProperties#toString
We should stop trying to use a human brain to write code

Test: manual
Change-Id: Ifd7d73ad65de0f671466080beacbd97287e17bfe
2018-06-11 18:48:37 +09:00
Chalard Jean
9dd116103e Cleanup of ConnectivityManager.
This is not exhaustive, but still an undeniable improvement.

Test: runtest frameworks-net
Change-Id: Id79096faf20eec80de7c17b261ef338b895af1e0
2018-06-11 18:48:37 +09:00
Jeff Sharkey
6ae4b88472 Let tests enumerate all transports/capabilities.
This gives them a way to collect all included values without
resorting to manual probing of each newly added value.

Cherry-pick of ag/4052941 with minor conflicts in the imports.

Bug: 16207332
Test: atest com.android.cts.net.HostsideVpnTests
Change-Id: Ia764b3412bf834890612378e0c3846913f4e0a06
Merged-In: Ie5cd22cfa2b6a60510fd1e31d7ebcd8f6cc890a0
Merged-In: If07e77c92046807235229a4f67ee087bdd7bccf1
2018-06-06 08:25:36 +00:00