Commit Graph

6148 Commits

Author SHA1 Message Date
Chiachang Wang
d5895ce4cf Merge "Replace limited connectivity notification after detecting it" 2019-05-30 10:56:08 +00:00
Treehugger Robot
baaef39c9b Merge "Prevent a 4-way binder interlock leading to a leak." 2019-05-30 10:22:30 +00:00
Chalard Jean
8690e1f144 Merge "Always give VPN the INTERNET capability." 2019-05-30 08:36:19 +00:00
Chiachang Wang
af13b9f275 Replace limited connectivity notification after detecting it
No internet notification may be prompted before partial
connectivity being detected. Partial connectivity status will
be set into NAI and prompted in the Setting. Behavior is not
aligned between Setting and notification. Thus, update
notification again if partial connectivity is detected.
Also, sliently show the updated notification if no internet
notification has already been shown to user to prevent alerting
user in short time.

Bug: 130683832
Test: Verified with simulated partial connectivity
Test: atest FrameworksNetTests
Change-Id: Ie16a8ce6e0fa437048e8c1eea240314ca30e9520
2019-05-30 16:19:47 +08:00
Chalard Jean
7284daa96e Prevent a 4-way binder interlock leading to a leak.
System server             |        NetworkStack
                              |
NetworkMonitorCallbacks  ←----|--- NetworkMonitorCallbacks$Stub$Proxy
         ↓                    |           ↑
  NetworkAgentInfo            |      NetworkMonitor
         ↓                    |           ↑
NetworkMonitor$Stub$Proxy ----|---→ NetworkMonitorImpl

