Commit graph android_packages_modules_Co.../services
Message SHA1
Stop setting the legacy net.dnsX system properties
These have been locked down via SELinux for a while and thus
they should be safe to delete at this point.

Test: atest FrameworksNetTest
Bug: 33308258
Bug: 148724751
Change-Id: I3a1e9c6ad92c8d2367e0048e5d6cd7d06bbc6e80

Chiachang Wang   commited 2020-10-16 08:19:25 +00:00
e62f378b9c
Use system api for shell command handling
ConnectivityService should not use ShellCommand since it's @hide
which does not accessible in mainline modules. Replace it with
system api for mainline.

Bug: 170598012
Test: adb shell cmd connectivity airplane-mode enable
Test: adb shell cmd connectivity airplane-mode disable
Change-Id: I47e7a371c19eb18eac643fe9a2ab481bec5743c2

Chiachang Wang   commited 2020-10-13 08:41:24 +00:00
0efaff8cbc
Merge "Move IpUtils to frameworks/libs/net"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2020-10-09 00:13:40 +00:00
1ea097fcb2
Merge "Remove unused ACTION_PACKAGE_ADDED intent."
Paul Hu   authored and   Gerrit Code Review   commited 2020-10-08 02:05:17 +00:00
eba570a209
Remove unused ACTION_PACKAGE_ADDED intent.
ConnectivityService doesn't handle ACTION_PACKAGE_ADDED intent
now. So remove the intent from filter to prevent wtf log
happened.

Bug: 169573829
Test: atest FrameworksNetTests
Change-Id: Ifb0ae0b2e811defdecb37d3489ab3208db397331

paulhu   commited 2020-10-06 14:48:29 +08:00
4b81e2399f
Move IpUtils to frameworks/libs/net
The utility classes are useful for mainline modules and their tests, for
example IpClientIntegrationTest.

Bug: 168868607
Test: m && atest NetworkStaticLibTests
Change-Id: If2b1613aa18a7990391e2d31cc2951ca93f1cf3c

Remi NGUYEN VAN   commited 2020-10-05 14:38:19 +09:00
7e3efdb49c
Merge "Skip stop if keepalive is already in stopping state"
Junyu Lai   authored and   Gerrit Code Review   commited 2020-09-24 02:45:09 +00:00
57b79f463d
Skip stop if keepalive is already in stopping state
In current design, crash has been generated when stop function
has been re-entered to catch unexpected behavior. However,
it is possible to re-enter stop function if the network
disconnection occurs after stopping.

Thus, skip stop if keepalive is already in stopping state.

Test: atest ConnectivityServiceTest#testNattSocketKeepalives \
      --rerun-until-failure 60000
Bug: 167332570
Change-Id: Ic7068ad3dc990e957c37b8d87d48ebb6469b101f

junyulai   commited 2020-09-17 19:51:34 +08:00
e30a5c2730
Merge "Remove a useless method"
Treehugger Robot   authored and   Gerrit Code Review   commited 2020-09-16 05:58:01 +00:00
8523dd4e8b
Remove a useless method
No seriously ?

Test: builds
Change-Id: Ie1508ce50a39e4c69a4b238067bab1e83ddaf019

Chalard Jean   commited 2020-09-15 16:18:56 +09:00
8eaf3a9a60
Merge changes from topic "sep11"
* changes:
  Update language to comply with Android's inclusive language guidance
  Update language to comply with Android's inclusive language guidance
  Update language to comply with Android's inclusive language guidance
  Update language to comply with Android's inclusive language guidance
  Update language to comply with Android's inclusive language guidance
  Update language to comply with Android's inclusive language guidance
  Update language to comply with Android's inclusive language guidance
  Update language to comply with Android's inclusive language guidance

Jeff Sharkey   authored and   Gerrit Code Review   commited 2020-09-14 21:52:13 +00:00
17b739a5f7
Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Test: none
Bug: 168334533
Exempt-From-Owner-Approval: docs updates
Change-Id: If75259aab72329f9f8b0e1972a96370ca5134e2c

