Commit Graph

9711 Commits

Author SHA1 Message Date
Orion Hodson
c206662f5b 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 329c612e3d5ae440bf13e1f5fc9a4012263524e9)
2020-06-24 12:46:47 +00:00
Paul Hu
d43b76f446 [automerger skipped] Merge "Make PendingIntent immutable and correct Settings package name" am: f1140d1a9c am: 64e73a539e -s ours
am skip reason: Change-Id I02e3277358623400aa03dc8996af3d7c46a8ce76 with SHA-1 f2db66615d 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
64e73a539e Merge "Make PendingIntent immutable and correct Settings package name" am: f1140d1a9c
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
f1140d1a9c Merge "Make PendingIntent immutable and correct Settings package name" 2020-06-23 03:55:22 +00:00
paulhu
7746e4ea2d 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
ac1eefd5fb [automerger skipped] Merge "Update DnsManagerTest for AIDL interface change" am: 1ce8850c27 am: b3132b400e -s ours
am skip reason: Change-Id Ic53f42b968626294c851dac252a70769846ba427 with SHA-1 8fb860bfe1 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
b3132b400e Merge "Update DnsManagerTest for AIDL interface change" am: 1ce8850c27
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
1ce8850c27 Merge "Update DnsManagerTest for AIDL interface change" 2020-06-22 15:31:54 +00:00
TreeHugger Robot
844bba26ba Merge "Update DnsManagerTest for AIDL interface change" into rvc-dev am: 6ef23fb8f3
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
fc7dd4c35e 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
6ef23fb8f3 Merge "Update DnsManagerTest for AIDL interface change" into rvc-dev 2020-06-22 15:09:54 +00:00
TreeHugger Robot
e64ed5a70e [automerger skipped] Merge "Support DNS-over-TLS probes in NetworkDiagnostics" into rvc-dev am: 56e7d278a8 -s ours
am skip reason: Change-Id I1b54abed0e931ca4b8a97149459cde54da1c3d6f with SHA-1 6cad4b10db 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
56e7d278a8 Merge "Support DNS-over-TLS probes in NetworkDiagnostics" into rvc-dev 2020-06-22 14:15:40 +00:00
Ken Chen
8fb860bfe1 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
a5b40ffb4d Merge "Make PendingIntent immutable and correct Settings package name" into rvc-dev am: 1b7f9ca7d0
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
1b7f9ca7d0 Merge "Make PendingIntent immutable and correct Settings package name" into rvc-dev 2020-06-22 09:00:25 +00:00
Mike Yu
b6b7e0c2be 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
f2db66615d 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
3efb6bd1ec Merge "Support DNS-over-TLS probes in NetworkDiagnostics" am: 64ffa1762f am: 4e04c11379
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
4e04c11379 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
6cad4b10db 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
7007e35032 Merge "Move Inet[4]AddressUtils to libs/net" into rvc-dev am: 6e5b6b612d
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
6e5b6b612d Merge "Move Inet[4]AddressUtils to libs/net" into rvc-dev 2020-06-19 00:49:29 +00:00
Aaron Huang
69b06f9369 Merge "Address comments from aosp/1298476" am: 48fbda02b0 am: 76d4f3513f
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
1ff1653dbb Merge "Move DnsPacket to libs net" into rvc-dev am: 81f0fe48d2
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
76d4f3513f Merge "Address comments from aosp/1298476" am: 48fbda02b0
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
48fbda02b0 Merge "Address comments from aosp/1298476" 2020-06-18 10:18:57 +00:00
Lorenzo Colitti
81f0fe48d2 Merge "Move DnsPacket to libs net" into rvc-dev 2020-06-18 10:14:47 +00:00
Luke Huang
51221efa45 Move DnsPacket to libs net
This class might be used by some mainline modules.

