Commit graph android_packages_modules_Co.../core/java/android
Message SHA1
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

Lorenzo Colitti   commited 2018-10-10 17:50:05 +09:00
0bfef02a24
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

Lorenzo Colitti   commited 2018-10-01 12:05:42 +09:00
2386291f56
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

Jeff Vander Stoep   authored and   Jeffrey Vander Stoep   commited 2018-09-21 06:16:09 +00:00
39a51e0191
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

Erik Kline   commited 2018-08-28 12:59:21 +09:00
767b7f2021
Merge "Fix typo in IpConfiguration comment"
Treehugger Robot   authored and   Gerrit Code Review   commited 2018-08-24 03:43:38 +00:00
43afefcd97
Fix typo in IpConfiguration comment
Bug: NONE
Test: NONE
Change-Id: Ib2ce166532292266da17ec85c16e400afe4f9111

Blake Lawson   commited 2018-08-23 08:43:07 -07:00
4253b45cbb
Add DhcpServingParams
Those parameters will be used to start DhcpServer or update its
configuration.

Test: runtest DhcpServingParamsTest.java
Bug: b/109584964
Change-Id: Id8d3dcf62d66dcb02accffa8d8500e30f07af452

Remi NGUYEN VAN   commited 2018-08-23 17:29:48 +09:00
aa3d9ac73b
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

Remi NGUYEN VAN   commited 2018-08-23 16:01:44 +09:00
029434e9ac
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

Mathew Inwood   commited 2018-08-14 14:44:29 +01:00
c5b9bec94e
Merge "NetworkAgent: Send primitive integer in explicitlySelected"
Treehugger Robot   authored and   Gerrit Code Review   commited 2018-08-13 17:09:51 +00:00
bc63072e52
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

Roshan Pius   commited 2018-08-10 07:44:33 -07:00
00ef96bc0e
Merge "NetworkAgent: Send primitive integer in score"
Roshan Pius   authored and   Gerrit Code Review   commited 2018-08-10 14:33:07 +00:00
45190f8e7f
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

Roshan Pius   commited 2018-08-09 07:10:27 -07:00
d594290fd9
Merge "Add utils to convert Inet4Address <-> int"
am: 2587292cd1

Change-Id: I347d23f4682eca623e3b10f72bc9000b1c5954a3

Remi NGUYEN VAN   authored and   android-build-merger   commited 2018-08-06 09:34:55 -07:00
c9f4d7be9e
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

Remi NGUYEN VAN   commited 2018-08-03 15:55:24 +09:00
6e2a93cf9a
Merge changes I6abd2221,I2c149d29,I45d22857,I1f879b2c,If4986a25, ...
am: 6c0106b57f

Change-Id: I86bc83e2bd859b48017f12832e9ff0080ec162b8

Chalard Jean   authored and   android-build-merger   commited 2018-06-12 06:57:33 -07:00
24749e0b40
Small cleanup of Network.
Test: runtest
Change-Id: I56dbd37bb8f890938d360f45835de72be4beb91a

Chalard Jean   commited 2018-06-12 19:03:14 +09:00
040a41f850
Cleanup of LinkProperties.
Test: runtest
Change-Id: I7299de93a79901635ce755a2d933666ee43767d5

Chalard Jean   commited 2018-06-12 19:03:07 +09:00
d51966a41b
Merge changes Ifd7d73ad,Id79096fa
am: abf2a3f652

Change-Id: I263f51ba2aafdf8e19e020b2a4f6ff1b8238fa3c

Chalard Jean   authored and   android-build-merger   commited 2018-06-11 06:12:34 -07:00
d5a1bfbef2
Bugfixes in LinkProperties#toString
We should stop trying to use a human brain to write code

Test: manual
Change-Id: Ifd7d73ad65de0f671466080beacbd97287e17bfe

Chalard Jean   commited 2018-06-11 18:48:37 +09:00
d3930f170a
Cleanup of ConnectivityManager.
This is not exhaustive, but still an undeniable improvement.

