Commit Graph

2338 Commits

Author SHA1 Message Date
Paul Hu
154341cb4b Merge "[RFPM03] Check permission by uid." am: ce4d7d9493 am: a33a3a3a74 am: 608d002021 am: f6d7721f63 am: c6ec125732
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1320375

Change-Id: Iee10248986fe1bda9fa97e6ae387e5ca4ec557c6
2020-07-29 06:46:16 +00:00
Paul Hu
608d002021 Merge "[RFPM03] Check permission by uid." am: ce4d7d9493 am: a33a3a3a74
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1320375

Change-Id: I80406643e4797b1e269b4f7c5711339371fa533b
2020-07-29 05:53:25 +00:00
Paul Hu
ce4d7d9493 Merge "[RFPM03] Check permission by uid." 2020-07-29 05:41:32 +00:00
Junyu Lai
62b56d26ef Merge "Gracefully handle integer overflows." am: a308f79353 am: aeddf47458 am: a2a1e552cf am: 85c6bdbbeb am: 076ffecd31
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1316217

Change-Id: I7c04b66f75f64c214bd0c8d27bb5dbeda13094ce
2020-07-29 02:58:33 +00:00
Junyu Lai
a2a1e552cf Merge "Gracefully handle integer overflows." am: a308f79353 am: aeddf47458
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1316217

Change-Id: I0bba17d0367ebf4e1c868a8cc7471366bc7a4408
2020-07-29 01:55:23 +00:00
Junyu Lai
a308f79353 Merge "Gracefully handle integer overflows." 2020-07-29 01:19:07 +00:00
Chiachang Wang
bf875c99aa Merge "Update language to comply with Android's inclusive language guidance" am: 19c3b6dd6c am: 55c0d6e638 am: 41d7c54142 am: 7583a24fd3 am: c08f23849a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1373160

Change-Id: Ideecaaaa12e82c5771e75d0c743228f6478e1ca3
2020-07-28 12:03:04 +00:00
Chiachang Wang
41d7c54142 Merge "Update language to comply with Android's inclusive language guidance" am: 19c3b6dd6c am: 55c0d6e638
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1373160

