Commit Graph

5464 Commits

Author SHA1 Message Date
Treehugger Robot
782db99fa1 Merge "[PT11] Move handleDeprecatedGlobalHttpProxy to ProxyTracker" 2018-10-11 12:50:17 +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
ff944740c3 Merge "Make setAirplaneMode @SystemApi for SetupWizard." am: 772b75c26d
am: c37dffde10

Change-Id: I8049e2484526104eba7fad92d2819eb94319fa84
2018-10-10 20:26:35 -07:00
Lorenzo Colitti
c37dffde10 Merge "Make setAirplaneMode @SystemApi for SetupWizard."
am: 772b75c26d

Change-Id: Ib418ca0a9f8d9be9c4bdc419c9d2ed05aa47a49d
2018-10-10 20:14:03 -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
Luke Huang
b913c8165e Network-related commands porting
Test: runtest frameworks-net passes
Test: manual testing of network related function works
Change-Id: Id197d20c80b04378731b113ad74676672bd8b67e
2018-10-09 11:29:02 +08:00
Yan Yan
51d3eded50 Merge changes I10c01f2b,Ie05bc535 am: 90a0bdb98a
am: e09f9d1a93

Change-Id: I5501ba7eb04493b5de84feaeadb53b57de89e8d2
2018-10-05 12:13:20 -07:00
Igor Murashkin
10cd239a14 Merge changes into stage-aosp-master
am: b8480d5bda

Change-Id: I2aac3fb3b6fa638e9c0cc871a02216ed498df98d
2018-10-05 11:57:18 -07:00
Igor Murashkin
e0065199ea Merge changes into stage-aosp-master
am: 8b2dc0adc6

Change-Id: I63acb13055109fc08fbe77d4dd6ebd68daeaabcd
2018-10-05 11:50:43 -07:00
Yan Yan
e09f9d1a93 Merge changes I10c01f2b,Ie05bc535
am: 90a0bdb98a

Change-Id: I2e55a266f65268ca734c028d4da7add14a281d75
2018-10-05 11:47:12 -07:00
Yan Yan
90a0bdb98a Merge changes I10c01f2b,Ie05bc535
* changes:
  Check to ensure UDP-encap is used only for IPv4
  Add UDP encapsulation tests for IpSecService.
2018-10-05 17:38:41 +00:00
Android Build Merger (Role)
b8480d5bda Merge changes into stage-aosp-master 2018-10-05 17:35:26 +00:00
Android Build Merger (Role)
8b2dc0adc6 Merge changes into stage-aosp-master 2018-10-05 17:35:26 +00:00
Chalard Jean
b3ba9ff8ab Merge "[PT10] Move loadGlobalProxy into ProxyTracker." am: 79822ffb6f
am: fa17d29fa9

Change-Id: I4220b1964040affa39d8d748095a161b2512eccf
2018-10-05 02:33:45 -07:00
Chalard Jean
fa17d29fa9 Merge "[PT10] Move loadGlobalProxy into ProxyTracker."
am: 79822ffb6f

Change-Id: If5d2eb35f1c990fc6af5747fb2f8e3d55afb7eb9
2018-10-05 02:22:44 -07:00
Chalard Jean
f9d8e07ea0 [PT13] Simple cleanup of ProxyTracker.
ProxyInfo#getPacFileUrl() is guaranteed to return non-null.

Test: runtest
Change-Id: Id206829441f01c6ed4066028de3e1f7fcbe8930b
2018-10-05 16:40:06 +09:00
Chalard Jean
bf650912c6 [PT12] Factor some code into ProxyTracker.
Test: runtest
Change-Id: Ic61ef1e735dcc988cf8fc698b853f3b3be331d8b
2018-10-05 16:40:02 +09:00
Chalard Jean
0933537df9 [PT11] Move handleDeprecatedGlobalHttpProxy to ProxyTracker
This contains a significant logic change : it will load the
deprecated proxy settings synchronously instead of on the next
run loop. I think this is okay because it would happen almost
immediately anyway, and there is nothing in ConnectivityService
that might be changing this setting in the mean time. As for
the possibility that this was executed in the handler because
of possible disk access, I want to point out that the
loadGlobalProxy method that now calls this was already doing
those same similar accesses.

