Commit graph android_packages_modules_Co.../core/java/android
Message SHA1
Merge "Move NetworkAgent#register to a new method."
Aaron Huang   authored and   Gerrit Code Review   commited 2020-03-03 03:37:07 +00:00
5d61bc285d
Merge "Remove framework code that has moved to frameworks/libs/net"
Aaron Huang   authored and   Gerrit Code Review   commited 2020-03-02 06:23:44 +00:00
fcca217a94
Merge "Always set NetworkInfo objects to available."
Aaron Huang   authored and   Gerrit Code Review   commited 2020-03-02 04:53:10 +00:00
e8a5275bc9
Move NetworkAgent#register to a new method.
Calling IPC in a constructor is unusual and confusing, and can be
considered bad form. There are multiple reasons for this :
• Users can't obtain an instance of the class without calling the
  constructor, but they can't always afford an IPC where they need
  this, forcing them to know about the implementation detail and
  sometimes design around it.
• On a related but generalized note, constructors should usually
  be fast for the same range of reasons.
• Having a separate method to register the agent simply gives more
  flexibility to the app.
• It's also a lot easier to test.
But also we can't fix it without an update to the API, so here it is.

Another reason for doing this is consistency with the NetworkProvider
API.

Bug: 138306002
Bug: 139268426
Test: atest FrameworksNetTests FrameworksWifiTests FrameworksTelephonyTests
Change-Id: I1ee5c7b1353d581e487c8a8a159009bebd781643
Merged-In: I1ee5c7b1353d581e487c8a8a159009bebd781643
(clean cherry-pick from internal branch)

Chalard Jean   authored and   Aaron Huang   commited 2020-02-21 14:54:18 +08:00
5863a71547
Add methods to send connected/disconnected state.
Also add methods to set the legacy subtype and the APN name.
These have to be added together because they have to be used
together.

Bug: 138306002
Bug: 139268426
Test: atest FrameworksNetTests FrameworksWifiTests FrameworksTelephonyTests
Change-Id: Ie90b8d290eab490061d5cb066744b67d597b9469
Merged-In: Ie90b8d290eab490061d5cb066744b67d597b9469
(clean cherry-pick from internal branch)

Chalard Jean   authored and   Aaron Huang   commited 2020-02-20 19:37:16 +08:00
3946b0ac1e
Merge "Sanitize owner UID iff owning app does not have location permissions."
Qingxi Li   authored and   Gerrit Code Review   commited 2020-02-20 05:20:27 +00:00
4d95254cb3
Sanitize owner UID iff owning app does not have location permissions.
This change adds permission checking to ensure that the following
conditions are enforced in order for apps to receive the owner UID:
1. The app must be the owner of the network
2. The app must hold the FINE_LOCATION permission/appop
3. The user must have their location toggle enabled.

Bug: 142072839
Test: atest FrameworksNetTests
Change-Id: I7a981a82f1219828ee89c8c96eb9d2efd153377f

Qingxi Li   commited 2020-02-20 01:02:42 +00:00
b274810c34
Always set NetworkInfo objects to available.
For all networks, NetworkInfo.isAvailble has basically always
been true for all connected networks. The new NetworkAgent API
sets it to false, and this causes application breakage. Always
set it to true.

Bug: 148126438
Test: builds, boots, searching in maps works again
Change-Id: Ia9876b0ce7f02120bd05cab526346cad22cf62b3
Merged-In: Ia9876b0ce7f02120bd05cab526346cad22cf62b3
(clean cherry-pick from internal branch)

Lorenzo Colitti   authored and   Aaron Huang   commited 2020-02-19 12:23:49 +00:00
23d813be73
Use framework-tethering-stub instead of framework-tethering
The non-updatable part of the platform now is built with
framework-tethering-stub, which is a stub library of
framework-tethering.

Bug: 147200698
Test: m
Change-Id: I97ef83f7f9b4c1376f373713036f5256318f1050
Merged-In: I97ef83f7f9b4c1376f373713036f5256318f1050

markchien   commited 2020-02-19 15:10:44 +08:00
2e6ba526c9
Remove framework code that has moved to frameworks/libs/net
Add srcs to framework and change import path.
Remove the codes which are moved to frameworks/libs/net.

