Commit Graph

756 Commits

Author SHA1 Message Date
Paul Hu
5aa8c52638 Merge "Address [set|get]RestrictedAllowedApps API review feedback" am: 16c34f0d8b am: 38544887c7 am: 95f5f547fc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1708327

Change-Id: Ia8e395132226d23fdfb8cd4c93c004c459386104
2021-05-14 11:00:38 +00:00
Chiachang Wang
cf6e5210ba Replace clearAll with withoutDefaultCapabilities
As the feedback from API review, the clearAll method in Builder
does not match the actual usage. Thus, remove it and replace
with withoutDefaultCapabilities to provide clearer usage.

Bug: 184735772
Test: make update-api ; m
Change-Id: Ida8d25d57504864f046e3403f593cc606fbfe982
Merged-In: Ida8d25d57504864f046e3403f593cc606fbfe982
2021-05-14 10:36:37 +00:00
Chiachang Wang
ab124bea0c Merge "Replace clearAll with withoutDefaultCapabilities" into sc-dev 2021-05-14 09:32:42 +00:00
paulhu
257a5cf7ad Address [set|get]RestrictedAllowedApps API review feedback
- Rename [set|get]RestrictedAllowedApps to
  [set|get]AppsAllowedOnRestrictedNetworks
- Remove the regex of validate package name check

Bug: 188085693
Test: m update-api && m
Change-Id: I07966fb66093523a67e1e6a1ecfa05cc399e22f2
2021-05-14 15:27:36 +08:00
Chiachang Wang
df9611cab7 Replace clearAll with withoutDefaultCapabilities
As the feedback from API review, the clearAll method in Builder
does not match the actual usage. Thus, remove it and replace
with withoutDefaultCapabilities to provide clearer usage.

Bug: 184735772
Test: make update-api ; m
Change-Id: Ida8d25d57504864f046e3403f593cc606fbfe982
CTS-Coverage-Bug: 186061922
2021-05-14 14:53:47 +08:00
Aaron Huang
6a7e6ad55c Add ConnectivityAnnotations class
This change is to address API review, add respective
@IntDef for network policy API.

Typedef cannot be exposed as SystemApi so add
ConnectivityAnnotations class and add an annotation library
so that it can be used in module and platform.

Bug: 183972925
Test: m, build doc target framework-doc-stubs_annotations.zip
      and check the APIs have an attribute IntDef annotation
Change-Id: Ie3ec40cf48818edd422a4550377774eae387d3b2
2021-05-14 10:30:49 +08:00
Jayachandran C
735e1ce55b QOS filter matching support based on remote address and port number for connected sockets
This CL adds APIs for telephony to perform filter matching based on
remote address if the socket is connected. Additional checks will be
performed on the state of socket to avoid the future callbacks in a
separate CL.

Bug: 181916576
Test: Manually verified in live T-Mobile network
      atest ConnectivityServiceTest
      atest com.android.internal.telephony.dataconnection.QosCallbackTrackerTest

Change-Id: I6fbd4e84c76bc4acbf4e59f06f8e86e0237bae29
2021-05-13 09:50:13 -07:00
Remi NGUYEN VAN
393e7b3d6a Merge "[NS04] Introduce Network Offers and their callbacks" 2021-05-13 15:11:45 +00:00
Lorenzo Colitti
e562d167a5 Merge changes Ia5bc896c,I0c9406f4,I3108ee94
* changes:
  Make VcnTransportInfoTest pass on AOSP.
  Immediately redact VcnTransportInfo.
  Do not automatically redact TransportInfo objects.
2021-05-13 15:11:01 +00:00
Paul Hu
940854d668 Merge "Update mobile data preference getter/setter" am: a035d3a77c am: a7d1ee6f5e am: b6527ca6aa
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1702486

Change-Id: Ib55aaba8c8afc8a3152d83932bf345277bda35f9
2021-05-13 14:53:21 +00:00
Remi NGUYEN VAN
b11ba415f6 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

