Commit Graph

9733 Commits

Author SHA1 Message Date
Paul Hu
3d1867013e 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
2020-06-29 12:16:47 +00:00
Paul Hu
18da2dcce5 Merge "[RFPM01] Merge package added/removed methods" am: fac73070cc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1317236

Change-Id: I0c7f6ab65220eaf0169fb4d88f9aec023ab33228
2020-06-29 12:03:56 +00:00
Paul Hu
fac73070cc Merge "[RFPM01] Merge package added/removed methods" 2020-06-29 11:50:57 +00:00
Lorenzo Colitti
5fafdd4695 [automerger skipped] Merge "Send ConnDiags event before revalidating network in CS." into rvc-dev am: 874dec6ba8 -s ours
am skip reason: Change-Id Ic7bc7138c54c47bbfdf56af5811709fde66f8606 with SHA-1 b0174784bc is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12004847

Change-Id: I5d9f3dfaf49f78773c92f4c6dfefb95adb629ce8
2020-06-26 15:21:24 +00:00
Lorenzo Colitti
aace2f48a9 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
Original-Change: https://android-review.googlesource.com/1350662
Merged-In: Ic7bc7138c54c47bbfdf56af5811709fde66f8606
Change-Id: Ic7bc7138c54c47bbfdf56af5811709fde66f8606
2020-06-26 07:59:04 +00:00
Lorenzo Colitti
2323163720 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
2020-06-26 07:48:13 +00:00
Lorenzo Colitti
ad069383bd Merge "Send ConnDiags event before revalidating network in CS." am: a4e39ee58a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1350662

Change-Id: Ie3108f4cc45083523f6f0cda67dad1f13568f296
2020-06-26 07:31:08 +00:00
Lorenzo Colitti
a4e39ee58a Merge "Send ConnDiags event before revalidating network in CS." 2020-06-26 07:13:56 +00:00
Cody Kesting
b0174784bc 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
2020-06-25 16:57:18 -07:00
Orion Hodson
9fd32beb75 [automerger skipped] Merge changes from topic "lnh-platform-split" am: 8af442d45e am: 1aa51f8eb4 -s ours
am skip reason: Change-Id I7af128f42ae89a77a8e3fb113ea533331153c535 with SHA-1 177a89beb0 is in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1348764

Change-Id: I3bb4fbb8c5c7df3f43bb69e1228848540e1249f9
2020-06-25 08:13:32 +00:00
Orion Hodson
1aa51f8eb4 Merge changes from topic "lnh-platform-split" am: 8af442d45e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1348764

Change-Id: Ie34095ddf885fcf57e2a7bcb89817485564e9100
2020-06-25 07:58:17 +00:00
Orion Hodson
8af442d45e Merge changes from topic "lnh-platform-split"
* changes:
  Update to use nativehelper/JNIPlatformHelp.h
  Sync with libnativehelper refactoring
2020-06-25 07:36:05 +00:00
Orion Hodson
806989d0ed Merge "Update to use nativehelper/JNIPlatformHelp.h" into rvc-dev-plus-aosp 2020-06-24 21:02:39 +00:00
Luke Huang
baddf27799 [automerger skipped] Merge "Disable sockets and DNS if process lacks INTERNET permission." am: 4ce5c9c101 am: 43e6ff5364 -s ours
am skip reason: Change-Id If002280fbad493dfc2db3d9d505c0257d49a9056 with SHA-1 4b667b529a is in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1348586

Change-Id: Ib9649cba9bd46a0dc9de42dc89775cc19fff8e57
2020-06-24 19:11:48 +00:00
Luke Huang
490abc0955 [automerger skipped] Merge "Move DnsPacket to libs net" am: d295f3e4f4 am: 027d039d21 -s ours
am skip reason: Change-Id I8841d91456952ded5efbf8ea221289aecc7746ad with SHA-1 8baac073d8 is in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1348582

Change-Id: I4bddd1c6f072845f1a62812995a3b4cb4299ccaa
2020-06-24 19:11:24 +00:00
Luke Huang
43e6ff5364 Merge "Disable sockets and DNS if process lacks INTERNET permission." am: 4ce5c9c101
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1348586

Change-Id: I12eb986a95894e41679673830adbbb727d8a8834
2020-06-24 18:52:53 +00:00
Luke Huang
027d039d21 Merge "Move DnsPacket to libs net" am: d295f3e4f4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1348582