Bug: 139268426
Bug: 135998869
Bug: 138306002
Bug: 143925787
Test: atest FrameworksNetTests
      atest FrameworksTelephonyTests
      ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh

Change-Id: I44e0a8361637c2d43be2e5d033d405b22e1a149c
Merged-In: I067cdc404e5a63947c19cb75069a39ae42faa3c8
Merged-In: Ieb8927f9af7f87a5ae038bd6c7daeb3d70117fef

Aaron Huang   commited 2020-02-18 13:52:35 +00:00
336f647ee2
Merge "Revert "Remove framework code that has moved to frameworks/libs/net""
Isabelle Taylor   authored and   Gerrit Code Review   commited 2020-02-14 13:42:37 +00:00
50e2cbde28
Revert "Remove framework code that has moved to frameworks/libs/net"
Revert "Use createRandomUnicastAddress from MacAddressUtils"

Revert "Add net-utils-framework-net to telephony-common"

Revert submission 1191997-net-utils-framework-net

Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?branch=git_qt-qpr1-dev-plus-aosp&target=aosp_taimen-userdebug&lkgb=6208131&lkbb=6208273&fkbb=6208273, bug b/149551544
Reverted Changes:
Ib1c807d64:Use createRandomUnicastAddress from MacAddressUtil...
I9e0f297e0:Add net-utils-framework-net to telephony-common
Ieb8927f9a:Remove framework code that has moved to frameworks...

Change-Id: I2824f781babd9f7e0bb9df524dadf6b8397dcaa1

Isabelle Taylor   commited 2020-02-14 13:09:16 +00:00
175627fafb
Merge "Remove framework code that has moved to frameworks/libs/net"
Aaron Huang   authored and   Gerrit Code Review   commited 2020-02-14 09:42:49 +00:00
0122cf102f
Enforce restricted user, getConnectionOwnerUid checks
This CL adds checks to ensure restricted users cannot change or
start/stop platform VPNs. In addition, this also adds checks to the
ConnectivityManager#getConnectionOwnerUid() to ensure that only
VpnService based VPNs can identify connections

Bug: 148040659
Test: FrameworksNetTests run
Change-Id: Id47ada5766036bfc84f3ba47f66f2d2683af916d

Benedict Wong   commited 2020-02-14 00:09:47 -08:00
0bd4bba07a
Merge "RELAND: NetworkRequest: Embed requestor uid & packageName"
Roshan Pius   authored and   Gerrit Code Review   commited 2020-02-14 01:57:49 +00:00
02d8578fc3
Merge "Add Intdef annotation for eventId in logEvent"
Chiachang Wang   authored and   Gerrit Code Review   commited 2020-02-13 10:44:57 +00:00
2ed536a7b6
Merge "Add permission check for CaptivePortal#reevaluateNetwork"
Chiachang Wang   authored and   Gerrit Code Review   commited 2020-02-13 06:41:53 +00:00
d0f3cb625e
Add Intdef annotation for eventId in logEvent
Follow API guide.

Bug: 148379628
Test: make test-api-stubs-docs-update-current-api \
      system-api-stubs-docs-update-current-api

Change-Id: I410ef06b2fa82d8ef35513086733b0fc2cf0fe06

Chiachang Wang   commited 2020-02-13 06:26:35 +00:00
2520c650cd
RELAND: NetworkRequest: Embed requestor uid & packageName
Add the requestorUid & requestorPackageName fields to
NetworkCapabilities. This is populated by CS when
a new network request is received.
These 2 requestor fields are also optionally used for network
matching. All of the regular app initiated requests will have the
requestor uid and package name set by connectivity service. Network
agents can optionally set the requestorUid and requestorPackageName
to restrict the network created only to the app that requested the network.

This will help removing the necessity for the various specifiers to embed
the uid & package name info in the specifier for network matching.

Note: NetworkSpecifier.assertValidFromUid() is deprecated & removed in
favor of setting the uid/package name on the agent to restrict the
network to a certain app (useful for wifi peer to peer API & wifi aware).

Bug: 144102365
Test: Verified that wifi network request related CTS verifier tests
pass.
Test: Device boots up and connects to wifi networks
Merged-In: I207c446108afdac7ee2c25e6bbcbc37c4e3f6529

Change-Id: I58775e82aa7725aac5aa27ca9d2b5ee8f0be4242