Bug: 151052811
Test: atest DnsPacketTest
Test: atest DnsResolverTest
Change-Id: I8841d91456952ded5efbf8ea221289aecc7746ad
2020-06-18 16:17:04 +08:00
Aaron Huang
69bfb5afea Address comments from aosp/1298476
This patch addresses the followings,
- Pass Looper to NetworkStatsSubscriptionsMonitor constructor
- Replace Looper with TestLooper in unit test
- Assert fail if result of condition check is not expected.

Bug: 154080205
Test: atest FrameworksNetTests:com.android.server.net.NetworkStatsServiceTest
      atest FrameworksNetTests:com.android.server.net.NetworkStatsSubscriptionsMonitorTest
Change-Id: Ibcaba2b38af80cc0ec9a4e428a3b3a1538bc4325
2020-06-18 15:05:19 +08:00
Aaron Huang
c98228cf54 Merge "Dynamically enable/disable watch for RAT type changes" am: 3fdad73a32 am: cc1d6b13d6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1315574

Change-Id: I5a96774ad2104a6b03c9abab2b105b97195edea8
2020-06-18 04:22:21 +00:00
Aaron Huang
cc1d6b13d6 Merge "Dynamically enable/disable watch for RAT type changes" am: 3fdad73a32
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1315574

Change-Id: Id5c4ad325779322bbf4881816235904a6d454583
2020-06-18 04:09:37 +00:00
Aaron Huang
3fdad73a32 Merge "Dynamically enable/disable watch for RAT type changes" 2020-06-18 03:51:51 +00:00
Luke Huang
f12eff79db Merge "Disable sockets and DNS if process lacks INTERNET permission." into rvc-dev am: bbcd3b326b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11881939

Change-Id: I7c285a848ac947e0acf1acc8bc32f3ece3456412
2020-06-18 03:23:46 +00:00
Luke Huang
bbcd3b326b Merge "Disable sockets and DNS if process lacks INTERNET permission." into rvc-dev 2020-06-18 03:03:06 +00:00
Luke Huang
5a42a4132f 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
Change-Id: If002280fbad493dfc2db3d9d505c0257d49a9056
Exempt-From-Owner-Approval: OWNERS already approved identical patchset 5
2020-06-18 03:02:06 +00:00
TreeHugger Robot
3f7a4b9254 [automerger skipped] Merge "Set correct owner UID for VPN agentConnect()" into rvc-dev am: 65efcc84a0 -s ours
am skip reason: Change-Id Ic979dad73983d722365849fbfb0becfd432b894c with SHA-1 bf004e9830 is in history

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

Change-Id: I7df1004e885ff680a48d57e41987eb12f990875c
2020-06-17 15:35:35 +00:00
TreeHugger Robot
49d46b6c1f [automerger skipped] Merge "Treat RouteInfo with different interfaces as different routes" into rvc-dev am: 70e3f56147 -s ours
am skip reason: Change-Id I57987233d42a0253eaee2e1ca5f28728c2354620 with SHA-1 bc4c5caa4f is in history

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

Change-Id: I0b5d3d42ac9310e71262a7e8cf21af51b75837c4
2020-06-17 15:34:30 +00:00
TreeHugger Robot
65efcc84a0 Merge "Set correct owner UID for VPN agentConnect()" into rvc-dev 2020-06-17 15:26:22 +00:00
Treehugger Robot
58897cc491 Treat RouteInfo with different interfaces as different routes
On Android different interfaces usually use different routing tables.
As a result, a change in interface should not be treated as route
update, but rather a remove and an add.

This change fixes a bug in VPN seamless handover where routes
failed to be updated when a new tunnel interface replaces the existing
one within the same network.

Bug: 158696878
Test: atest com.android.cts.net.HostsideVpnTests
Test: atest NetworkStackTests
Test: atest CtsNetTestCases
Test: atest FrameworksNetTests
Original-Change: https://android-review.googlesource.com/1331916
Merged-In: I57987233d42a0253eaee2e1ca5f28728c2354620
Change-Id: I57987233d42a0253eaee2e1ca5f28728c2354620
2020-06-17 13:34:11 +00:00
Treehugger Robot
7a49a3b538 Merge "Treat RouteInfo with different interfaces as different routes" am: d77e15c125 am: 157191f50f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1331916