Jeff Sharkey   commited 2020-09-14 10:00:10 -06:00
0d58543df0
Merge "Handle lockdown VPN reset intent in ConnectivityService"
Junyu Lai   authored and   Gerrit Code Review   commited 2020-09-14 03:14:51 +00:00
63b0d576a0
Handle lockdown VPN reset intent in ConnectivityService
Currently, LockdownVpnTracker handles lockdown VPN reset intent.
Which will grab VPN object as a lock, then calls into
ConnectivityService to grab mVpn lock when querying NetworkInfo.
However, the order of grabing locks differs from ConnectivityService
and will causes deadlock if ConnectivityService grabs locks in
the other order.

Thus, make ConnectivityService handles reset intent so the
order of grabing locks can be consistent.

Test: atest FrameworksNetTests
Bug: 147403549
Change-Id: Ia10a3ef6f1e20d092a17313935083a84860961aa

junyulai   commited 2020-09-11 11:43:51 +08:00
b56dc51652
Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: I3d92a6de21a938f6b352ec26dc23420c0fe02b27
Change-Id: Ifdb80563ef042738778ebb8a7581a97c4e3d96e2

Xin Li   commited 2020-08-31 21:21:38 -07:00
4037c36d47
Merge "Notify the keepalive is stopped after the slot has been released"
Junyu Lai   authored and   Gerrit Code Review   commited 2020-08-28 10:12:44 +00:00
09a0f57f87
Merge "Revert "[RFPM03] Check permission by uid.""
Paul Hu   authored and   Gerrit Code Review   commited 2020-08-20 08:24:30 +00:00
0925015de5
Merge "Revert "[RFPM04] Adjust hasRestrictedNetworkPermission method""
Paul Hu   authored and   Gerrit Code Review   commited 2020-08-20 08:14:48 +00:00
bddd412feb
Merge "Revert "[RFPM05] Add UidNetdPermissionInfo class""
Paul Hu   authored and   Gerrit Code Review   commited 2020-08-20 06:25:06 +00:00
324af52c7a
Revert "[RFPM03] Check permission by uid."
This reverts commit f1e343c1c3.

Reason for revert: Regression in SW.  Bug:162499840

Change-Id: Ic93e762e41a728f66e200e5bc8e40ebe4c7b44f7

Paul Hu   authored and   Remi NGUYEN VAN   commited 2020-08-20 06:23:16 +00:00
fe640c8708
Revert "[RFPM04] Adjust hasRestrictedNetworkPermission method"
This reverts commit bfa9f182b0.

Reason for revert: Regression in SW.  Bug:162499840

Change-Id: I96bf28ffc9f2d8f3838cb6d2dac16f89a70177ed

Paul Hu   authored and   Remi NGUYEN VAN   commited 2020-08-20 06:23:00 +00:00
e573ac006d
Revert "[RFPM05] Add UidNetdPermissionInfo class"
This reverts commit fbc1f34c22.

Reason for revert: Regression in SW.  Bug:162499840

Change-Id: I0e846efcc4fc06b53d97b2007e0d8e8f97c6ac10

Paul Hu   commited 2020-08-20 03:10:08 +00:00
9e986a8e98
Notify the keepalive is stopped after the slot has been released
Currently, the callbacks of stopping were fired when stop procedure
is started, because the upper layer apps only care about the reason
of stopping instead of stopping result. Thus, there is no need to
wait for the result comes back. However, this behavior generates
races if apps want to re-start keepalive immediately since the
resources are not released yet.

Fix: 134891441
Fix: 140305589
Test: atest com.android.server.ConnectivityServiceTest#testPacketKeepalives \
      --rerun-until-failure 1000

Change-Id: I987776a9211a50e964c4675b747bc10e203750f1