Roshan Pius   commited 2020-02-12 16:58:36 -08:00
08c94fb8a9
Merge "Revert "NetworkRequest: Embed requestor uid & packageName""
Roshan Pius   authored and   Gerrit Code Review   commited 2020-02-12 23:36:13 +00:00
948f0f9878
Revert "NetworkRequest: Embed requestor uid & packageName"
This reverts commit d499517306.

Reason for revert: b/149425896
Bug: b/149425896

Change-Id: I9fe31509c040cc421ccb00ea60f15e6f199e8bc6

Roshan Pius   commited 2020-02-12 23:33:43 +00:00
d85de75bfa
Merge "NetworkRequest: Embed requestor uid & packageName"
Qingxi Li   authored and   Gerrit Code Review   commited 2020-02-12 18:43:32 +00:00
7b59ec507c
Merge "Include NetworkCapabilities and LinkProperties in DataStallReport."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-02-12 16:38:38 +00:00
287c4adbc9
Add permission check for CaptivePortal#reevaluateNetwork
CaptivePortal#reevaluateNetwork is added as a system API which
requires a proper permission check.

Bug: 148379628
Test: Manually check with captive portal
Test: atest FrameworksNetTests
Test: make test-api-stubs-docs-update-current-api \
      system-api-stubs-docs-update-current-api

Change-Id: I3f974339d5bd53a6f6ecb0842c02a8264dc3a5f9
Merged-In: I559d42089aeb09801d14c251c5165fca793c3cb3

Chiachang Wang   commited 2020-02-12 11:29:24 +00:00
f7a0f125db
Fix invalid usage of javadoc
CP from ag/10125651

Test: this change removes invalid usage
Change-Id: Ibc9b1965ec7aa545c0dae71d741c3802d3a9fa12
Merged-In: I35fc4a814238635fa95981649c27230dda319afa

Aaron Huang   authored and   Chalard Jean   commited 2020-02-12 06:10:10 +00:00
c2b200e46b
NetworkRequest: Embed requestor uid & packageName
Add the requestorUid & requestorPackageName fields to
NetworkCapabilities. This is populated by CS when
a new network request is received.
These 2 requestor fields are also optionally used for network
matching. All of the regular app initiated requests will have the
requestor uid and package name set by connectivity service. Network
agents can optionally set the requestorUid and requestorPackageName
to restrict the network created only to the app that requested the network.

This will help removing the necessity for the various specifiers to embed
the uid & package name info in the specifier for network matching.

Note: NetworkSpecifier.assertValidFromUid() is deprecated & removed in
favor of setting the uid/package name on the agent to restrict the
network to a certain app (useful for wifi peer to peer API & wifi aware).

Bug: 144102365
Test: Verified that wifi network request related CTS verifier tests
pass.
Test: Device boots up and connects to wifi networks
Change-Id: I207c446108afdac7ee2c25e6bbcbc37c4e3f6529
Merged-In: I207c446108afdac7ee2c25e6bbcbc37c4e3f6529

Roshan Pius   authored and   Qingxi Li   commited 2020-02-12 04:42:58 +00:00
d499517306
Include NetworkCapabilities and LinkProperties in DataStallReport.
DataStallReport is updated to include the NetworkCapabilities and Link
Properties for the Network being reported on. This provides a more
complete picture of the Network conditions when the suspected data stall
was detected.

Bug: 148966398
Test: atest FrameworksNetTests
Change-Id: I913cf18c348b9f688f9d2a3d25a71bc94eb8f000

Cody Kesting   commited 2020-02-11 08:50:59 -08:00
f2852480a0
Add a systemapi constructor for NetworkAgent
Bug: 138306002
Bug: 139268426
Test: atest FrameworksNetTests FrameworksWifiTests FrameworksTelephonyTests
      make doc-comment-check-docs
Change-Id: I288ea32fac07a9a486e2ea451a2c9b098446a74c
Merged-In: I288ea32fac07a9a486e2ea451a2c9b098446a74c

Chalard Jean   authored and   Aaron Huang   commited 2020-02-11 16:26:10 +08:00
0900154ef5
Merge "Fix review comments on aosp/1213524"
Aaron Huang   authored and   Gerrit Code Review   commited 2020-02-11 03:33:08 +00:00
100e0b9a51
Fix review comments on aosp/1213524
This is necessary to avoid subsequent conflicts.

