Commit Graph

756 Commits

Author SHA1 Message Date
Chalard Jean
d89e56da6b Add documentation
Bug: 185121472
Test: doc-only change
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: I5fd68b209959043f6fe15ac34629c51233fea596
Change-Id: I5fd68b209959043f6fe15ac34629c51233fea596
  (cherry-picked from ag/14186082)
2021-06-08 00:17:37 +00:00
Chalard Jean
0422927cd8 Add doc for NetworkScore#getLegacyInt
Test: comment-only change
Fixes: 184786246
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: I8306f01f3d247986683e272074047e3ad190f68e
Change-Id: I8306f01f3d247986683e272074047e3ad190f68e
  (cherry-picked from ag/14125152)
2021-06-08 00:17:36 +00:00
Chalard Jean
536a5bac26 Expose sendNetworkScore that takes a NetworkScore
Bug: 167544279
Test: FrameworksNetTests
CTS-Coverage-Bug: 184037351
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: I5dd9b526c53cb99a5e4ae87f1e3724a7a1870e78
Change-Id: I5dd9b526c53cb99a5e4ae87f1e3724a7a1870e78
  (cherry-picked from ag/14048551)
2021-06-08 00:17:36 +00:00
lucaslin
53e8a267ab Send a proxy broadcast when apps moved from/to a VPN
When the apps moved from/to a VPN, a proxy broadcast is needed to
inform the apps that the proxy might be changed since the default
network satisfied by the apps might also changed.
Since the framework does not track the defautlt network of every
apps, thus, this is done when:
  1. VPN connects/disconnects.
  2. List of uids that apply to the VPN has changed.
While 1 is already covered by the current design, the CL implements
2 in order to fulfill the case that different networks have
different proxies.

Bug: 178727215
Test: atest FrameworksNetTests
Change-Id: Ifa103dd66394026d752b407a1bee740c9fcdad2b
2021-06-08 01:43:59 +08:00
Chalard Jean
e4aeac6d75 [NS09] Implement the new ranking code
At this stage, this is turned off. Unit tests will be
in a followup change.

Test: In a followup
Bug: 167544279
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: I4448a3546fbc1a3dddf757982c031c5f39ba2889
Change-Id: I4448a3546fbc1a3dddf757982c031c5f39ba2889
  (cherry-picked from ag/14010222 with fixes)
2021-06-07 11:00:46 +00:00
Chalard Jean
e3d2481792 [NS08] Expose public NetworkScore API
This exposes the two bits settable by the network agents in
Android S on NetworkScore. This is meant to be extensible in
future releases, or possibly for OEM upstreams.

Test: builds
CTS-Coverage-Bug: 184037351
Bug: 167544279
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: Id7ee1bd3e2679f0bd5200d5c299f18a33b87847c
Change-Id: Id7ee1bd3e2679f0bd5200d5c299f18a33b87847c
  (cherry-picked from ag/14010221)
2021-06-07 10:57:49 +00:00
Chalard Jean
f3ff362210 [NS07] Add the rest of the scoring policy
Bug: 167544279
Test: FrameworksNetTests
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: I5ea44a94ac6f16486274e9091f15a84734db2341
Change-Id: I5ea44a94ac6f16486274e9091f15a84734db2341
  (cherry-picked from ag/13988828)
2021-06-07 10:57:49 +00:00
Chalard Jean
947acd4275 [NS06] Implement the don't-reap mechanism
This exposes a mechanism for network providers to tell
the network stack that a given network must be kept up
for some specific reason. This is meant to be easier
for them than to have to file a request, in particular
because there is no guaranteed way to make sure the
request will be best matched by any given network.

Test: new test for this
Bug: 167544279
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: I238a3ee5ee9262477a23b897e4141769dd1505d1
Change-Id: I238a3ee5ee9262477a23b897e4141769dd1505d1
  (cherry-picked from ag/13929760)
2021-06-07 10:57:49 +00:00
Chalard Jean
0354d8c7e0 [NS05] Feed network offer callbacks
The design is very simply expressed :
An offer is needed for a request if and only if that offer
might beat the satisfier for that request.

