Commit Graph

2350 Commits

Author SHA1 Message Date
Jeff Sharkey
4610b32762 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: I53003332717baf57dc088b2f6b969cdb1863f65e
2020-09-14 09:59:01 -06:00
Xin Li
37db1eb217 Merge RP1A.200720.011
Bug: 167588565
Merged-In: Iec7a26ecd68aca9c7a38cc8f441197a8237b0c8c
Change-Id: Ia8f5f008bc1f77115b644ab996aedc892fab68e7
2020-09-02 12:34:37 -07:00
Xin Li
4afc1e6669 Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: I3d92a6de21a938f6b352ec26dc23420c0fe02b27
Change-Id: Ifdb80563ef042738778ebb8a7581a97c4e3d96e2
2020-08-31 21:21:38 -07:00
Junyu Lai
c4aaac8af6 Merge "Notify the keepalive is stopped after the slot has been released" 2020-08-28 10:12:44 +00:00
junyulai
75125f2131 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
2020-08-20 11:00:08 +08:00
Chalard Jean
6f82a0f220 Revert "Revert "Move Inet[4]AddressUtils to libs/net"" am: 059356d83f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1382497

Change-Id: Ia5e7e926bc3a9af8b03f8970738e6abe4c6d15b6
2020-08-07 06:59:26 +00:00
Chalard Jean
059356d83f Revert "Revert "Move Inet[4]AddressUtils to libs/net""
This patch is still needed and should go in now that the
error is fixed.
The patch was submitted into rvc-dev and is already in
rvc-dev-plus-aosp (patch in in ag/11923559, revert
skipped in ag/12072199). A follow-up will remove the
unused services.net-module-wifi target.

Test: originally tested in aosp/1324109
Test: m; manual: flashed, wifi and telephony working
Test: atest NetworkStackCoverageTests
Change-Id: I1074eedb0b0f156a1135e11210ec102de15ea674
Merged-In: Icd141a992c46290c74929785e261a1cd57bc001b
2020-08-07 03:31:04 +00:00
Alex Light
d9b1b9daeb Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 162536543
Test: Treehugger
Change-Id: I971050a2665c177870ff257bd0f41343db702892
Merged-In: I971050a2665c177870ff257bd0f41343db702892
2020-08-03 17:04:58 +00:00
Alex Light
2349cf350b Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for reference

Bug: 162536543
Test: Treehugger
Change-Id: I971050a2665c177870ff257bd0f41343db702892
2020-07-31 08:18:33 -07:00
Lorenzo Colitti
1c9c0c1514 Set the NetworkInfo subtype to 0.
For non-telephony networks, this was always set to 0 before R.
In R, it is currently set to the same value as the network type.
This is incorrect because the two have different namespaces.
or example, currently, any network of type WIFI (==1) will have
a subtype of NETWORK_TYPE_GPRS (==1). Similarly, all ETHERNET
networks will have subtype NETWORK_TYPE_1XRTT, all VPN networks
will have a subtype of NETWORK_TYPE_TD_SCDMA, etd.

Bug: 161653721
Test: builds, boots
Change-Id: I07e111c1762e0021c931cefc27f193f78578748b
(cherry picked from commit a40ff70cad00a6c298e07c2c38e95d58074a7157)
2020-07-29 04:04:42 +00:00
Junyu Lai
ca54fa5a5c Merge "Gracefully handle integer overflows." am: cdb1f03144 am: fe6c5793ce
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
cdb1f03144 Merge "Gracefully handle integer overflows." 2020-07-29 01:19:07 +00:00
Lorenzo Colitti
fddfe676fd Set the NetworkInfo subtype to 0. am: fd43392b25
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12246826

Change-Id: Ida8cd0788ae34f4861fbcb958163b5074258c6ac
2020-07-28 18:05:15 +00:00
Chiachang Wang
6d70190fcd Merge "Update language to comply with Android's inclusive language guidance" am: f702025bdf am: ef723b7617
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
f702025bdf Merge "Update language to comply with Android's inclusive language guidance" 2020-07-28 10:51:53 +00:00
Lorenzo Colitti
fd43392b25 Set the NetworkInfo subtype to 0.
For non-telephony networks, this was always set to 0 before R.
In R, it is currently set to the same value as the network type.
This is incorrect because the two have different namespaces.
or example, currently, any network of type WIFI (==1) will have
a subtype of NETWORK_TYPE_GPRS (==1). Similarly, all ETHERNET
networks will have subtype NETWORK_TYPE_1XRTT, all VPN networks
will have a subtype of NETWORK_TYPE_TD_SCDMA, etd.

Bug: 161653721
Test: builds, boots
Change-Id: I07e111c1762e0021c931cefc27f193f78578748b
2020-07-28 09:20:19 +00:00
Chiachang Wang
3b9549f408 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
e55ab87e5d 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
Aaron Huang
8f98e732a0 Merge "Remove ProxyInfo(String) and update callers to use ProxyInfo(Uri)" am: c36f17d32e am: 5463bbece5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1146757