Change-Id: I9a5f1d701e5c8f7629df1dfcd0dab44e28945dfc
2020-06-24 18:51:42 +00:00
Luke Huang
4ce5c9c101 Merge "Disable sockets and DNS if process lacks INTERNET permission." 2020-06-24 18:42:08 +00:00
Orion Hodson
208eeeddef Update to use nativehelper/JNIPlatformHelp.h
Reflects refactoring of JNI helper code that depends on private
methods within libnativehelper.

Bug: 151443957
Test: Treehugger
Change-Id: I7af128f42ae89a77a8e3fb113ea533331153c535
Merged-In: I7af128f42ae89a77a8e3fb113ea533331153c535
Exempt-From-Owner-Approval: cherry pick
(cherry picked from commit e7e3e3ea8f)
2020-06-24 14:13:49 +01:00
Orion Hodson
177a89beb0 Update to use nativehelper/JNIPlatformHelp.h
Reflects refactoring of JNI helper code that depends on private
methods within libnativehelper.

Bug: 151443957
Test: Treehugger
Change-Id: I7af128f42ae89a77a8e3fb113ea533331153c535
Merged-In: I7af128f42ae89a77a8e3fb113ea533331153c535
Exempt-From-Owner-Approval: cherry pick
(cherry picked from commit e7e3e3ea8f)
2020-06-24 12:46:47 +00:00
Luke Huang
836c695840 Disable sockets and DNS if process lacks INTERNET permission.
This is a Client-only solution.
  - Add to NetdClient a per-process std::atomic_boolean
    similar to netIdForProcess and netIdForResolv.
  - The boolean says whether the process should be
    allowed Internet connectivity.
  - Add an @hide method to NetUtils.java to set the boolean;
    call it from the initialization code of the new
    process just after forking from zygote.
  - Make netdClientSocket and dnsOpenProxy check the
    boolean. If the boolean is false, return EPERM from
    socket calls.

Bug: 150028556
Test: atest NetworkUtilsTest
Test: atest CtsAppSecurityHostTestCases:UseProcessTest
(cherry-pick from internal branch, ag/11881939)
Merged-In: If002280fbad493dfc2db3d9d505c0257d49a9056
Change-Id: If002280fbad493dfc2db3d9d505c0257d49a9056
2020-06-24 11:58:57 +00:00
Luke Huang
cf0dc48358 Move DnsPacket to libs net
This class might be used by some mainline modules.