The implementation of "might beat" is NetworkRanker#mightBeat.

Test: FrameworksNetTests FrameworksWifiTests NetworkStackTests
Bug: 167544279
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: I0fe911eef2483ecbac48c733d56283b81538690a
Change-Id: I0fe911eef2483ecbac48c733d56283b81538690a
  (cherry-picked from 7b6a33bd50)
2021-06-07 10:57:48 +00:00
Paul Hu
48fc715694 Merge "Move UIDS_ALLOWED_ON_RESTRICTED_NETWORKS setting" into sc-dev 2021-06-07 09:29:56 +00:00
Remi NGUYEN VAN
3c5921caea Merge "Revert "Add min_sdk_version to connectivity targets"" 2021-06-07 08:58:15 +00:00
Remi NGUYEN VAN
0ad52839e7 Revert "Add min_sdk_version to connectivity targets"
This reverts commit 326f7bb023.

Reason for revert: broke errorprone:
"Error: Call requires API level 31 (current min is 30)"

Bug: 190350403
Change-Id: Ib778ba7a882dabc4d42ab9689e1cc51d09d9be62
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
2021-06-07 08:56:05 +00:00
paulhu
4428044569 Move UIDS_ALLOWED_ON_RESTRICTED_NETWORKS setting
Now, PermissionMonitor reigster observer to listen the change
from all users, but "uids allowed on restricted networks" should
affect to all users instead of per each user. Thus, move the
setting from Settings.Secure to Settings.Global.

Bug: 189705071
Test: atest FrameworksNetTests
Merged-In: Ibea354d8dda1f02652a193820f3f9eb573b9a956

Change-Id: Ibea354d8dda1f02652a193820f3f9eb573b9a956
2021-06-07 08:55:16 +00:00
Remi NGUYEN VAN
51c61941ea Merge "Add min_sdk_version to connectivity targets" 2021-06-07 05:18:01 +00:00
Junyu Lai
9756b5d4f9 Merge changes Ia930b3d3,If614da81,I975a9439
* changes:
  [NS04.8] Address comments from NS04 and NS04.5
  [NS04.7] Reinstate a necessary change
  [NS04.5] Have NetworkOffer embark a provider ID
2021-06-04 20:52:38 +00:00
Paul Hu
c30c57c210 Merge "Update allowed on restricted networks getter/setter" 2021-06-04 10:31:50 +00:00
Remi NGUYEN VAN
84061f6102 Merge "Build connectivity JNI against libc++_static" 2021-06-04 07:01:47 +00:00
Remi NGUYEN VAN
5d3005cc98 Merge "Remove dependency on libnetd_client" 2021-06-04 07:01:11 +00:00
Chalard Jean
a88fd95294 [NS04.8] Address comments from NS04 and NS04.5
Bug: 167544279
Test: ConnectivityServiceTest
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: Ia930b3d3e723075cb47e267d589c576ee2d4490f
Change-Id: Ia930b3d3e723075cb47e267d589c576ee2d4490f
  (cherry-picked from ag/13982288)
2021-06-04 02:37:53 +00:00
Chalard Jean
30689b8fd7 [NS04.5] Have NetworkOffer embark a provider ID
...instead of a Messenger.
This will be useful later to compare whether a given offer is
offered by the same provider satisfying a request.

Bug: 167544279
Test: ConnectivityServiceTest
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: I975a9439021c7fa511c50ac982819b6dd146291e
Change-Id: I975a9439021c7fa511c50ac982819b6dd146291e
  (cherry-picked from 148dcce559)
2021-06-04 02:36:58 +00:00
Remi NGUYEN VAN
ae471dd3f2 Merge "Add NDK API for getprocnetwork" 2021-06-03 08:07:23 +00:00
paulhu
a1ac564748 Move UIDS_ALLOWED_ON_RESTRICTED_NETWORKS setting
Now, PermissionMonitor reigster observer to listen the change
from all users, but "uids allowed on restricted networks" should
affect to all users instead of per each user. Thus, move the
setting from Settings.Secure to Settings.Global.