Change-Id: I7a15ddcad5af11fa307d9dbe3a77b31a1179e5b3
2021-05-13 14:40:10 +00:00
Orion Hodson
73e39baccb Move to renamed NDK symbol AFileDescriptor_getFd
Bug: 185256332
Test: TH

(cherry picked from commit a1a2ccb8d7)
Merged-In: Ic13f1d9832d5ae5b6ae4b96323025d9b695fdaf9
Change-Id: I83ef7acccbea13ec00040ba844054afa42faec41
2021-05-13 15:03:35 +01:00
Chalard Jean
823f81c36e [NS04] Introduce Network Offers and their callbacks
This patch introduces the concept of a network offer that
providers send to Connectivity to register for relevant
requests. This lets them see only requests that they can
hope to satisfy considering their capabilities and score
filters.

This is meant to replace the filtering mechanism currently
implemented by NetworkFactory. The reason for replacing
this mechanism is that the old mechanism does caps and
score filtering on the factory side, which requires these
two filters to be contextless and available system-wide,
including in separate processes from the system server.
These constraints severely limit and complexify in
particular what the score comparisons may look like. In
the past the score comparison was only integer-based,
making the code duplication not much of a problem, but as
this scheme is becoming unsustainable by spreading the
complexity of the selection across the entire stack, a
centralized mechanism is now necessary.

This patch only introduces the new objects and has CS
keep track of them, but does not actually use them yet.
Followup patches will implement the logic of calling
the offer callbacks.

Test: FrameworksNetTests NetworkStackTests FrameworksWifiTests
Bug: 167544279
Merged-In: Idec1fe8eb4ac6f562bf098e3dd470f11024d04f2
(clean cherry-pick)

Change-Id: Idec1fe8eb4ac6f562bf098e3dd470f11024d04f2
2021-05-13 13:20:43 +00:00
Lorenzo Colitti
a869887d4f Do not automatically redact TransportInfo objects.
Currently, NetworkCapabilities always redacts the TransportInfo
objects it contains whenever a defensive copy is made. This makes
it impossible to make a defensive copy on a TransportInfo
parcelled from another process without redacting it.

Stop redacting by default; instead rely on ConnectivityService
explicitly calling NetworkCapabilities' redacting constructor
when it returns a NetworkCapabilities object to an app via a
callback or synchronous call. This is currently done by
- createWithLocationInfoSanitizedIfNecessaryWhenParceled, which
  is called from callCallbackForRequest, getNetworkCapabilities,
  and getDefaultNetworkCapabilitiesForUser.
- getNetworkCapabilitiesWithoutUids, which is used when sending
  ConnectivityDiagnosticsManager callbacks. In this method,
  unconditionally redact all information, which is what the code
  did previously due to the default redaction setting for empty
  NetworkCapabilities objects being REDACT_ALL.

Bug: 183938194
Test: atest NetworkCapabilitiesTest
Test: atest FrameworksNetTests CtsNetTestCases HostsideVpnTests
Change-Id: I3108ee94cb0930958e071ba678c3554525b0db82
2021-05-13 20:24:19 +09:00
paulhu
344c11661f Update mobile data preference getter/setter
To satisfy OEM's requests, setting mobile data preference
should be by uid. Thus, update the getter/setter to
return/accept set of uids that need to apply mobile data
preference.

Bug: 171872461
Test: atest FrameworksNetTests
Change-Id: Id44efd2a6d820867f4405426c91e65b9ef155898
2021-05-13 10:35:29 +00:00
Remi NGUYEN VAN
20f6b445a9 Merge "Move net unit tests to packages/Connectivity" into sc-dev 2021-05-13 09:09:35 +00:00
Paul Hu
ec3209227c Merge "Add RESTRICTED_ALLOWED_APPS setting" am: e6d2b4663e am: 7023fe8242 am: 7c3e361c2d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1689208