Change-Id: I2f4d88aa74588e8ed27c5d0abcb9a6919f26f27d
2020-06-17 13:21:06 +00:00
Treehugger Robot
157191f50f Merge "Treat RouteInfo with different interfaces as different routes" am: d77e15c125
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1331916

Change-Id: Ibe919ea7c2096094fdb48fc91881d9f19678ac50
2020-06-17 13:07:42 +00:00
Treehugger Robot
d77e15c125 Merge "Treat RouteInfo with different interfaces as different routes" 2020-06-17 12:51:08 +00:00
Rubin Xu
bc4c5caa4f Treat RouteInfo with different interfaces as different routes
On Android different interfaces usually use different routing tables.
As a result, a change in interface should not be treated as route
update, but rather a remove and an add.

This change fixes a bug in VPN seamless handover where routes
failed to be updated when a new tunnel interface replaces the existing
one within the same network.

Bug: 158696878
Test: atest com.android.cts.net.HostsideVpnTests
Test: atest NetworkStackTests
Test: atest CtsNetTestCases
Test: atest FrameworksNetTests
Change-Id: I57987233d42a0253eaee2e1ca5f28728c2354620
2020-06-17 12:01:41 +01:00
Aaron Huang
43b76f917e [automerger skipped] Merge "Add unit test for NetworkStatsSubscriptionsMonitor" am: 0543f2328d am: 032d132e50 -s ours
am skip reason: Change-Id I4ef3f1ab2e5ea1322133edd80db3ccd0022e9c91 with SHA-1 a8eab54eee is in history

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

Change-Id: I11b25c0832d6959e77bbabbfce53cdedce922279
2020-06-17 09:21:52 +00:00
Aaron Huang
032d132e50 Merge "Add unit test for NetworkStatsSubscriptionsMonitor" am: 0543f2328d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1298476

Change-Id: I1b191cd4706a7409794d382bda95ef6933b019a1
2020-06-17 09:09:13 +00:00
Aaron Huang
0543f2328d Merge "Add unit test for NetworkStatsSubscriptionsMonitor" 2020-06-17 08:52:20 +00:00
Aaron Huang
7558938ce9 Dynamically enable/disable watch for RAT type changes
Add ContentObserver to observe the status of
NETSTATS_COMBINE_SUBTYPE_ENABLED to determine that
NetworkStatsSubscriptionsMonitor start or stop
monitoring data usage per RAT type changes.

Bug: 154080515
Test: atest NetworkStatsServiceTest#testDynamicWatchForNetworkRatTypeChanges
Change-Id: I272d589633c9186b45753228b05aa0b40b7c7b89
2020-06-17 17:09:10 +09:00
TreeHugger Robot
c3a780339a [automerger skipped] Merge "Test extra info sent to NetworkMonitor" into rvc-dev am: 8202b399da -s ours
am skip reason: Change-Id I4f827664c528bea30cc957a0a617dd37693f4460 with SHA-1 301bc7b40a is in history

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

Change-Id: I63ad698bb29d3770e879f27b155a9fc656a80836
2020-06-16 03:28:39 +00:00
Chiachang Wang
1182d5a7fc Test extra info sent to NetworkMonitor
Test extra info sent to NetworkMonitor correctly if network
agent is created through new NetworkAgent constructor without
legacy network info taken as parameter.

Bug: 156173829
Test: atest FrameworkNetTests
Merged-In: I4f827664c528bea30cc957a0a617dd37693f4460
Change-Id: I4f827664c528bea30cc957a0a617dd37693f4460
2020-06-16 01:57:46 +00:00