Change-Id: I9318abb0233e7b8847466914724eeaae769ea9c8
2020-07-28 11:19:47 +00:00
Chiachang Wang
19c3b6dd6c Merge "Update language to comply with Android's inclusive language guidance" 2020-07-28 10:51:53 +00:00
paulhu
ab4ad20eef [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
2020-07-28 18:23:38 +08:00
Chiachang Wang
9da868b59a 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
Change-Id: I6c3c03c0c2d1302af6d5245486823c13a3432900
2020-07-28 15:36:30 +08:00
Pavan Kumar M
3708b68405 Gracefully handle integer overflows.
Avoid recording negative data by doing integer-based
math as much as possible, but switch to double-based
math if we detect that we'd end up causing an overflow.

Test :

    - Builds, Boots
    - High data throughput scenarios
    - NetworkStatsHistoryTest, NetworkStatsCollectionTest,
      NetworkStatsTest

Bug: 119527458
Change-Id: I55d4aa649bea3ae201ad513074ff2b71cb918dad
2020-07-28 11:36:49 +05:30
Treehugger Robot
2c50b0efd7 Merge "Attribute data usage to virtual RAT type for 5G non-standalone mode" am: 88f47d4d32 am: 416911a122
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1364497

Change-Id: Idef0dd6e0e0486b76c0067540e580d444e97d6a0
2020-07-16 12:09:04 +00:00
junyulai
20b027ed2b Attribute data usage to virtual RAT type for 5G non-standalone mode
Test: atest NetworkStatsSubscriptionsMonitorTest#test5g
Bug: 160727498
Change-Id: I8753e68140c0993773017c9a49bd8a666a364071
Merged-In: I8753e68140c0993773017c9a49bd8a666a364071
(cherry-picked from ag/12167624)
2020-07-16 18:22:09 +08:00
junyulai
1b6ad1403b Attribute data usage to virtual RAT type for 5G non-standalone mode
Test: atest NetworkStatsSubscriptionsMonitorTest#test5g
Bug: 160727498
Change-Id: I8753e68140c0993773017c9a49bd8a666a364071
2020-07-16 15:32:01 +08:00
Treehugger Robot
02d2922f84 Merge "Revert "Attribute data usage to 5G for 5G non-standalone mode"" am: 13c5ee8313 am: 56df7e2c1a am: add913a0ae am: d53e749e8a am: 2fc2a3b3a3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1360157

Change-Id: I6dfb1ec8e41adf39dce5361389e471e83425bc4e
2020-07-10 06:17:03 +00:00
Treehugger Robot
add913a0ae Merge "Revert "Attribute data usage to 5G for 5G non-standalone mode"" am: 13c5ee8313 am: 56df7e2c1a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1360157

Change-Id: If052329128326fba72ff27c024a2c6652b7bb1ef
2020-07-10 05:41:05 +00:00
Junyu Lai
bacab2c04b Merge "Attribute data usage to 5G for 5G non-standalone mode" am: c987a53a93 am: b2cd1cf130 am: 09b7371d80 am: bf8e96d3ec am: 57b7cba0ca
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1359203

Change-Id: Ifde023200e39995411932a44716a3eeb6daea542
2020-07-10 03:45:23 +00:00
Junyu Lai
b6dc1c1f92 Revert "Attribute data usage to 5G for 5G non-standalone mode"
This reverts commit edcaa70be2.

Reason for revert: Revert and wait for the design is settled down.

Change-Id: I10fdfc37d6456678de1886698cd6ad08bf8aa810
2020-07-10 03:43:19 +00:00
Junyu Lai
09b7371d80 Merge "Attribute data usage to 5G for 5G non-standalone mode" am: c987a53a93 am: b2cd1cf130
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1359203

Change-Id: I860b0226157ee31f0488d6b2252ae157e86dc5eb
2020-07-10 03:10:15 +00:00
junyulai
edcaa70be2 Attribute data usage to 5G for 5G non-standalone mode
Test: atest NetworkStatsSubscriptionsMonitorTest#test5g
Bug: 160727498

Change-Id: I563df14500caeb3602b381479afaf5163ad8e6a1
2020-07-09 16:56:54 +08:00
Paul Hu
07be735444 Merge "[RFPM02] Add Dependencies class for injection in tests." am: b95025b2ba am: a99e0b1b95 am: 95f39d34d4 am: 472d6dfa22 am: 5fc8e40e15
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1318291

Change-Id: I487c0a86d7b572b568c0b91b20624b234668e164
2020-07-08 11:15:40 +00:00
Paul Hu
95f39d34d4 Merge "[RFPM02] Add Dependencies class for injection in tests." am: b95025b2ba am: a99e0b1b95
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1318291

Change-Id: If53e1521327c8d9f1fd2a5debb94c58ed25b2880
2020-07-08 10:35:21 +00:00
paulhu
d7c5c46776 [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
2020-07-08 15:30:42 +08:00
Chalard Jean
ca36871d15 Merge "Revert "Test IPv6ProvisioningLossParcelable in the NetworkAttrib..."" am: 1c108ffb25 am: f806795991 am: 23ce57f73e am: 9b4373b519 am: 160d1f0233
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1353491

Change-Id: Ifd265eda7e5cd9c9d66cd19394bdb3c881dc5d16
2020-07-01 06:08:18 +00:00
Chalard Jean
23ce57f73e Merge "Revert "Test IPv6ProvisioningLossParcelable in the NetworkAttrib..."" am: 1c108ffb25 am: f806795991
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1353491

Change-Id: Ibc8d633a6e04f7cd0f4c1a0d02ae586232cc0c6a
2020-07-01 05:33:41 +00:00
Chalard Jean
3740bfadad Revert "Test IPv6ProvisioningLossParcelable in the NetworkAttrib..."
Revert "Add new network quirk parcelable in the NetworkAttributes."

Revert submission 1323251-ipv6_prov_loss_quirk_parcelable

Reason for revert: Breaks CtsStrictJavaPackagesTestCases
Reverted Changes:
I18e05c09f:Add new network quirk parcelable in the NetworkAtt...
I8dbff2377:Test IPv6ProvisioningLossParcelable in the Network...

Change-Id: Ie906919b344131cd768fbed787248d3caac2f74d
2020-07-01 01:46:26 +00:00
Xiao Ma
4619e486e5 Merge "Test IPv6ProvisioningLossParcelable in the NetworkAttributes." am: a4ddee215e am: a577c275d5 am: eb4cdbfe9c am: 309aa2d33d am: be3028ac5b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1322637

Change-Id: I39c6ea15ae901c7ad6a90bee5caa6064ac09847b
2020-06-29 12:56:08 +00:00
Paul Hu
a973eb60e3 Merge "[RFPM01] Merge package added/removed methods" am: 97c80a0e2f am: 97133b97ae am: 1d59118500 am: befbe7f72c am: a523acbda4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1317236

Change-Id: I8b789c3cb90357a6d408565201d80a13fad92587
2020-06-29 12:54:41 +00:00
Xiao Ma
eb4cdbfe9c Merge "Test IPv6ProvisioningLossParcelable in the NetworkAttributes." am: a4ddee215e am: a577c275d5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1322637

Change-Id: Iaf964024c44e6b78ccb3b8fcf3fc131479747a81
2020-06-29 12:17:26 +00:00
Paul Hu
1d59118500 Merge "[RFPM01] Merge package added/removed methods" am: 97c80a0e2f am: 97133b97ae
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1317236

Change-Id: Ida8f82d2ec5be1040a2bdf2aa65a94d53f68ea6c
2020-06-29 12:16:47 +00:00
Xiao Ma
fc889a6dd0 Test IPv6ProvisioningLossParcelable in the NetworkAttributes.
Bug: 157534516
Test: atest FrameworksNetTests
Change-Id: I8dbff2377457bb8fd0f447be0a3cda9af952f2a2
2020-06-29 11:57:32 +00:00
Paul Hu
97c80a0e2f Merge "[RFPM01] Merge package added/removed methods" 2020-06-29 11:50:57 +00:00
Luke Huang
bea02c1460 Merge "Disable sockets and DNS if process lacks INTERNET permission." 2020-06-24 18:42:08 +00:00
Luke Huang
3cd122f485 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
f08f9d4bd7 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
679ff2b501 [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
TreeHugger Robot
5d8ff46bda Merge "Update DnsManagerTest for AIDL interface change" into rvc-dev am: ee9ca628ca am: e585912db3 am: 84f2eb10e7 am: 9260b81d86
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11954238

Change-Id: I21129279b6ac94bebb55e0798e0da12ef5a0b5eb
2020-06-22 16:00:44 +00:00
TreeHugger Robot
e585912db3 Merge "Update DnsManagerTest for AIDL interface change" into rvc-dev am: ee9ca628ca
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
0dcddd3b06 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
ee9ca628ca Merge "Update DnsManagerTest for AIDL interface change" into rvc-dev 2020-06-22 15:09:54 +00:00
Ken Chen
125db20ee5 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
Mike Yu
1a5e45e37d 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
Mike Yu
92fa8805da Merge "Support DNS-over-TLS probes in NetworkDiagnostics" am: 64ffa1762f am: 00a89d0481 am: 075dccdc96 am: aa4a2e335f am: 7491639dd4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1011670

Change-Id: Ica4a8e861c60ba00d7ff80f4a6564ac411a12f8b
2020-06-22 07:33:11 +00:00
Mike Yu
075dccdc96 Merge "Support DNS-over-TLS probes in NetworkDiagnostics" am: 64ffa1762f am: 00a89d0481
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
6a49d466d2 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
Aaron Huang
f31016223a Merge "Address comments from aosp/1298476" am: 777fbbb954 am: eb276cb5b3 am: a12b3d3626 am: b9e62de14f am: 6424968d64
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1340040

Change-Id: I29d735d0edb861fc154568aaf0e63a4ae2f9b441
2020-06-18 11:25:23 +00:00
Lorenzo Colitti
30370c23d4 Merge "Move DnsPacket to libs net" into rvc-dev am: db056d4043 am: 7f7e19eda5 am: a9095c04b9 am: ac253d354f
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11862407

Change-Id: Ida1e72cf4d56b175ba2121fd8ed06b3701aad770
2020-06-18 11:23:50 +00:00
Aaron Huang
a12b3d3626 Merge "Address comments from aosp/1298476" am: 777fbbb954 am: eb276cb5b3
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
7f7e19eda5 Merge "Move DnsPacket to libs net" into rvc-dev am: db056d4043
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11862407

Change-Id: Ia19cb44ad56e4358c63564261d481459d1386542
2020-06-18 10:34:11 +00:00