Change-Id: I59c9ff9a64eac6b3367169450ca2c063ef34ff3c
2021-05-13 06:36:18 +00:00
Remi NGUYEN VAN
678277cc03 Move net unit tests to packages/Connectivity
Move the tests together with packages/Connectivity code, so both can be
moved to packages/modules/Connectivity together.

Also reorganize unit tests in a unit/ directory, as other tests
(integration/, common/ etc.) have been added in tests/net since they
were created. This makes the directory structure consistent.

Test: atest FrameworksNetTests
Bug: 187814163
Ignore-AOSP-First: needs per-branch move for merge conflicts
Change-Id: I254ffd1c08ec058d594b4ea55cbae5505f8497cc
2021-05-13 05:55:44 +00:00
paulhu
69afcd51db Add RESTRICTED_ALLOWED_APPS setting
This setting is OEM upstream requirement for third party apps
using restricted networks.

Bug: 185149952
Test: atests FrameworksNetTests
Change-Id: I5e16b46cf2935f38ee1e516bb8b85fa487cf9f61
2021-05-13 10:09:31 +08:00
Lorenzo Colitti
c7b7320f9d Merge changes from topic "transportinfo-explicit-redaction" into sc-dev
* changes:
  Immediately redact VcnTransportInfo.
  Do not automatically redact TransportInfo objects.
2021-05-12 22:46:36 +00:00
Lucas Lin
a23e55da49 Merge "Update PrivateDnsMode from StringDef to IntDef" 2021-05-12 17:09:50 +00:00
Chalard Jean
18a5fac66a Merge "Allow any transport with TEST if the network is restricted" am: 6e80f1c182 am: 5fdbf4d6de am: a6b91aafee
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1702489

Change-Id: Ib8ee3109ba5525ce1b1c6c2bd5ebcdc0b48a5319
2021-05-12 14:44:30 +00:00
Chalard Jean
6e80f1c182 Merge "Allow any transport with TEST if the network is restricted" 2021-05-12 13:57:31 +00:00
Remi NGUYEN VAN
25a08f056f Merge "Use jniThrowErrnoException from JNIHelp" 2021-05-12 13:12:32 +00:00
Remi NGUYEN VAN
954385ffac Merge "Move NetworkUtils JNI out of core/jni" 2021-05-12 13:12:09 +00:00
Remi NGUYEN VAN
eb0961067e Merge "Build framework-connectivity using module_current" 2021-05-12 13:11:22 +00:00
Lorenzo Colitti
0d942e81c7 Merge "Rename unwanted capabilities to forbidden capabilities." 2021-05-12 09:00:17 +00:00
David Su
b8e4a7b1e7 Merge "Emphasize possibility of multiple networks with same transport" am: cf514f511d am: ee28d79784 am: 32cee1bf1b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1620459

Change-Id: I8417a8af1202c01803c61ff54363b45960af6965
2021-05-11 17:04:48 +00:00
David Su
cf514f511d Merge "Emphasize possibility of multiple networks with same transport" 2021-05-11 15:51:28 +00:00
Orion Hodson
276e973b32 Merge "Move to renamed NDK symbol AFileDescriptor_getFd" into sc-dev 2021-05-11 14:31:42 +00:00
Remi NGUYEN VAN
62c5136e00 Use jniThrowErrnoException from JNIHelp
Use the jniThrowErrnoException that is available in JNIHelp, instead of
reimplementing in NetworkUtils.

Bug: 179229316
Test: device boots and has connectivity
Merged-In: I257a9d55ce1f5a7c588e209b4a89d3e7a3e09994

Change-Id: I257a9d55ce1f5a7c588e209b4a89d3e7a3e09994
2021-05-11 14:18:27 +00:00
Lorenzo Colitti
5026b3ea93 Do not automatically redact TransportInfo objects.
Currently, NetworkCapabilities always redacts the TransportInfo
objects it contains whenever a defensive copy is made. This makes
it impossible to make a defensive copy on a TransportInfo
parcelled from another process without redacting it.