Change-Id: If60a348768c507153c1a9038953b2f6c29fc8f03
2020-07-17 06:05:38 +00:00
Aaron Huang
c36f17d32e Merge "Remove ProxyInfo(String) and update callers to use ProxyInfo(Uri)" 2020-07-17 05:40:31 +00:00
Chalard Jean
9aa3127449 Add some more public doc for MacAddress
Bug: 140807677
Test: doc-only change
Original-Change: https://android-review.googlesource.com/1354447
Merged-In: I0f6e59eda42fd92ec34db0e9bc2d26d2e83d41d0
Change-Id: I0f6e59eda42fd92ec34db0e9bc2d26d2e83d41d0
2020-07-08 09:38:37 +00:00
Chalard Jean
074d5a8e8a Merge "Add some more public doc for MacAddress" am: a9c0a7e2e2 am: 3b3c6ffdc2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1354447

Change-Id: I5c9061fa832c75c9e0476c54bacec3deb114a96d
2020-07-08 05:38:59 +00:00
Aaron Huang
ffb76492e0 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
2020-07-06 11:59:27 +00:00
Chalard Jean
ded38fda42 Add some more public doc for MacAddress
Bug: 140807677
Test: doc-only change
Change-Id: I0f6e59eda42fd92ec34db0e9bc2d26d2e83d41d0
2020-07-04 09:01:58 +09:00
Chalard Jean
064d18d188 Revert "Move Inet[4]AddressUtils to libs/net"
This reverts commit c98e38195d.

Reason for revert: Breaks the build b/160390899

Merged-In: Icd141a992c46290c74929785e261a1cd57bc001b
Change-Id: Ie10e66f61393602f17fbb61bf17230b176bf1f44
2020-07-02 23:47:35 +00:00
Remi NGUYEN VAN
c98e38195d Move Inet[4]AddressUtils to libs/net
The classes should not be picked up from frameworks/base, as they are
part of several mainline modules.

Also refine comments in DhcpResults following feedback in previous
change.

(cherry-pick from internal branch skipping wifi classes; no other
conflict)

Bug: 151052811
Test: m; manual: flashed, wifi and telephony working
Test: atest NetworkStackCoverageTests
Merged-In: I7074651c6a2a7a6b11bcf13cc4bb03833d7d655f

Change-Id: I7074651c6a2a7a6b11bcf13cc4bb03833d7d655f
2020-07-02 10:52:31 +09:00
Orion Hodson
9ee9dcf07e 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
Luke Huang
9f5ade331a Merge "Disable sockets and DNS if process lacks INTERNET permission." 2020-06-24 18:42:08 +00:00
Orion Hodson
1c962a802f 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 14:13:49 +01:00
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
Luke Huang
caaee1d0ec 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
ff0dc5cf49 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
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
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
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
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
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
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
Benedict Wong
b001522433 Set correct owner UID for VPN agentConnect()
This commit changes agentConnect to set the owner UID as the mOwnerUid
field instead of the Binder.getCallingUid().

Binder.getCallingUid() can return incorrect results for platform VPNs,
as agentConnect() is called under a clean calling UID.

Additionally, this relaxes the ownerUid sanitization check to allow a
VPN network's owner to see it's own ownership information.

Vpn.mOwnerUid is guaranteed to be correct, as all VPNs MUST have called
prepareInternal() at some previous point, which sets mOwnerUid as the
package's UID (or SYSTEM_UID if this is legacy VPN).

Bug: 150135470
Test: CTS tests showing ownership information
Merged-In: Ic979dad73983d722365849fbfb0becfd432b894c
Change-Id: Ic979dad73983d722365849fbfb0becfd432b894c
(cherry picked from commit e29bf99a7fc1067c546d7fa6cbcb9001fb110d16)
2020-06-16 01:42:48 +00:00
Benedict Wong
d01a9458ed Merge "Set correct owner UID for VPN agentConnect()" am: 2f7bb517fd am: bab1782868
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1326493

Change-Id: I5ff673d97fe4558da77575b2cc8c43b87e3673f6
2020-06-15 17:33:33 +00:00
Benedict Wong
2f7bb517fd Merge "Set correct owner UID for VPN agentConnect()" 2020-06-15 17:09:46 +00:00
Remi NGUYEN VAN
c3884937e1 Move Inet[4]AddressUtils to libs/net
The classes should not be picked up from frameworks/base, as they are
part of several mainline modules.

Also refine comments in DhcpResults following feedback in previous
change.

Bug: 151052811
Test: m; manual: flashed, wifi and telephony working
Test: atest NetworkStackCoverageTests
Change-Id: I7074651c6a2a7a6b11bcf13cc4bb03833d7d655f
2020-06-12 17:04:06 +09:00
Chalard Jean
cece40543e Document the limitation to a hundred callbacks.
Some developers have been surprised by this limitation and had trouble
figuring out what the issue was. Add documentation to address this.

This also includes a drive-by removal of a duplicate check.

Bug: 149867479
Test: doc-only change
Original-Change: https://android-review.googlesource.com/1313813
Merged-In: I5911d01984695550b6c9afe7a8eb535bf5e320a1
Change-Id: I5911d01984695550b6c9afe7a8eb535bf5e320a1
2020-06-12 00:35:39 +00:00