Test: none needed
Change-Id: I6e2cd9188e0e4bd7c71c6c56635f192dce73f325
Merged-In: I621cfbe165996c67b201ca2dd2f95a5ab9af10ee

Chalard Jean   authored and   Aaron Huang   commited 2020-02-10 08:28:04 +00:00
75a6104e2a
Merge "Fix typo in ConnectivityDiagnosticsManager constant."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-02-07 16:57:19 +00:00
1e304edffd
Merge "Implement INetworkMonitorCallbacks#notifyNetworkTestedWithExtras."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-02-05 19:55:05 +00:00
e10545c736
Implement INetworkMonitorCallbacks#notifyNetworkTestedWithExtras.
INetworkMonitorCallbacks defines notifyNetworkTestedWithExtras() for
notifying ConnectivityService of networks being tested along with a
PersistableBundle of extras. A new event is introduced for
NetworkStateTrackerHandler to notify the ConnectivityDiagnosticsHandler
before continuing with the normal processing for "network tested"
notifications. The event is also used in the
ConnectivityDiagnosticsHandler.

Bug: 143187964
Bug: 147391402
Test: compiles.
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: Iab29da790c0f5faae68227770bc3a84bbc94f124
Merged-In: Iab29da790c0f5faae68227770bc3a84bbc94f124

Cody Kesting   commited 2020-02-05 18:48:12 +00:00
83bb5fa762
Fix typo in ConnectivityDiagnosticsManager constant.
This change fixes a typo in the value assigned to the constant
KEY_NETWORK_PROBES_ATTEMPTED_BITMASK, which is defined in
ConnectivityDiagnosticsManager.ConnectivityReport.

Bug: 148939502
Test: compiles
Change-Id: I63863efa8c69593012bf4e95d896db192c6bfb5c

Cody Kesting   commited 2020-02-05 08:56:48 -08:00
c95f96910b
Merge "Add separate user consent for Platform VPNs"
Benedict Wong   authored and   Gerrit Code Review   commited 2020-02-04 23:56:16 +00:00
e2684df6ef
Add separate user consent for Platform VPNs
This change adds a new VPN user consent flow (using the same text) for
granting the lesser OP_ACTIVATE_PLATFORM_VPN. A new
PlatformVpnConfirmDialog is created as a subclass to preserve all logic,
but ensure the right appop is granted for the relevant dialog.

Intent extras were considered, but are inherently unsafe, since the
caller may add any extras that they would want.

Bug: 144246835
Test: FrameworksNetTests passing
Change-Id: Ia6f36207d43c3748f938430c2780dcf29e5623f3
Merged-In: Ia6f36207d43c3748f938430c2780dcf29e5623f3

Benedict Wong   commited 2020-02-04 21:05:36 +00:00
a73199168b
Merge changes I446a8595,I68d2293f
* changes:
  Add VpnManager calls to ConnectivityService
  Add basic logic for profile-based VPNs

Benedict Wong   authored and   Gerrit Code Review   commited 2020-02-03 22:31:37 +00:00
3914abccce
Merge "Update javadocs for ConnectivityDiagnosticsManager."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-02-03 14:56:13 +00:00
5b6967bc01
Merge "Add callback registration in ConnectivityService."
Cody Kesting   authored and   Gerrit Code Review   commited 2020-02-03 14:55:54 +00:00
29edc0ecc9
Remove framework code that has moved to frameworks/libs/net
Add srcs to framework and change import path.
Remove the codes which are moved to frameworks/libs/net.

Bug: 139268426
Bug: 135998869
Bug: 138306002
Bug: 143925787
Test: atest FrameworksNetTests
      atest FrameworksTelephonyTests
      ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: Ieb8927f9af7f87a5ae038bd6c7daeb3d70117fef
Merged-In: Ieb8927f9af7f87a5ae038bd6c7daeb3d70117fef

Aaron Huang   commited 2020-02-03 08:16:43 +00:00
5ff8baa340
Update javadocs for ConnectivityDiagnosticsManager.
ConnectivityDiagnosticsManager comments for
registerConnectivityDiagnosticsCallback and
unregisterConnectivityDiagnosticsCallback are updated to reflect several
changes.