Stop redacting by default; instead rely on ConnectivityService
explicitly calling NetworkCapabilities' redacting constructor
when it returns a NetworkCapabilities object to an app via a
callback or synchronous call. This is currently done by
- createWithLocationInfoSanitizedIfNecessaryWhenParceled, which
  is called from callCallbackForRequest, getNetworkCapabilities,
  and getDefaultNetworkCapabilitiesForUser.
- getNetworkCapabilitiesWithoutUids, which is used when sending
  ConnectivityDiagnosticsManager callbacks. In this method,
  unconditionally redact all information, which is what the code
  did previously due to the default redaction setting for empty
  NetworkCapabilities objects being REDACT_ALL.

Bug: 183938194
Test: atest NetworkCapabilitiesTest
Test: atest FrameworksNetTests CtsNetTestCases HostsideVpnTests
Change-Id: I3108ee94cb0930958e071ba678c3554525b0db82
2021-05-11 22:47:03 +09:00
Remi NGUYEN VAN
1fd558efee Move NetworkUtils JNI out of core/jni
Keep the utilities included via a library, but move them out of
core/jni, and prepare a library to package them together with
framework-connectivity.

Also remove unnecessary dependencies in framework-connectivity.

Bug: 171540887
Test: device boots and has connectivity

Merged-In: I0b55dfe92f3cb6e848d79ac7953756f39aaa2597

Change-Id: I0b55dfe92f3cb6e848d79ac7953756f39aaa2597
2021-05-11 13:02:39 +00:00
Remi NGUYEN VAN
e4d51c9710 Build framework-connectivity using module_current
framework-connectivity needs to build only against stable APIs.

Bug: 171540887
Test: m framework-connectivity.impl
Merged-In: I2d51d37d067bf6fe86e4dedf05855a2dd67ed57c

Change-Id: I2d51d37d067bf6fe86e4dedf05855a2dd67ed57c
2021-05-11 13:00:42 +00:00
Lorenzo Colitti
395fafb54f Rename unwanted capabilities to forbidden capabilities.
Addresses API council feedback.

Bug: 184890428
Test: atest FrameworksNetTests CtsNetTestCases
Test: atest CtsNetTestCasesLatestSdk:NetworkCapabilitiesTest on R device
Change-Id: Id7c68fbf56ee08fcad8e8e3aacf037fa1885936b
2021-05-11 17:46:13 +09:00
Chalard Jean
778c86525b Allow any transport with TEST if the network is restricted
This will allow CTS to add the WIFI transport and others,
letting them test a number of essential features of the
ranking algorithm.
It's relatively safe because restricted networks can never
become the default, and NOT_RESTRICTED is a default
capability so very few apps would be affected by the shell
creating such a network.

Bug: 184037351
Test: NetworkScoreTest (which is under review)
Change-Id: I21055dc613fead6130adc2122f2cdd0af9b49adf
2021-05-11 15:42:10 +09:00
Lorenzo Colitti
1df16c6f8f Rename unwanted capabilities to forbidden capabilities.
Addresses API council feedback.

Bug: 184890428
Test: atest FrameworksNetTests CtsNetTestCases
Test: atest CtsNetTestCasesLatestSdk:NetworkCapabilitiesTest on R device
Change-Id: Id7c68fbf56ee08fcad8e8e3aacf037fa1885936b
2021-05-08 01:48:01 +09:00
lucaslin
57f9ba8b40 Update PrivateDnsMode from StringDef to IntDef
Update PrivateDnsMode from StringDef to IntDef because IntDef is
the normal way of representing multiple choices in public API.
Also update other related files.

Bug: 185311744
Test: 1. make update-api
      2. atest FrameworksNetTests CtsNetTestCases CtsNetTestCasesLatestSdk
      3. atest FrameworksServicesTests:DevicePolicyManagerTest
Change-Id: I23e7ec140066979726d769cabc5f7057bb2167e6
Merged-In: I23e7ec140066979726d769cabc5f7057bb2167e6
    (Cherry-picked from ag/14227609)