Bug: 189705071
Test: atest FrameworksNetTests
Ignore-AOSP-First: Need cherry-pick
Change-Id: Ibea354d8dda1f02652a193820f3f9eb573b9a956
2021-06-01 21:28:34 +08:00
Remi NGUYEN VAN
326f7bb023 Add min_sdk_version to connectivity targets
All targets need min_sdk_version 30 to be included in the tethering
APEX. They will actually never be used on SDK 30 and are only loaded on
31, but this is necessary to be included in com.android.tethering.

Original change (project moved):
I190fd1f3c9fabff057d0a2bd7f45b63a4fe447b3

Bug: 171540887
Test: m
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ied5faa1a370cbc8836f46388fdb9b42d2a263232
2021-06-01 18:43:03 +09:00
Remi NGUYEN VAN
4be92df27b Build connectivity JNI against libc++_static
Instead of including the whole libc++ library by linking it dynamically,
use the static version so that unused symbols can be stripped.

This allows reducing the APEX size by 1MB (3.7MB -> 2.7MB), as otherwise
libc++ is included twice for 32 and 64 bit variants.

Original change (project moved):
Ia66d795cf23d6f45997278300c103976433f7c5c

Bug: 171540887
Test: Device boots and has connectivity, size reduced

Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ie1c5b2ea274238a226ad2d827148439fd5758bb5
2021-06-01 18:40:25 +09:00
Remi NGUYEN VAN
8d1a96d9ea Remove dependency on libnetd_client
NetworkUtils can just use the NDK to achieve the same.

Also make sure network handles can have the local nameservers flag, for
the JNI API, and create/parse them accordingly in Network.

Original change (project moved):
I2e7b78263f7ca0cab9458854858a7423f6bd2854

Bug: 171540887
Test: atest CtsNetTestCases (in particular MultinetworkApiTest,
          DnsResolverTest, NetworkTest)
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: I7a523aac93094beef6ff40d50678c12fe8840940
2021-06-01 18:40:06 +09:00
Remi NGUYEN VAN
a5e1148a4b Add NDK API for getprocnetwork
The API is the getter couterpart for setprocnetwork.
Use it in NetworkUtils so that the NDK API can be the source of truth
for the process network.

Original change (project moved):
Ie8f68cf1fa57deddb63324c1abf3d6fd5b0ef500

Bug: 171540887
Test: atest CtsNetTestCases
      Tests in change I311b58585033c2ca50ce5477ea9cd94b6f127507
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Iaf255f4aa29fd2ae02770baea5548ee8d5d407f2
2021-06-01 18:38:53 +09:00
Aaron Huang
cff22949d2 Remove framework-connectivity-annotations library
This library can be removed because the annotations are no longer
used out of module.

@RestrictBackgroundStatus and @MultipathPreference are defined
in connectivity mainline module. Annotate these in non-updatable
platform is not going to be manageable long term. For example,
if the module gets updated and the annotation gets more values
then it's a problem in non-updatable platform. So, it should
not have IntDef cross module boundaries.

Ignore-AOSP-First: AOSP doesn't include this change yet
Bug: 183972925
Test: build
Change-Id: I63f1fde73c4ffdaff9fda914e33cbb5a110ba64e
2021-06-01 06:47:47 +00:00
paulhu
91e7806938 Update allowed on restricted networks getter/setter
As API review feedback, setting allowed on restricted networks
should be by uid instead of package name for security reason.
Thus, update the getter/setter to return/accept set of uids.

Bug: 188085693
Test: atest FrameworksNetTests
Merged-In: I979bf98075e6c9c0ed7e891582843fddb62643cb

Change-Id: I979bf98075e6c9c0ed7e891582843fddb62643cb
2021-05-27 16:24:50 +08:00
Orion Hodson
1cb94175ea Use updated NetworkEventDispatcher API
(cherry picked from commit 1f4fa9ffd5)

Bug: 185153775
Test: m