junyulai   commited 2020-08-20 11:00:08 +08:00
72d2bd016b
Merge "Update language to comply with Android's inclusive language guidance"
Chiachang Wang   authored and   Gerrit Code Review   commited 2020-08-12 09:30:11 +00:00
64f9851e3a
Merge "[RFPM05] Add UidNetdPermissionInfo class"
Paul Hu   authored and   Gerrit Code Review   commited 2020-08-12 06:17:46 +00:00
255bf95e97
Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code
for reference.

Bug: 161896447
Test: m ; atest FrameworkNetTests
Change-Id: Ib6b4c9526992c31e05e82be80e2b9b86bc0b57ef

Chiachang Wang   commited 2020-08-12 12:23:59 +08:00
e6a0a2b6b9
[RFPM05] Add UidNetdPermissionInfo class
Add UidNetdPermissionInfo class to store netd permission info of
each uid. Use the bit mask for combining all netd permission into
one value which can update and get the uid permission easily.
Moreover, aosp/1340042 add carryover package info into this class
which centralizes all netd permissions relevant data.

Bug: 132784544
Test: atest FrameworksNetTests
Change-Id: I3b81ea2a5017e8f4d0d603144a33c9b08640d7ba

paulhu   commited 2020-08-12 10:33:18 +08:00
fbc1f34c22
Fix fd leak in KeepaliveTracker.
The semantics of FileDescriptor in AIDL are that the callee must close
the file descriptor it receives manually.

Bug: http://b/157789860
Test: treehugger
Change-Id: Ice9fc9abe2959a84ad138a95c900dff676653665

Josh Gao   authored and   Lorenzo Colitti   commited 2020-08-07 03:22:38 +00:00
bd97cc8ebf
[RFPM04] Adjust hasRestrictedNetworkPermission method
There are two parts in hasRestrictedNetworkPermission method.
One is carryover package check and one is uid permission
check. Seperate carryover package check part to another method
to be clearer the usage of hasRestrictedNetworkPermission method.

Bug: 132784544
Test: atest FrameworksNetTests
Change-Id: Iab0609fcaa52acb0dfcb31ca957f22bfe8d62392

paulhu   commited 2020-07-29 14:14:27 +08:00
bfa9f182b0
[RFPM03] Check permission by uid.
PermissionMonitor check permission by each package name but only
update the uid permission to netd. It's better to check
permission by uid directly. Thus, use
ActivityManager#checkUidPermission to check permissions for each
uid.

Bug: 132784544
Test: atest FrameworksNetTests
Change-Id: I057d34383b4dc408b2773e4c6b146774ba0c5eb2

paulhu   commited 2020-07-28 18:23:38 +08:00
f1e343c1c3
Merge "Remove ProxyInfo(String) and update callers to use ProxyInfo(Uri)" am: a46e5911ee am: e0ca014302
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1146757

Change-Id: If60a348768c507153c1a9038953b2f6c29fc8f03

Aaron Huang   authored and   Automerger Merge Worker   commited 2020-07-17 06:05:38 +00:00
6232225d8b
Merge "Remove ProxyInfo(String) and update callers to use ProxyInfo(Uri)"
Aaron Huang   authored and   Gerrit Code Review   commited 2020-07-17 05:40:31 +00:00
a46e5911ee
Merge "[RFPM02] Add Dependencies class for injection in tests." am: 0cb16d1bb3 am: 7ce1646c8f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1318291

Change-Id: If53e1521327c8d9f1fd2a5debb94c58ed25b2880

Paul Hu   authored and   Automerger Merge Worker   commited 2020-07-08 10:35:21 +00:00
6f659fab51
[RFPM02] Add Dependencies class for injection in tests.
Add Dependencies class in PermissionMonitor for injection
in tests easily.

Bug: 132784544
Test: atests FrameworksNetTests
Change-Id: Ibb84d548908f7a955fa0ff206794486733259978

paulhu   commited 2020-07-08 15:30:42 +08:00
9883de0b7f
Remove ProxyInfo(String) and update callers to use ProxyInfo(Uri)
Update all callers to use ProxyInfo(Uri) and remove ProxyInfo(String).