2021-05-05 03:19:51 +00:00
Junyu Lai
2e3d79675b Merge "Add doc to getNetworkCapabilities" am: 59d89299c9 am: 622e129d00 am: efca123280
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1690668

Change-Id: I0c41878350ffe4015fe9e6034651f50366503dfe
2021-05-03 04:06:34 +00:00
Junyu Lai
59d89299c9 Merge "Add doc to getNetworkCapabilities" 2021-05-03 03:16:24 +00:00
Orion Hodson
a1a2ccb8d7 Move to renamed NDK symbol AFileDescriptor_getFd
Bug: 185256332
Test: TH
Change-Id: Ic13f1d9832d5ae5b6ae4b96323025d9b695fdaf9
2021-04-30 17:48:03 +01:00
Chalard Jean
070bdd4b77 Add doc to getNetworkCapabilities
Test: doc-only change
Fixes: 158092418
Change-Id: Ic20fb55e1bdd4e836468794d1f86d3e9d0bc5965
2021-04-30 11:24:00 +00:00
Treehugger Robot
984e51670e Merge "Rename getAllNetworkStateSnapshot which should be pluralized" 2021-04-29 04:40:51 +00:00
Lorenzo Colitti
9c0095c9e7 Remove EXTRA_PROXY_INFO.
This has been deprecated since M because it very error-prone, and
there are documented replacements.

Test: m
Bug: 171872228
Change-Id: Ide9846a26fc440b3ec5b4e4b444a046e738de3d6
2021-04-27 20:01:22 +09:00
Chiachang Wang
5e2a729668 Merge "Address API review feedback" 2021-04-26 00:22:27 +00:00
lucaslin
57ee606244 Update PrivateDnsMode from StringDef to IntDef
Update PrivateDnsMode from StringDef to IntDef because IntDef is
the normal way of representing multiple choices in public API.
Also update other related files.

Bug: 185311744
Test: 1. make update-api
      2. atest FrameworksNetTests CtsNetTestCases CtsNetTestCasesLatestSdk
      3. atest FrameworksServicesTests:DevicePolicyManagerTest
Change-Id: I23e7ec140066979726d769cabc5f7057bb2167e6
2021-04-23 21:03:39 +08:00
Chiachang Wang
9075ae36be Address API review feedback
Address API review feedback to:
 - Rename NetworkAgent#setTeardownDelayMs to
   NetworkAgent#setTeardownDelayMillis
 - Use getters instead of fields in VpnTransportInfo
 - Rename registerDefaultNetworkCallbackAsUid to
   registerDefaultNetworkCallbackForUid in ConnectiivityManager

Bug: 183972850
Bug: 185246410
Fix: 184735863
Test: make update-api
Test: atest FrameworksNetTests
Test: atest CtsNetTestCasesLatestSdk
Change-Id: I5e8c4bed8bda40d507afa894c359b5e24ee5d868
Merged-In: I5e8c4bed8bda40d507afa894c359b5e24ee5d868
2021-04-23 02:46:05 +00:00
Chiachang Wang
6f7ac6860e Merge "Address API review feedback" into sc-dev 2021-04-23 00:30:51 +00:00
Aaron Huang
da103b3365 Rename getAllNetworkStateSnapshot which should be pluralized
Address API review feedback, ConnectivityManager#getAllNetworkStateSnapshot
should be pluralized so rename the method to getAllNetworkStateSnapshots

(cherry picked from ag/14221105)
Bug: 183972554
Test: make, FrameworksNetTests
      FrameworksServicesTests
Merged-In: Ic18d17d05984fa2466c962c7843c0ef7183ce77c
Change-Id: Ic18d17d05984fa2466c962c7843c0ef7183ce77c
2021-04-22 17:45:22 +08:00
Treehugger Robot
19a855be79 Merge "[VCN19] Rename get/setSubIds to get/setSubscriptionIds" 2021-04-22 04:43:26 +00:00