Merged-In: Iae3cec4f751e1f74ccd26db6f22f55cf21dfc04a
Change-Id: I3259d8f23eebca7cb3e8ac507bb8c5b8774e85f1
2021-05-26 16:44:18 +01:00
Orion Hodson
13f6148e22 Merge "Use updated NetworkEventDispatcher API" into sc-dev 2021-05-26 13:34:07 +00:00
paulhu
68aacb407a Update allowed on restricted networks getter/setter
As API review feedback, setting allowed on restricted networks
should be by uid instead of package name for security reason.
Thus, update the getter/setter to return/accept set of uids.

Bug: 188085693
Test: atest FrameworksNetTests
Ignore-AOSP-First: Needs cherry-picks
Change-Id: I979bf98075e6c9c0ed7e891582843fddb62643cb
2021-05-26 16:16:57 +08:00
Orion Hodson
1f4fa9ffd5 Use updated NetworkEventDispatcher API
Bug: 185153775
Ignore-AOSP-First: addressing API council comments with deadline
Test: m
Change-Id: Iae3cec4f751e1f74ccd26db6f22f55cf21dfc04a
2021-05-25 21:25:17 +01:00
Baligh Uddin
3684713b8a Merge history of packages/Connectivity
Modified License Import for:
- Tethering/common/TetheringLib/Android.bp
- framework/Android.bp
- service/Android.bp
- tests/common/Android.bp
- tests/deflake/Android.bp
- tests/integration/Android.bp
- tests/smoketest/Android.bp
- tests/unit/Android.bp
- tests/unit/jni/Android.bp

BUG: 186628461
TEST: TH
Merged-In: I7b5fd61cd551c7010f5b8ceabbfdd04f30f648dd
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ia2185820f485e8ad2d3626a96eab7f5a874736cf
2021-05-24 05:45:18 +00:00
Baligh Uddin
2afd0986d3 Merge history of packages/Connectivity
Modified Visibility / Includes for:
- Tethering/common/TetheringLib/Android.bp

Modified License Import for:
- framework/Android.bp
- service/Android.bp
- tests/common/Android.bp
- tests/deflake/Android.bp
- tests/integration/Android.bp
- tests/smoketest/Android.bp
- tests/unit/Android.bp
- tests/unit/jni/Android.bp
Modified Lint mapping for:
- framework/lint-baseline.xml
- service/lint-baseline.xml

BUG: 186628461
TEST: TH
Merged-In: Ie82d0fb34bda77543e31c82660c6f315efa87f62
Change-Id: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
2021-05-24 04:40:14 +00:00
Cody Kesting
0b4be0203d Check location permission for ConnDiags last.
This CL updates ConnectivityService to check location permissions for
ConnectivityDiagnostics callbacks last in the permission check process.
This minimizes misattribution of location access for networks that an
app is not administering.

This CL also updates ConnectivityDiagnosticsManager documentation to
clearly state that location permissions are required in order to receive
callbacks.

Bug: 187310575
Test: atest ConnectivityDiagnosticsManagerTest
Test: atest ConnectivityServiceTest
Change-Id: I2dbeddac6273e2392ccaeae51a1c7776d6d3da75
Merged-In: I2dbeddac6273e2392ccaeae51a1c7776d6d3da75
(cherry picked from commit f3d0fc49db)
2021-05-21 16:22:50 +00:00
Orion Hodson
544989351f Merge "Move to renamed NDK symbol AFileDescriptor_getFd" 2021-05-21 08:29:52 +00:00
Cody Kesting
c5f9939bf3 Merge "Check location permission for ConnDiags last." 2021-05-20 21:27:46 +00:00
Junyu Lai
0dc5e2a8a2 Merge "[VCN21] Do not add NOT_VCN_MANAGED capability if specifier is present" into sc-dev 2021-05-19 11:31:39 +00:00
junyulai
35687f5979 [VCN21] Do not add NOT_VCN_MANAGED capability if specifier is present
Test: atest NetworkRequestTest#testBypassingVcn
Fix: 176939355
Fix: 188597540
Merged-In: I98dd3f4652dc067eb5c4666e952db6c854bcbb10
Change-Id: I98dd3f4652dc067eb5c4666e952db6c854bcbb10
  (cherry-picked from aosp/1705390)
