Commit graph android_packages_modules_Co.../framework/src/android/net
Message SHA1
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

Aaron Huang   commited 2021-06-01 06:47:47 +00:00
cff22949d2
Merge "Use updated NetworkEventDispatcher API" into sc-dev
Orion Hodson   authored and   Android (Google) Code Review   commited 2021-05-26 13:34:07 +00:00
13f6148e22
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

paulhu   commited 2021-05-26 16:16:57 +08:00
68aacb407a
Use updated NetworkEventDispatcher API
Bug: 185153775
Ignore-AOSP-First: addressing API council comments with deadline
Test: m
Change-Id: Iae3cec4f751e1f74ccd26db6f22f55cf21dfc04a

Orion Hodson   commited 2021-05-25 21:25:17 +01:00
1f4fa9ffd5
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)

Cody Kesting   commited 2021-05-21 16:22:50 +00:00
0b4be0203d
Merge "[VCN21] Do not add NOT_VCN_MANAGED capability if specifier is present" into sc-dev
Junyu Lai   authored and   Android (Google) Code Review   commited 2021-05-19 11:31:39 +00:00
0dc5e2a8a2
[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)

junyulai   authored and   Junyu Lai   commited 2021-05-19 09:52:03 +00:00
35687f5979
Merge "Move config_apf* resources to NetworkStack" into sc-dev
Remi NGUYEN VAN   authored and   Android (Google) Code Review   commited 2021-05-19 07:54:19 +00:00
1ac0e834c9
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

Remi NGUYEN VAN   commited 2021-05-19 11:00:58 +09:00
be047e2855
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

Lorenzo Colitti   commited 2021-05-18 12:24:07 +09:00
86714b1fd2
Merge "Add ConnectivityAnnotations class" into sc-dev
Aaron Huang   authored and   Android (Google) Code Review   commited 2021-05-17 14:07:45 +00:00
1bbb7a7570
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

Jayachandran Chinnakkannu   authored and   Automerger Merge Worker   commited 2021-05-14 21:19:17 +00:00
65a0e0d0e5
Merge "QOS filter matching support based on remote address and port number for connected sockets"
Jayachandran Chinnakkannu   authored and   Gerrit Code Review   commited 2021-05-14 20:02:30 +00:00
6c5553aaaa
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

Paul Hu   authored and   Automerger Merge Worker   commited 2021-05-14 11:00:38 +00:00
5aa8c52638
Merge "Replace clearAll with withoutDefaultCapabilities" into sc-dev
Chiachang Wang   authored and   Android (Google) Code Review   commited 2021-05-14 09:32:42 +00:00
ab124bea0c
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

paulhu   commited 2021-05-14 15:27:36 +08:00
257a5cf7ad
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

Chiachang Wang   commited 2021-05-14 14:53:47 +08:00
df9611cab7
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

Aaron Huang   commited 2021-05-14 10:30:49 +08:00
6a7e6ad55c
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

Jayachandran C   commited 2021-05-13 09:50:13 -07:00
735e1ce55b
Merge "[NS04] Introduce Network Offers and their callbacks"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-05-13 15:11:45 +00:00
393e7b3d6a
Merge changes Ia5bc896c,I0c9406f4,I3108ee94
* changes:
  Make VcnTransportInfoTest pass on AOSP.
  Immediately redact VcnTransportInfo.
  Do not automatically redact TransportInfo objects.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-05-13 15:11:01 +00:00
e562d167a5
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

Paul Hu   authored and   Automerger Merge Worker   commited 2021-05-13 14:53:21 +00:00
940854d668
[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

Chalard Jean   authored and   Remi NGUYEN VAN   commited 2021-05-13 13:20:43 +00:00
823f81c36e
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

Lorenzo Colitti   commited 2021-05-13 20:24:19 +09:00
a869887d4f
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

paulhu   authored and   Paul Hu   commited 2021-05-13 10:35:29 +00:00
344c11661f
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

Paul Hu   authored and   Automerger Merge Worker   commited 2021-05-13 06:36:18 +00:00
ec3209227c
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

paulhu   commited 2021-05-13 10:09:31 +08:00
69afcd51db
Merge changes from topic "transportinfo-explicit-redaction" into sc-dev
* changes:
  Immediately redact VcnTransportInfo.
  Do not automatically redact TransportInfo objects.

Lorenzo Colitti   authored and   Android (Google) Code Review   commited 2021-05-12 22:46:36 +00:00
c7b7320f9d
Merge "Update PrivateDnsMode from StringDef to IntDef"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-05-12 17:09:50 +00:00
a23e55da49
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

Chalard Jean   authored and   Automerger Merge Worker   commited 2021-05-12 14:44:30 +00:00
18a5fac66a
Merge "Allow any transport with TEST if the network is restricted"
Chalard Jean   authored and   Gerrit Code Review   commited 2021-05-12 13:57:31 +00:00
6e80f1c182
Merge "Rename unwanted capabilities to forbidden capabilities."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-05-12 09:00:17 +00:00
0d942e81c7
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

David Su   authored and   Automerger Merge Worker   commited 2021-05-11 17:04:48 +00:00
b8e4a7b1e7
Merge "Emphasize possibility of multiple networks with same transport"
David Su   authored and   Gerrit Code Review   commited 2021-05-11 15:51:28 +00:00
cf514f511d
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

Lorenzo Colitti   commited 2021-05-11 22:47:03 +09:00
5026b3ea93
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

Lorenzo Colitti   commited 2021-05-11 17:46:13 +09:00
395fafb54f
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

Chalard Jean   commited 2021-05-11 15:42:10 +09:00
778c86525b
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

Lorenzo Colitti   commited 2021-05-08 01:48:01 +09:00
1df16c6f8f
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)

lucaslin   authored and   Lucas Lin   commited 2021-05-05 03:19:51 +00:00
57f9ba8b40
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

Junyu Lai   authored and   Automerger Merge Worker   commited 2021-05-03 04:06:34 +00:00
2e3d79675b
Merge "Add doc to getNetworkCapabilities"
Junyu Lai   authored and   Gerrit Code Review   commited 2021-05-03 03:16:24 +00:00
59d89299c9
Add doc to getNetworkCapabilities
Test: doc-only change
Fixes: 158092418
Change-Id: Ic20fb55e1bdd4e836468794d1f86d3e9d0bc5965

Chalard Jean   commited 2021-04-30 11:24:00 +00:00
070bdd4b77
Merge "Rename getAllNetworkStateSnapshot which should be pluralized"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-04-29 04:40:51 +00:00
984e51670e
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

Lorenzo Colitti   commited 2021-04-27 20:01:22 +09:00
9c0095c9e7
Merge "Address API review feedback"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-04-26 00:22:27 +00:00
5e2a729668
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

lucaslin   commited 2021-04-23 21:03:39 +08:00
57ee606244
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

Chiachang Wang   commited 2021-04-23 02:46:05 +00:00
9075ae36be
Merge "Address API review feedback" into sc-dev
Chiachang Wang   authored and   Android (Google) Code Review   commited 2021-04-23 00:30:51 +00:00
6f7ac6860e
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

Aaron Huang   commited 2021-04-22 17:45:22 +08:00
da103b3365
Merge "[VCN19] Rename get/setSubIds to get/setSubscriptionIds"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-04-22 04:43:26 +00:00
19a855be79