Test: runtest
Change-Id: Idc6f260e2a337689dc274eb758eb00f6a31089bb
2018-10-05 16:39:53 +09:00
Chalard Jean
e4f9bd95ec [PT10] Move loadGlobalProxy into ProxyTracker.
Test: runtest
Change-Id: Id1c57ebb575c8742310be4822ec6e3fa03f487c3
2018-10-05 16:37:38 +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
evitayan
e54eee0130 Check to ensure UDP-encap is used only for IPv4
This commit checks if UDP-encapsulation is used
for unsupported address family and throws
IllegalArgumentException when it happens.

Bug: 74213459
Test: Tests added in testCreateTransportModeTransformWithEncap
      and testCreateTunnelModeTransformWithEncap.
      Command: runtest frameworks-net
      Verified on taimen.
Change-Id: I10c01f2bad6aca23430849ea9ef6c1eb157ae131
2018-10-04 11:44:00 -07: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
evitayan
1ab508d361 Add UDP encapsulation tests for IpSecService.
This commit adds tests to ensure that IpSecService properly
handles UDP-encapsulation transforms correctly.

Bug: 76110065
Test: Added: testCreateTransportModeTransformWithEncap,
             testCreateTunnelModeTransformWithEncap.
      Command: runtest frameworks-net
      Verified on taimen.
Change-Id: Ie05bc5354266806c2d03b0b3d73a4696a89eccf2
2018-10-04 10:37:47 -07:00
Leif Hendrik Wilden
29238b30fd Merge "Allow wifi and ethenet connected at same time." am: 75e74f759d
am: 5b63ccb84f

Change-Id: I2b180336f74697ff5467c210eabccb4813ce317f
2018-10-02 11:06:14 -07:00
Leif Hendrik Wilden
5b63ccb84f Merge "Allow wifi and ethenet connected at same time."
am: 75e74f759d

Change-Id: I7c1d6fdcb7c7ed26e765f52373e20d19b6db7bfc
2018-10-02 10:57:11 -07:00
Treehugger Robot
75e74f759d Merge "Allow wifi and ethenet connected at same time." 2018-10-02 17:09:16 +00:00
Leif Hendrik Wilden
838c66128f Allow wifi and ethenet connected at same time.
This will improve the user experience on Android TV devices,
see bug for details.

In addition when connecting adb to the device by ethernet
for cts, wifi will not connect, causing lots of tests to fail.
For example:
[CTS7.1]android.net.wifi.cts.WifiInfoTest#testWifiInfoProperties
[CTS7.1]android.net.cts.ConnectivityManagerTest#testConnectivityChanged_
manifestRequestOnlyPreN_shouldReceiveIntent

Use command:settings to put global wifi_data_always_on 1 to enable it.

Bug: 26102779
Test: Manual, CTS.
Change-Id: I711d93061a6bc7164d98a858912f781e1b967406
2018-10-01 09:12:10 -07:00
Luke Huang
80f05e8cfc Merge "ConnectivityService get INetd directly." am: ddc1add0ac
am: 47820e87d4

Change-Id: Ia6c32320eea3117f7a79a6360b7819c64a88faa5
2018-10-01 02:29:32 -07:00
Lorenzo Colitti
b6113e8621 Merge "Remove spurious WTF in rematching networks." am: 4e6c1d8643
am: 421fcc6ec2

Change-Id: Ia1f7426a2f75ed6e6264a932255f77e707968165
2018-10-01 02:23:37 -07:00
Luke Huang
47820e87d4 Merge "ConnectivityService get INetd directly."
am: ddc1add0ac

Change-Id: I0efe022f74f3bcfe8b97853ef0d8c0d27a2d6b01
2018-10-01 01:23:23 -07:00
Lorenzo Colitti
421fcc6ec2 Merge "Remove spurious WTF in rematching networks."
am: 4e6c1d8643

Change-Id: If2dc54d1486fe51a1800c140fd83811492e4134b
2018-10-01 01:19:02 -07:00
Luke Huang
ddc1add0ac Merge "ConnectivityService get INetd directly." 2018-10-01 07:28:42 +00:00
Treehugger Robot
4e6c1d8643 Merge "Remove spurious WTF in rematching networks." 2018-10-01 06:33:29 +00:00
Lorenzo Colitti
3b2cdecbca Merge "Make requestRouteToHost a no-op for system callers." am: 6b6feb8ff8
am: 2fc0c62d6a