Test: runtest frameworks-net
Change-Id: Id79096faf20eec80de7c17b261ef338b895af1e0

Chalard Jean   commited 2018-06-11 18:48:37 +09:00
9dd116103e
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

Jeff Sharkey   authored and   Chalard Jean   commited 2018-06-06 08:25:36 +00:00
6ae4b88472
Fix setCapabilities.
P introduced setSSID, UIDs and unwanted capabilities.
None of these exhibit commutative behavior through combineCapabilities
because their semantics don't allow it. Therefore
NetworkRequest.setCapabilities() is badly broken around any of
these. Look at the comments in the new tests to realize the
extent of the damage.

Clean cherry-pick of ag/4083952

Bug: 79748782
Test: new tests written, old tests pass
Change-Id: Iafe074126132a82af37f4bf056c4a7b8d56bdc83
Merged-In: Ia5bebf8a233775367bbf1b788870528934ecbcfb
Merged-In: I13d7782a6c0c7b1f94137995bbb0d257a58d89c1

Chalard Jean   commited 2018-06-06 08:24:43 +00:00
52a6d547b7
Add a new ssid field in NetworkCapabilities.
Clean cherry-pick of ag/3887737

Bug: 77891227
Test: frameworks-net
Change-Id: Icefe1657bca52b913a72b56705342a7285769658
Merged-In: Ia1f4e51b7c2e9118789242cf6d9e7576c4167cda
Merged-In: I6dd1aba6fde5a502b4a9145cf16393d8ce623c89

Chalard Jean   commited 2018-06-06 08:23:52 +00:00
390bee5f2c
Remove unwanted capability from the java-doc
Per API council feedback remove unwanted capaibility from public API
java docs

Clean cherry-pick from ag/3868438

Bug: 77601789
Test: make docs
Test: build and flash
Change-Id: I4f3b8b558e8dab2bcc9ef4cc6cfc3135c264c291
Merged-In: I7fef43cce3cfe17dae6a5e4f564ad8857371502a
Merged-In: Ib02988daf44dabfaef7a0b788385b7f7c655b8b2

Pavel Maltsev   authored and   Chalard Jean   commited 2018-06-06 08:23:27 +00:00
4fc3638fa7
Actually @hide unwanted capability methods.
Cherry-pick of ag/3943779

Bug: 77601789
Test: builds, boots
Test: make doc-comment-check-docs
Merged-In: I80a88123b16c54734306da7e5dc0670972041648
Merged-In: I923e5377a1abe761217612452cbfdba752e53de2

Pavel Maltsev   authored and   Chalard Jean   commited 2018-06-06 08:23:13 +00:00
5b7ec405f4
API council requested tweaks to NetworkRequest.
If you put values into the Builder, you should be able to observe
those values on the built object.

Clean cherry-pick of ag/3813257

Test: atest android.net.cts.NetworkRequestTest
Bug: 74945408
Change-Id: Ib28de279efb8b33ab46aa64f580e10fe5f8720e3
Merged-In: I0d090ebb7d57689a061badcf593ae9a37d88f7ce
Merged-In: I539184f7385c1f288cfb77be8307e4463e07e9e6

Jeff Sharkey   authored and   Chalard Jean   commited 2018-06-06 08:23:00 +00:00
20329ac8bb
Add OEM_PAID capability to system api
Some system apps should be able to request OEM_PAID networks.  This
makes a lot of sense when Android is used as in-vehicle infotainment
systems.

Clean cherry-pick of ag/3782591

Bug: 68762530
Test: runtest -x frameworks/base/tests/net/ -c android.net.NetworkCapabilitiesTest
Change-Id: I306f060c5a386ff4b82cd99a03dc037ce60ded6a
Merged-In: Ic164c4a29cd449a31b2f1c12c8c345bcc5dc77fa
Merged-In: I6e9c4130db23a4f1c89ce7e9071ae519a2b0b7ec