Bug: 160557668
Test: build pass
      atest FrameworksNetTests

Change-Id: I4c980764c8839c48acf03208bb68cd53eb910121

Aaron Huang   commited 2020-07-06 11:59:27 +00:00
77acd4c2e7
Merge "Connectivity: start PAC global proxy after reboot." am: 840c688ba5 am: 70655e6270
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/431599

Change-Id: I5bb6267ca876df8aef0b2df630c058726b195352

Pavel Grafov   authored and   Automerger Merge Worker   commited 2020-07-03 11:38:59 +00:00
934d3eabf7
Merge "Connectivity: start PAC global proxy after reboot."
Pavel Grafov   authored and   Gerrit Code Review   commited 2020-07-03 10:54:10 +00:00
840c688ba5
Merge "[RFPM01] Merge package added/removed methods" am: fac73070cc am: 18da2dcce5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1317236

Change-Id: Ida8f82d2ec5be1040a2bdf2aa65a94d53f68ea6c

Paul Hu   authored and   Automerger Merge Worker   commited 2020-06-29 12:16:47 +00:00
3d1867013e
Merge "[RFPM01] Merge package added/removed methods"
Paul Hu   authored and   Gerrit Code Review   commited 2020-06-29 11:50:57 +00:00
fac73070cc
Merge "Send ConnDiags event before revalidating network in CS." am: a4e39ee58a am: ad069383bd
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1350662

Change-Id: Id42979bdb98469f586d97f05ed8ecdc28fbb878f

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2020-06-26 07:48:13 +00:00
2323163720
Send ConnDiags event before revalidating network in CS.
This change updates ConnectivityService to notify the
ConnectivityDiagnosticsHandler of app-reported connectivity before
attempting to revalidate the network. This change forces an ordering on
Connectivity Diagnostics events in the case that the reported
connectivity does not match the known connectivity for the network -
this leads to the network being revalidated and the
ConnectivityDiagnostics event onConnectivityReportAvailable. Passing the
onNetworkConnectivityReported event to the
ConnectivityDiagnosticsHandler first ensures that it is passed to
callbacks before any potential ConnectivityReports are.

Bug: 159718782
Test: android.net.cts.ConnectivityDiagnosticsManagerTest
Change-Id: Ic7bc7138c54c47bbfdf56af5811709fde66f8606

Cody Kesting   commited 2020-06-25 16:57:18 -07:00
b0174784bc
[RFPM01] Merge package added/removed methods
There are two methods to handle package added/removed from
two differnt listeners. It can use one of listener to handle the
changes. Thus, keep PackageManagerInternal#PackageListObserver
but remove the listening from ConnectivityService.

Bug: 132784544
Test: atests FrameworksNetTests
Change-Id: Ib2db85e4108f9fda731bf6667d0af0610fc79fea

paulhu   commited 2020-06-23 16:10:03 +08:00
e952ccfdf4
Merge "Make PendingIntent immutable and correct Settings package name"
Paul Hu   authored and   Gerrit Code Review   commited 2020-06-23 03:55:22 +00:00
8ae6128b05
Make PendingIntent immutable and correct Settings package name
ConnectivityService puts up some notifications with pending
intents, but these pending intents are mutable that content can
be changed by someone. So make these pending intents to be
immutable.

Some OEMs have their own Settings package. Thus, need to get the
current using Settings package name instead of just use default
name "com.android.settings".

Bug: 154928507
Test: atest FrameworksNetTests
Change-Id: I02e3277358623400aa03dc8996af3d7c46a8ce76
Merged-In: I02e3277358623400aa03dc8996af3d7c46a8ce76

paulhu   commited 2020-06-23 10:05:01 +08:00
68426196a5
Merge "Make PendingIntent immutable and correct Settings package name" into rvc-dev am: 500ee9a7b3
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11881938

Change-Id: I0ce82679bf81e3c58fed12943b7c9ca9d449fb7f