Bug: b/133174607
Test: Manual. The simplest artifact is observed by watching the output of
adb shell dumpsys meminfo -d com.android.networkstack | grep 'Proxy Binders'
while connecting and disconnecting multiple times to any network.
This will display the number of binder proxies. Before this, the binder
proxy count increases by 1 with each connection and never goes down (there
is some noise, as proxy objects are sometimes created for other reasons,
and get GC'd eventually). After this, the binder proxy count is always
eventually stable at 27 + connected network count.

See the bug for the complete analysis.

Change-Id: Ide2428dab3fcd6d7cd00aa2a9fd99d6c99b815a4
2019-05-30 17:12:46 +09:00
Chalard Jean
318feaf1ed Always give VPN the INTERNET capability.
Split-tunnel VPN (which are the only ones affected by this change)
always fall through to the default network for routes they don't
handle, and even if the underlying network(s) don't provide access
this may be a pinhole that can actually reach the broader network.

In practice this behaves like the original release of P and is the
safest thing to do for Q. In R we should evaluate giving the VPN
app the ability to simply tell the network stack whether it does
provide Internet access or not.

Bug: 119216095
Test: FrameworksNetTests NetworkStackTests
Change-Id: I262ca41fe0225660551c9a421562405366b6acac
2019-05-30 16:11:14 +09:00
Chen Xu
74f0698ce6 Merge "NetworkStatAccess Should checkCarrierPrivileges cross all subscriptions" 2019-05-29 17:15:41 +00:00
Chalard Jean
126a957df5 Merge "Add a common test library." 2019-05-29 12:16:08 +00:00
chen xu
d5e7114ee9 NetworkStatAccess Should checkCarrierPrivileges cross all subscriptions
Bug: 133236378
Test: Manual
Change-Id: I49fbde1fe73b33aadcf8fd23ad224f363b137bf3
2019-05-28 23:28:56 -07:00
Luke Huang
3b14d4641a Minor changes for DnsUtils and its test
fix nits for ag/7671031

Bug: 129530368
Test: atest DnsUtilsTest
Change-Id: I562d33870a933a5fe55c89137a2d9574e3c59b90
2019-05-29 13:56:27 +08:00
Chalard Jean
e343bcc913 Add a common test library.
This is the most common test library for Connectivity tests. It is
meant to be usable in framework tests, network stack tests, CTS,
GTS. To achieve that, it can only depend on framework classes.

Bug: none
Test: NetworkMonitorTest
Test: NsdManagerTest
Test: ConnectivityServiceTest
Test: OffloadControllerTest
Test: NetworkStatsObserversTest
Test: NetworkStatsServiceTest
(all the touched classes)

Change-Id: Ic47cbe7ba0e407145fa6bc49bb2adb3c5937dbc4
2019-05-28 22:20:51 +09:00
Chalard Jean
ce2f2fe2e8 Merge "Let the system server have CONNECTIVITY_USE_RESTRICTED_NETWORKS." 2019-05-28 12:26:10 +00:00
Xiao Ma
5ad000a641 Merge "Wipe the data in IpMemoryStore database upon network factory reset." 2019-05-28 00:52:00 +00:00
Luke Huang
ac6c768bd6 Merge "Remove broken test testRfc6724Sort" 2019-05-27 14:12:05 +00:00
Treehugger Robot
c73af87b45 Merge "Reinstate access to a forgotten member" 2019-05-27 11:14:37 +00:00
Luke Huang
179c33f322 Remove broken test testRfc6724Sort
This test is conitnuely fail in cuttlefish.
Lack of ipv6 default route in cuttlefish caused the test failed.
The reason is that the result of rfc6724Sort depends on on the route in system.
It is not good to expect any route should exists, so remove it.

Bug: 133649648
Test: atest DnsUtilsTest
Change-Id: I91f89782b9b989fa1a49e666bb5ce2df3a0dbbf7
2019-05-27 17:49:32 +08:00
Chalard Jean
b807dd8884 Let the system server have CONNECTIVITY_USE_RESTRICTED_NETWORKS.
Also :
- Fix testUidFilteringDuringVpnConnectDisconnectAndUidUpdates that
  was failing on devices with a first released SDK >= Q
- Add a test actually tests that the system has the permission, as
  the test was only testing what's in the mock

Bug: 119770201
Test: New test making sure this stays true
Change-Id: I74cf5f0fa17fcf818f1fed78c7e3e4375c20152e
2019-05-27 16:35:22 +09:00
Xiao Ma
555e408928 Wipe the data in IpMemoryStore database upon network factory reset.
Bug:128499160
Test: manual
Test: atest FrameworksNetTests NetworkStackTests
Change-Id: Ib563463a861a5d27b1e9b5fbb92342249b573802
2019-05-27 15:05:09 +09:00
Chiachang Wang
b8d3727aa1 Clean up for multiple validation result update
This is a follow-up commit for aosp/955431 to update commets
and minor updates in unit test.

Test: atest com.android.server.ConnectivityServiceTest#testCaptivePortalOnPartialConnectivity
Bug: 130683832
Change-Id: I581eae8daeddd2c4c186e7b40e27fef2aaa7ab43
2019-05-24 03:29:56 +00:00
Chiachang Wang
5af07137d7 Merge "Update multiple validation result to ConnectivityService" 2019-05-24 02:50:54 +00:00
Treehugger Robot
dcc6ebb96f Merge "Fix the internet permission for native services" 2019-05-23 18:40:42 +00:00
Etan Cohen
62790fbdfe Merge "[CM] Fix NPE due to unvalidated callback value" 2019-05-23 16:01:51 +00:00
Etan Cohen
1f1bcb0b68 [CM] Fix NPE due to unvalidated callback value
Fix flaky test resulting from the above fix.

Bug: 132950880
Test: atest ConnectivityServiceTest
Change-Id: I1ddf3bb016239bf88cdd8843a71dcb5e582e83ac
2019-05-23 08:16:20 -07:00
Chiachang Wang
eff1897661 Update multiple validation result to ConnectivityService
Once a network is determined to have partial connectivity, it
cannot go back to full connectivity without a disconnect. This
is because NetworkMonitor can only communicate either
PARTIAL_CONNECTIVITY or VALID, but not both. Thus, multiple
validation results allow ConnectivityService to know the real
network status.

Bug: 129662877
Bug: 130683832
Test: atest FrameworksNetTests
Test: atest NetworkStackTests
Test: atest --generate-new-metrics 50
NetworkStackTests:com.android.server.connectivity.NetworkMonitorTest
Test: Simulate partial connectvitiy
Change-Id: I406c9368617c03a2dd3ab15fb1f6dbf539d7c714
2019-05-23 16:29:30 +08:00
Chalard Jean
8759c1ec9e Reinstate access to a forgotten member
Followup to aosp/964440

Bug: 131764329
Test: none
Change-Id: I6f6b2cf75793532d3d537a223b8e15d7304a1e3f
2019-05-23 03:32:30 +00:00
Luke Huang
26c1cdb19d Add Rfc6724 style sort for DnsResolver and fix potential bug
1. pass default network explicitly to fix potential
   mis-sync network problem in DnsResolver#query
2. Add rfc6724 sort and related test
3. DnsResolver do rfc6724 sort before response InetAddress answers
4. move haveIpv* function from DnsResolver to DnsUtils

Bug: 129530368
Test: atest DnsResolverTest DnsUtilsTest
Change-Id: I4efa599c0605f6a9e4ef2dd1a36572c69b3c433f
2019-05-23 11:23:41 +08:00
Chenbo Feng
99869f413a Fix the internet permission for native services
The native services should specify their permissions in platform.xml if
they need internet permission, otherwise the eBPF program will block the
socket creation request. Fixing the known services that are in group
AID_INET but didn't specify their permission in the xml file.

Bug: 132217906
Test: CtsJdwpTestCases dumpsys netd trafficcontroller
Change-Id: I84cde7d3757953bc0bf761727d64a715bcdd68bb
2019-05-22 17:59:29 -07:00
Etan Cohen
43c1536c6b Merge "[CM] Fix NPE due to unvalidated callback value" 2019-05-22 13:53:31 +00:00
Chalard Jean
bfcbf4b450 Merge "Update throws documentation for requestNetwork*" 2019-05-22 08:34:43 +00:00
Chalard Jean
65663acf34 Merge "Let clients access StaticIpConfiguration members through reflection." 2019-05-22 07:17:52 +00:00
Etan Cohen
b58e366f2d [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
2019-05-22 04:56:09 +00:00
Lorenzo Colitti
4b56771878 Properly use versioned interfaces.
Our stable AIDL interfaces need to use versioned build targets,
otherwise getVersion will always return 0, which makes it
impossible to support different components at different versions.

List generated with:
find . -name Android.bp -exec egrep \
    -H "(netd|dnsresolver|ipmemorystore|networkstack).aidl.interface(s?)-(java|cpp)" {} \;

Bug: 133124190
Test: m
Change-Id: Id175c99daa77507847673777a8dcce51897ab17b
2019-05-22 03:12:59 +00:00
Treehugger Robot
ac6f142334 Merge "Move keepalive constants to their right place" 2019-05-21 02:01:30 +00:00
junyulai
654be392b6 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
2019-05-21 00:23:41 +00:00
Chalard Jean
b4368bed5a Let clients access StaticIpConfiguration members through reflection.
Bug: 131764329
Test: none
Change-Id: I0fa84390f6c289571afa9d86cb922835fe2b7e77
2019-05-20 16:58:08 +09:00
Ian Kasprzak
db10850966 Reland: Add FrameworksNetTests dependency on libcgrouprc
Original CL description:
Add FrameworksNetTests dependency on libcgrouprc

The tests are currently broken without this dependency.

Bug: 132925169
Test: atest FrameworksNetTests
Change-Id: I473b250587d871158e1e9595d56183a0342238d8
Merged-In: If9c8aa41c4e96a79b71c88f199a4f3b0483e31cd
2019-05-17 17:11:16 +09:00
Lorenzo Colitti
2c3f94e392 Merge "Change the icon for the LOGGED_IN notification." 2019-05-17 04:15:51 +00:00
Lorenzo Colitti
b45f7ad98b Change the icon for the LOGGED_IN notification.
This notification is shown when the user has already logged in to
the network, so it should not have a question mark on it.

Bug: 130526201
Test: atest FrameworksNetTests
Test: manually signed in to portal
Change-Id: I8250236bc4ba251492a6cb9bf23e67666ef860d3
2019-05-17 09:00:53 +09:00
Xin Li
8f33552b32 DO NOT MERGE - Merge pie-platform-release (PPRL.190505.001) into master.
Bug: 132622481
Change-Id: I8a3d38c16d3de15514e2418d13d61b57b2cfd907
2019-05-15 16:55:34 -07:00
TreeHugger Robot
a4794fa4c4 Merge "DO NOT MERGE - Merge pi-platform-release (PPRL.190505.001) into stage-aosp-master" into stage-aosp-master 2019-05-15 23:02:14 +00:00
Xin Li
4306eb11f0 DO NOT MERGE - Merge pi-platform-release (PPRL.190505.001) into stage-aosp-master
Bug: 132622481
Change-Id: I7ba1a9999b3a9bac8031dd086fa2632e45404f32
2019-05-15 11:31:45 -07:00
Paul Hu
a582a82795 Merge "Ignore NetworkTest when running CtsNetTestCases in instant app mode"
am: a00c638ebe

Change-Id: I670b9847a2e3b3b794ee4694a0838440cabdc39f
2019-05-14 21:17:33 -07:00
Paul Hu
a00c638ebe Merge "Ignore NetworkTest when running CtsNetTestCases in instant app mode" 2019-05-15 03:42:32 +00:00
Chalard Jean
31740e4ed3 Update throws documentation for requestNetwork*
Bug: 78126688
Test: builds
Change-Id: I8b5bb052bf73feed0dfafafaf44fcd07f58186ce
2019-05-14 22:16:29 +09:00
Paul Hu
fb8186d0a9 Merge "Fix captive portal app can be launched w/o MAINLINE_NETWORK_STACK permission"
am: c381068caa

Change-Id: I065b5403d2f89d158e76f63c9b125ad30e603633
2019-05-14 04:06:04 -07:00
Paul Hu
c381068caa Merge "Fix captive portal app can be launched w/o MAINLINE_NETWORK_STACK permission" 2019-05-14 10:48:48 +00:00
paulhu
de3a2452a0 Fix captive portal app can be launched w/o MAINLINE_NETWORK_STACK permission
Caller should get SecurityException if called
ConnectivityManager#startCaptivePortalApp() w/o
MAINLINE_NETWORK_STACK permission. But now it will not get any
exception and can launch captive portal app successfully.

Bug: 132662433
Test: atest android.net.cts.ConnectivityManagerTest#testStartCaptivePortalApp
      w and w/o MAINLINE_NETWORK_STACK permission
Test: atest FrameworksNetTests NetworkStackTests

Change-Id: I61be1b0647f4165665a2d4166311adeac956e0d4
2019-05-14 18:44:16 +08:00
Chenbo Feng
6cb0c1579d Merge "Clean up the permission control code in framework"
am: 0e6d2b5f4f

Change-Id: Iff2316f72df4cff56829b281882dc920d63937bd
2019-05-13 11:20:31 -07:00
Treehugger Robot
0e6d2b5f4f Merge "Clean up the permission control code in framework" 2019-05-13 18:04:50 +00:00
Junyu Lai
5fb8a1d525 Merge "Fix concurrent modification exception in KeepaliveTracker"
am: 7da0d7f02e

Change-Id: Ibd23240fdf8fb56b4216e2482152f605374f76db
2019-05-13 03:39:29 -07:00