For register calls, any app will be able to register callbacks, but only
permissioned applications will have their callbacks invoked (and only
for networks managed by the application). Additionally, only the
registering app (uid) will be able to unregister a callback once
registered.

Bug: 143187964
Test: docs change only. compiles.
Change-Id: Ie7ae86a1afccb22d6c84027dbac49d7b8e431e8c

Cody Kesting   commited 2020-01-31 09:49:25 -08:00
ad51e01b3c
Add callback registration in ConnectivityService.
ConnectivityDiagnosticsManager will send callbacks to
ConnectivityService for registering and unregistering them with the
system. ConnectivityService needs to do the processing for persisting
(and deleting) these callbacks on the ConnectivityService Thread, so
messages are sent to the Connectivity Diagnostics  Handler, which runs
on the ConnectivityService Thread.

Bug: 146444622
Bug: 143187964
Bug: 147848028
Test: compiles
Test: atest FrameworksNetTests
Change-Id: Ia5c8f90a60c050504e8676de9564a7607a9b03bc

Cody Kesting   commited 2020-01-31 09:42:05 -08:00
73708bff55
Add basic logic for profile-based VPNs
This change adds stubs for the Platform built-in VPNs, along with
implementing some basic permissions checks.

Bug: 144246837
Test: FrameworksNetTests passing, new tests added
Change-Id: I68d2293fc1468544f0d9f64d02ea7e1c80c8d18c

Benedict Wong   commited 2020-01-30 18:41:12 -08:00
df936cf1a7
NetworkAgent: Fix doc build fail by invalid tag
Bug: 138306002
Bug: 139268426
Test: make doc-comment-check-docs

Change-Id: I8b8df5096b90ad10545087ab09f68ecae637aa35
Merged-In: I8b8df5096b90ad10545087ab09f68ecae637aa35

markchien   authored and   Lorenzo Colitti   commited 2020-01-30 03:37:45 +00:00
e1322a8a8e
Make most of NetworkAgent @SystemApi.
Bug: 138306002
Bug: 139268426
Test: atest FrameworksNetTests FrameworksWifiTests FrameworksTelephonyTests
Test: atest android.net.cts.ConnectivityManagerTest
Change-Id: I856f01f02c35c2f6a886d8b98039e5dfbc48148b
Merged-In: I856f01f02c35c2f6a886d8b98039e5dfbc48148b
(cherry picked from commit 980ed12f7f)

sqian   commited 2020-01-29 16:45:03 -08:00
d60481ce20
API changes for IPv6 MTU support
Change mtu->mtuV4 and add mtuV6 for DataProfile and DataCallResult
Add mtu to RouteInfo and update test

Test: atest FrameworksTelephonyTests
Bug: 146668814
Change-Id: I43c7e088e46e40f38d8114548e0fc4e39d7f91cb
Merged-In: I43c7e088e46e40f38d8114548e0fc4e39d7f91cb

Sarah Chin   authored and   Lorenzo Colitti   commited 2020-01-30 00:17:19 +09:00
f75d09fac1
Fixed the documentation and unit tests
Fixed the documentation and re-eanble the
broken unit tests.

Test: LinkAddressTest
Bug: 142949345
Merged-In: I0ac8c022f70cdf9305c183996c2464a8e04ba5ae
Change-Id: I0ac8c022f70cdf9305c183996c2464a8e04ba5ae
(cherry picked from commit b67261b01c)

Jack Yu   commited 2020-01-26 21:37:36 -08:00
d956e5b326
Added expiration time and deprecation time support
Added link address deprecation time and expiration
time for SSC mode 3 support.

Bug: 135717900
Bug: 142949345
Test: LinkAddressTest

Merged-In: Ibc030d2a70ded66e00dd3bdae209609b9118de78
Change-Id: Ibc030d2a70ded66e00dd3bdae209609b9118de78
(cherry picked from commit 05d5b3b59f)

Jack Yu   commited 2020-01-26 21:32:12 -08:00
590d408a06
Merge "Fix javadoc build break s/line/link/"
Cody Kesting   authored and   Gerrit Code Review   commited 2020-01-24 18:37:51 +00:00
08efffc46e
Merge "Add API for apps to check if they are the network owner"
Qingxi Li   authored and   Gerrit Code Review   commited 2020-01-24 18:12:52 +00:00
78433a68ee