Pavel Maltsev   authored and   Chalard Jean   commited 2018-06-06 08:22:51 +00:00
e023bc215d
Merge changes I3b3bcbbd,I18b3f263,I3c416c1a
* changes:
  Use CaptivePortalProbeSpec method in portal app
  Add configurable captive portal probes
  Move CaptivePortalProbeResult to its own file

Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2018-05-24 07:53:00 +00:00
3f6d2b08ad
Fixup SntpClient to bypass Private DNS
NTP may be necessary in order to validate Private DNS certificates,
so it should be allowed to bypass Private DNS.

Test: as follows
    - built, flashed, booted
    - tcpdump for port 53; adb shell am restart
      queries for the NTP hostname appear in the clear
    - runtest frameworks-net passes
Bug: 64133961
Bug: 80118648
Merged-In: I4655e3ce5691098c73bf070b8a9e4759485bb17a
Merged-In: I327b816a9f472e94328232157a3b8887d17b0baf
Change-Id: Id9ceb3fcaaffb48cbbd4cd381d48cae991572c9e
(cherry picked from commit e5e21fd4b5)

Erik Kline   commited 2018-05-24 13:58:58 +09:00
9cf1c8aca3
Add configurable captive portal probes
The probes allow testing for a configurable status code and location
header (regexes). They are disabled by default, so this CL is a
no-op unless the probe configurations are pushed.

Bug: b/79499239
Test: tests in CL pass, manual: captive portal login works
Merged-In: Iec7a74bbf2569a91e958c497200d77e8451cbf7b
Merged-In: Ia958815325d1466345e9626efc8f62fc9d08d774
(clean cherry-pick of pi-dev I785723aaed06054b9aa8ebff77803f23d7836db9)

Change-Id: I18b3f263fed08fa4fee20d5e88f3ec8647d7f835

Remi NGUYEN VAN   commited 2018-05-24 12:08:36 +09:00
03d866a6a6
Merge "Add configurable captive portal probes" into pi-dev
am: 8ab8d5c74e

Change-Id: Iec7a74bbf2569a91e958c497200d77e8451cbf7b

Remi NGUYEN VAN   authored and   android-build-merger   commited 2018-05-23 15:22:24 -07:00
b2d7efe619
Merge "Fixup SntpClient to bypass Private DNS" into pi-dev
am: de0d35a229

Change-Id: I4655e3ce5691098c73bf070b8a9e4759485bb17a

Erik Kline   authored and   android-build-merger   commited 2018-05-23 12:41:09 -07:00
e32feea342
Merge "Add configurable captive portal probes" into pi-dev
Remi NGUYEN VAN   authored and   Android (Google) Code Review   commited 2018-05-23 14:26:39 +00:00
8ab8d5c74e
Add configurable captive portal probes
The probes allow testing for a configurable status code and location
header (regexes). They are disabled by default, so this CL is a
no-op unless the probe configurations are pushed.

Bug: b/79499239
Test: tests in CL pass, manual: captive portal login works
Change-Id: I785723aaed06054b9aa8ebff77803f23d7836db9

Remi NGUYEN VAN   commited 2018-05-23 20:48:46 +09:00
c2491572d5
Fixup SntpClient to bypass Private DNS
NTP may be necessary in order to validate Private DNS certificates,
so it should be allowed to bypass Private DNS.

Test: as follows
    - built, flashed, booted
    - tcpdump for port 53; adb shell am restart
      queries for the NTP hostname appear in the clear
    - runtest frameworks-net passes
Bug: 64133961
Bug: 80118648
Change-Id: Id9ceb3fcaaffb48cbbd4cd381d48cae991572c9e

Erik Kline   commited 2018-05-23 16:03:03 +09:00
e5e21fd4b5
Merge "Fix setCapabilities." into pi-dev
am: cb42feb502

Change-Id: I13d7782a6c0c7b1f94137995bbb0d257a58d89c1