2021-05-19 09:52:03 +00:00
Remi NGUYEN VAN
1ac0e834c9 Merge "Move config_apf* resources to NetworkStack" into sc-dev 2021-05-19 07:54:19 +00:00
Remi NGUYEN VAN
be047e2855 Move config_apf* resources to NetworkStack
The resources are only read by NetworkStack through their respective
ApfCapabilities SystemApi methods.
As the resources are being migrated out of frameworks/base resources
anyway, move them directly to NetworkStack instead of moving them to
ServiceConnectivityResources.

Also test that the framework resources are not overlaid or modified.
This should avoid OEM integration errors where the overlays are kept as
in R, without overlaying the resource in the NetworkStack package.

Bug: 185850634
Test: atest CtsNetTestCases
BYPASS_INCLUSIVE_LANGUAGE_REASON=Need to mention legacy APIs

Merged-In: I7a15ddcad5af11fa307d9dbe3a77b31a1179e5b3
(clean cherry-pick)

Change-Id: I7a15ddcad5af11fa307d9dbe3a77b31a1179e5b3
2021-05-19 11:00:58 +09:00
Remi NGUYEN VAN
999427e138 Merge "Move config_apf* resources to NetworkStack" 2021-05-19 00:58:52 +00:00
Treehugger Robot
4eedd4ac23 Merge "[VCN21] Do not add NOT_VCN_MANAGED capability if specifier is present" 2021-05-18 08:35:06 +00:00
Lorenzo Colitti
86714b1fd2 Allow unprivileged NetworkCallbacks to see other UIDs' networks.
Currently, unprivileged apps can call getAllNetworks() to see
all networks on the system, even networks that do not apply to
them. Allow them to do this via NetworkCallbacks as well.

This is the last piece of information that was only available
through getAllNetworks, so this CL deprecates that API.

Bug: 187921303
Test: new unit tests
Test: CTS test in other CL in topic
Change-Id: I30f1021927d3c8eae6525116c61ff4a4acecff6d
2021-05-18 12:24:07 +09:00
Cody Kesting
8533f883c2 Check location permission for ConnDiags last.
This CL updates ConnectivityService to check location permissions for
ConnectivityDiagnostics callbacks last in the permission check process.
This minimizes misattribution of location access for networks that an
app is not administering.

This CL also updates ConnectivityDiagnosticsManager documentation to
clearly state that location permissions are required in order to receive
callbacks.

Bug: 187310575
Test: atest ConnectivityDiagnosticsManagerTest
Test: atest ConnectivityServiceTest
Change-Id: I2dbeddac6273e2392ccaeae51a1c7776d6d3da75
2021-05-17 19:36:47 -07:00
Aaron Huang
1bbb7a7570 Merge "Add ConnectivityAnnotations class" into sc-dev 2021-05-17 14:07:45 +00:00
junyulai
9ef2350d50 [VCN21] Do not add NOT_VCN_MANAGED capability if specifier is present
Test: atest NetworkRequestTest#testBypassingVcn
Fix: 176939355
Change-Id: I98dd3f4652dc067eb5c4666e952db6c854bcbb10
2021-05-17 07:04:13 +00:00
Chiachang Wang
b4c624aece Merge "Replace clearAll with withoutDefaultCapabilities" 2021-05-17 01:56:52 +00:00
Jayachandran Chinnakkannu
65a0e0d0e5 Merge "QOS filter matching support based on remote address and port number for connected sockets" am: 6c5553aaaa am: f84276bde1 am: 9896622bd3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1687813

Change-Id: I04ada71bdea2c3851fd6925126f6ff2bfdecad2c
2021-05-14 21:19:17 +00:00
Jayachandran Chinnakkannu
6c5553aaaa Merge "QOS filter matching support based on remote address and port number for connected sockets" 2021-05-14 20:02:30 +00:00