Change-Id: Iefddec95271b56007794fa10f7f3a4122c68877e
2018-09-30 23:15:42 -07:00
Lorenzo Colitti
2fc0c62d6a Merge "Make requestRouteToHost a no-op for system callers."
am: 6b6feb8ff8

Change-Id: I37ba2ef7ee7d052ec47c2d314f165315a13b06ac
2018-09-30 23:00:08 -07:00
Treehugger Robot
6b6feb8ff8 Merge "Make requestRouteToHost a no-op for system callers." 2018-10-01 05:36:28 +00:00
Lorenzo Colitti
d47c367905 Remove spurious WTF in rematching networks.
By construction, this WTF should never happen, since it's in an
if (nri.request.isRequest()) and by definition requests can only
be satisfied by one network at a time.

I don't think we've ever seen this particular WTF in an APR
report, which suggests that it's not happening in practice.

Test: atest FrameworksNetTests CtsNetTestCasesLegacyApi22 CtsNetTestCasesLegacyPermission22 android.net.cts.ConnectivityManagerTest
Change-Id: Icf4c7d2bb1da3c7db695cf0bcebc5806190a1677
2018-10-01 13:28:21 +09:00
Luke Huang
0687ae437f Merge "Rename object mNetd to mNetworkManagementService" am: b28fee1994
am: cb9a018048

Change-Id: I1fcfcfb8828bf9b6206ddadede25d5e27b3c2908
2018-09-30 20:28:15 -07:00
Luke Huang
cb9a018048 Merge "Rename object mNetd to mNetworkManagementService"
am: b28fee1994

Change-Id: I658ba32a2396c393f3126b713d94ba809338d5e4
2018-09-30 20:16:41 -07:00
Luke Huang
46289a2489 ConnectivityService get INetd directly.
This is the first step for ConnectivityService
call into INetd directly.
Import INetd and get it by using NetdService.

Test: runtest frameworks-net passes
Test: manual testing of wakeupAdd/DelInterface works
Change-Id: I643dba5206c66958134152d062f3f3a19a34cf2c
2018-10-01 11:10:54 +08:00
Chiachang Wang
1fa4538303 Merge "Fix idle timer rule leakage" am: c8019ecef2
am: 9bf2ab814b

Change-Id: I51ab9c7e58853ab93b09f1ca9e0c461134157c7d
2018-09-30 20:10:04 -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
Luke Huang
b28fee1994 Merge "Rename object mNetd to mNetworkManagementService" 2018-10-01 03:01:33 +00:00
Chiachang Wang
9bf2ab814b Merge "Fix idle timer rule leakage"
am: c8019ecef2

Change-Id: I5ac912d121d094b36d46ccca385d5cf319fcb945
2018-09-30 19:57:18 -07:00
Chiachang Wang
c8019ecef2 Merge "Fix idle timer rule leakage" 2018-10-01 02:20:23 +00:00
Chiachang Wang
087fd275f9 Fix idle timer rule leakage
Idle timer rule is not cleared as expected if there is a
default network replacement.

Bug:37080406
Test: 1.run frameworks-net
      2.check iptables rule with default network replacement

Change-Id: I6bd29d79e4ca3e8de4b867c4fcb5f81d02ba6de4
2018-09-28 22:42:48 +08:00
Remi NGUYEN VAN
7233437b07 Merge "Call clearSettingsProvider before and after test" am: 3868fc30ee
am: a1a00cbbd1

Change-Id: I21123baaa211d19af181c970b7ad85051c7d08b7
2018-09-28 07:40:45 -07:00
Remi NGUYEN VAN
a1a00cbbd1 Merge "Call clearSettingsProvider before and after test"
am: 3868fc30ee

Change-Id: I38cae25353df48851280490d4593e70b49f0e6c0
2018-09-28 07:28:31 -07:00
Luke Huang
5638081758 Rename object mNetd to mNetworkManagementService
No functionality change

Test: runtest frameworks-net passes
Change-Id: Ic3977eed9a86deb76ef0e4e12ffa17597bdecc30
2018-09-28 13:47:13 +08:00