Bug: 151052811
Test: atest DnsPacketTest
Test: atest DnsResolverTest
(clean cherry-pick from internal branch)
Merged-In: I8841d91456952ded5efbf8ea221289aecc7746ad
Change-Id: I8841d91456952ded5efbf8ea221289aecc7746ad
2020-06-24 11:32:26 +00:00
paulhu
e952ccfdf4 [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
2020-06-23 16:10:03 +08:00
Paul Hu
26d5ea1687 [automerger skipped] Merge "Make PendingIntent immutable and correct Settings package name" am: 8ae6128b05 am: 0b55f2fac7 -s ours
am skip reason: Change-Id I02e3277358623400aa03dc8996af3d7c46a8ce76 with SHA-1 70aed281f1 is in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1325698

Change-Id: Ib4f8628ead3b0a39a0d1009cb2fd4c0ef5ea246a
2020-06-23 04:26:59 +00:00
Paul Hu
0b55f2fac7 Merge "Make PendingIntent immutable and correct Settings package name" am: 8ae6128b05
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1325698

Change-Id: I39f50eb0b88d0f255bea1bd46cf61da010491f20
2020-06-23 04:09:20 +00:00
Paul Hu
8ae6128b05 Merge "Make PendingIntent immutable and correct Settings package name" 2020-06-23 03:55:22 +00:00
paulhu
68426196a5 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
2020-06-23 10:05:01 +08:00
Treehugger Robot
1333cd91aa [automerger skipped] Merge "Update DnsManagerTest for AIDL interface change" am: 9f725d606a am: 4454ba73ff -s ours
am skip reason: Change-Id Ic53f42b968626294c851dac252a70769846ba427 with SHA-1 bfce3bc8e3 is in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1345375

Change-Id: I89da68283cb71ce1ee25734d481fa24f966f2042
2020-06-22 16:47:23 +00:00
Treehugger Robot
4454ba73ff Merge "Update DnsManagerTest for AIDL interface change" am: 9f725d606a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1345375

Change-Id: Ic9836cb0ca7ad9e97b7edb135dbb1f8269f4a0df
2020-06-22 15:50:00 +00:00
Treehugger Robot
9f725d606a Merge "Update DnsManagerTest for AIDL interface change" 2020-06-22 15:31:54 +00:00
TreeHugger Robot
4a5922b7e0 Merge "Update DnsManagerTest for AIDL interface change" into rvc-dev am: f6aeae7ca6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11954238

Change-Id: I1327794e6b8201d3c47c39838cfa516812cf273d
2020-06-22 15:18:45 +00:00
Ken Chen
a523111101 Update DnsManagerTest for AIDL interface change
Check one more parameter enforceDnsUid in ResolverOptionsParcel in
DnsManagerTest.

Bug: 159587277
Test: atest
com.android.server.connectivity.DnsManagerTest#testSendDnsConfiguration

Change-Id: Ic53f42b968626294c851dac252a70769846ba427
Merged-In: Ic53f42b968626294c851dac252a70769846ba427
2020-06-22 15:10:12 +00:00
TreeHugger Robot
f6aeae7ca6 Merge "Update DnsManagerTest for AIDL interface change" into rvc-dev 2020-06-22 15:09:54 +00:00
TreeHugger Robot
2b971ed1c1 [automerger skipped] Merge "Support DNS-over-TLS probes in NetworkDiagnostics" into rvc-dev am: 160850d48d -s ours
am skip reason: Change-Id I1b54abed0e931ca4b8a97149459cde54da1c3d6f with SHA-1 d0e4221f64 is in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11940428

Change-Id: I8c9e94f26b3fd0d72e718fc39d5047604b741868
2020-06-22 14:28:08 +00:00
TreeHugger Robot
160850d48d Merge "Support DNS-over-TLS probes in NetworkDiagnostics" into rvc-dev 2020-06-22 14:15:40 +00:00
Ken Chen
bfce3bc8e3 Update DnsManagerTest for AIDL interface change
Check one more parameter enforceDnsUid in ResolverOptionsParcel in
DnsManagerTest.

Bug: 159587277
Test: atest
com.android.server.connectivity.DnsManagerTest#testSendDnsConfiguration

Change-Id: Ic53f42b968626294c851dac252a70769846ba427
2020-06-22 21:44:07 +08:00
Lorenzo Colitti
75616e28f6 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
2020-06-22 09:14:15 +00:00
Lorenzo Colitti
500ee9a7b3 Merge "Make PendingIntent immutable and correct Settings package name" into rvc-dev 2020-06-22 09:00:25 +00:00
Mike Yu
276e3eb5f3 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
Original-Change: https://android-review.googlesource.com/1011670
Merged-In: I1b54abed0e931ca4b8a97149459cde54da1c3d6f
Change-Id: I1b54abed0e931ca4b8a97149459cde54da1c3d6f
2020-06-22 08:57:49 +00:00
paulhu
70aed281f1 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
2020-06-22 15:32:01 +08:00
Mike Yu
cd9f6754d6 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
2020-06-22 06:56:39 +00:00
Mike Yu
d7b0b95a3a Merge "Support DNS-over-TLS probes in NetworkDiagnostics" am: 64ffa1762f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1011670

Change-Id: I9e436446179750315be45ddc034cece5afd3c004
2020-06-22 06:45:25 +00:00
Mike Yu
d0e4221f64 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
2020-06-20 16:22:35 +08:00
Remi NGUYEN VAN
edadfcfae1 Merge "Move Inet[4]AddressUtils to libs/net" into rvc-dev am: af3d08be80
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11846903

Change-Id: Icd141a992c46290c74929785e261a1cd57bc001b
2020-06-19 01:08:48 +00:00
Remi NGUYEN VAN
af3d08be80 Merge "Move Inet[4]AddressUtils to libs/net" into rvc-dev 2020-06-19 00:49:29 +00:00
Aaron Huang
2ca334851b Merge "Address comments from aosp/1298476" am: 6dc9a28b88 am: e2a6e9a49a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1340040

Change-Id: I7b119758ac7cd65defdec77692957287af17566d
2020-06-18 10:47:47 +00:00
Lorenzo Colitti
0c1f0247d5 Merge "Move DnsPacket to libs net" into rvc-dev am: 271db73395
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11862407

Change-Id: Ia19cb44ad56e4358c63564261d481459d1386542
2020-06-18 10:34:11 +00:00
Aaron Huang
e2a6e9a49a Merge "Address comments from aosp/1298476" am: 6dc9a28b88
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1340040

Change-Id: I3c7c0ef738b6c6b964dc91c593cbf2b6166e3843
2020-06-18 10:34:10 +00:00
Aaron Huang
6dc9a28b88 Merge "Address comments from aosp/1298476" 2020-06-18 10:18:57 +00:00
Lorenzo Colitti
271db73395 Merge "Move DnsPacket to libs net" into rvc-dev 2020-06-18 10:14:47 +00:00