Lorenzo Colitti   authored and   Automerger Merge Worker   commited 2020-06-22 09:14:15 +00:00
75616e28f6
Merge "Make PendingIntent immutable and correct Settings package name" into rvc-dev
Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2020-06-22 09:00:25 +00:00
500ee9a7b3
Make PendingIntent immutable and correct Settings package name
ConnectivityService puts up some notifications with pending
intents, but these pending intents are mutable that content can
be changed by someone. So make these pending intents to be
immutable.

Some OEMs have their own Settings package. Thus, need to get the
current using Settings package name instead of just use default
name "com.android.settings".

Bug: 154928507
Test: atest FrameworksNetTests
Change-Id: I02e3277358623400aa03dc8996af3d7c46a8ce76

paulhu   commited 2020-06-22 15:32:01 +08:00
70aed281f1
Merge "Support DNS-over-TLS probes in NetworkDiagnostics" am: 64ffa1762f am: d7b0b95a3a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1011670

Change-Id: I25a06623d87e6971a9dac73bdea82a78fd6124d6

Mike Yu   authored and   Automerger Merge Worker   commited 2020-06-22 06:56:39 +00:00
cd9f6754d6
Support DNS-over-TLS probes in NetworkDiagnostics
Probe DNS servers to see they support DNS-over-TLS. Use system
CAs to verify whether the certificates sent by DNS servers are
trusted or not. An error is thrown to cause the probe failed if
DNS servers send untrusted certificates.

Unlike the DnsResolver which doesn't verify the certificates
in opportunistic mode, all of the DoT probes from NetworkDiagnostics
check certificates.

DoT probes apply to the DNS servers gotten from LinkProperties
and the DoT servers gotten from PrivateDnsConfig whatever private
DNS mode is.

A common example in DNS strict mode:
.  DNS TLS dst{8.8.8.8} hostname{dns.google} src{192.168.43.2:48436} qtype{1} qname{815149-android-ds.metric.gstatic.com}: SUCCEEDED: 1/1 NOERROR (432ms)
F  DNS TLS dst{192.168.43.144} hostname{}: FAILED: java.net.ConnectException: failed to connect to /192.168.43.144 (port 853) from /192.168.43.2 (port 41770) after 2500ms: isConnected failed: ECONNREFUSED (Connection refused) (172ms)
.  DNS TLS dst{8.8.4.4} hostname{dns.google} src{192.168.43.2:37598} qtype{1} qname{759312-android-ds.metric.gstatic.com}: SUCCEEDED: 1/1 NOERROR (427ms)

An example when the CA is not trusted:
F  DNS TLS dst{8.8.8.8} hostname{dns.google}: FAILED: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found. (16ms)

An example when TCP/TLS handshake timeout:
F  DNS TLS dst{8.8.8.8} hostname{dns.google}: FAILED: java.net.SocketTimeoutException: failed to connect to /8.8.8.8 (port 853) from /192.168.2.108 (port 45680) after 2500ms (2514ms)

Bug: 132925257
Bug: 118369977
Test: atest FrameworksNetTests
Change-Id: I1b54abed0e931ca4b8a97149459cde54da1c3d6f

Mike Yu   commited 2020-06-20 16:22:35 +08:00
d0e4221f64
Connectivity: start PAC global proxy after reboot.
Previously, we read the global proxy settings from Settings.Global
database after reboot. This works for manual proxies, but not for
proxies based on PAC rules, as PacManager is never invoked when
ConnectivityService starts up. As a consequence, services required for
PAC-based proxies (PacService and ProxyService) are never started.

In this CL, we make sure PacManager is called during boot, so that PAC
rules will take effect.

Bug: 35943997
Test: set a PAC proxy and observe it still works after reboot
Change-Id: I69edb5fcd3e84663d338ff4b93c40fd5ee2c8c51

Pavel Grafov   commited 2020-06-17 00:18:34 +01:00
600309ddf8