Chalard Jean   authored and   android-build-merger   commited 2018-05-22 01:01:39 -07:00
2e7a6c1b8f
Merge "Fix setCapabilities." into pi-dev
Chalard Jean   authored and   Android (Google) Code Review   commited 2018-05-22 07:51:09 +00:00
cb42feb502
Fix setCapabilities.
P introduced setSSID, UIDs and unwanted capabilities.
None of these exhibit commutative behavior through combineCapabilities
because their semantics don't allow it. Therefore
NetworkRequest.setCapabilities() is badly broken around any of
these. Look at the comments in the new tests to realize the
extent of the damage.

Bug: 79748782
Test: new tests written, old tests pass
Change-Id: Ie46581bdaf9ecc2f14aab44788bbdb27a3fec8c1

Chalard Jean   commited 2018-05-21 14:46:40 +09:00
e15627ef72
Merge "Add explicit override for default Private DNS mode" into pi-dev
am: 2b3c858296

Change-Id: If480ab40c7cf9ab75c52feafc28338a049cbceef

Erik Kline   authored and   android-build-merger   commited 2018-05-18 01:08:26 -07:00
0e5c8f2092
Add explicit override for default Private DNS mode
Test: as follows
    - built
    - flashed
    - booted
    - runtest frameworks-net passes
Bug: 79719289
Change-Id: I943c5476666e47d04690626e2133f501cb875b46

Erik Kline   commited 2018-05-17 17:41:12 +09:00
a7edf6ff56
Merge "Let tests enumerate all transports/capabilities." into pi-dev
am: 8e6445a1a5

Change-Id: Ie5cd22cfa2b6a60510fd1e31d7ebcd8f6cc890a0

Jeff Sharkey   authored and   android-build-merger   commited 2018-05-15 08:27:40 -07:00
eb25084c11
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.

Bug: 16207332
Test: atest com.android.cts.net.HostsideVpnTests
Change-Id: I35ca412512dc8515b44d5518e1ca4caa5bdc678f

Jeff Sharkey   commited 2018-05-14 17:17:33 -06:00
7b6ed22507
Add the list of private DNS addresses to LinkProperties
(clean cherry-pick from ag/3874803)

Test: atest android.net.LinkPropertiesTest, also new tests pass
Bug: 73641539
Change-Id: If33a35b1354a67db09411ff098f20064797296ad
Merged-In: I4b739c56e658690532ae9deb0b9a3bc9b2adf8b0
Merged-In: I6bdbef78d078d68534c8e07e9af031ce374560ef

Chalard Jean   commited 2018-04-27 13:32:10 +09:00
299d856143
Merge "Actually @hide unwanted capability methods." into pi-dev
am: 9d64b6e6b2

Change-Id: I80a88123b16c54734306da7e5dc0670972041648

Lorenzo Colitti   authored and   android-build-merger   commited 2018-04-24 14:43:06 -07:00
8e28cb01c4
Merge "Actually @hide unwanted capability methods." into pi-dev
Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2018-04-24 21:20:25 +00:00
9d64b6e6b2
Actually @hide unwanted capability methods.
Bug: 77601789
Test: builds, boots
Test: make doc-comment-check-docs
Change-Id: I7a913b83ab5110047d187564b3a1b0bbe1631942

Lorenzo Colitti   commited 2018-04-24 13:12:56 +09:00
88e7d8e3e5
Merge "Add the list of private DNS addresses to LinkProperties" into pi-dev
am: f12a2130a4

Change-Id: I4b739c56e658690532ae9deb0b9a3bc9b2adf8b0

Chalard Jean   authored and   android-build-merger   commited 2018-04-20 04:49:43 -07:00
2cc723e410
Add the list of private DNS addresses to LinkProperties
Test: atest android.net.LinkPropertiesTest, also new tests pass
Bug: 73641539
Change-Id: If33a35b1354a67db09411ff098f20064797296ad

Chalard Jean   commited 2018-04-20 16:48:43 +09:00
3e0a46a439
Merge "Add a new ssid field in NetworkCapabilities." into pi-dev
am: f920300665

Change-Id: Ia1f4e51b7c2e9118789242cf6d9e7576c4167cda

Chalard Jean   authored and   android-build-merger   commited 2018-04-13 02:14:02 -07:00
33ada883b8