Commit Graph

308 Commits

Author SHA1 Message Date
Chiachang Wang
d761c1ca7c Merge "Replace clearAll with withoutDefaultCapabilities" 2021-05-17 01:56:52 +00:00
Jayachandran Chinnakkannu
02dabf7bb6 Merge "QOS filter matching support based on remote address and port number for connected sockets" 2021-05-14 20:02:30 +00:00
Chiachang Wang
16ceae4953 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
paulhu
0d7706a10f 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
Jayachandran C
b533550b06 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
5dd83f217e Merge "[NS04] Introduce Network Offers and their callbacks" 2021-05-13 15:11:45 +00:00
Lorenzo Colitti
975d8216c5 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
Chalard Jean
cdd68bcc3a [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
6424cf294f 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
1562bd1c12 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
paulhu
84b4e1bbb1 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
Lucas Lin
6813b1b794 Merge "Update PrivateDnsMode from StringDef to IntDef" 2021-05-12 17:09:50 +00:00
Chalard Jean
d09b89bca8 Merge "Allow any transport with TEST if the network is restricted" 2021-05-12 13:57:31 +00:00
Lorenzo Colitti
172abc194e Merge "Rename unwanted capabilities to forbidden capabilities." 2021-05-12 09:00:17 +00:00
David Su
10ee7c54c2 Merge "Emphasize possibility of multiple networks with same transport" 2021-05-11 15:51:28 +00:00
Lorenzo Colitti
1291166c38 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
0fb0c47869 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
lucaslin
b1ff1b2139 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
8ee3a33ee6 Merge "Add doc to getNetworkCapabilities" 2021-05-03 03:16:24 +00:00
Chalard Jean
53a8bccf94 Add doc to getNetworkCapabilities
Test: doc-only change
Fixes: 158092418
Change-Id: Ic20fb55e1bdd4e836468794d1f86d3e9d0bc5965
2021-04-30 11:24:00 +00:00
Treehugger Robot
bd9d954805 Merge "Rename getAllNetworkStateSnapshot which should be pluralized" 2021-04-29 04:40:51 +00:00
Chiachang Wang
79a90c3b8e Merge "Address API review feedback" 2021-04-26 00:22:27 +00:00
Chiachang Wang
6ec9b8daed 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
Aaron Huang
ee78b1fbbf 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
935946812a Merge "[VCN19] Rename get/setSubIds to get/setSubscriptionIds" 2021-04-22 04:43:26 +00:00
Treehugger Robot
7056276574 Merge "Do not deduce VCN capability if Builder is derived from request" 2021-04-21 14:06:14 +00:00
junyulai
561a7467c8 Do not deduce VCN capability if Builder is derived from request
If the caller constructed the builder from a request, it means
the user might explicitly want the capabilities from the request.
Thus, the NOT_VCN_MANAGED capabilities should not be touched
later.

Test: TH
Fix: 185876442
Change-Id: I92037cc8547fb72de12d6b6402f060f6c98e1853
2021-04-21 19:10:28 +08:00
Treehugger Robot
e3a86b7ebf Merge "Add the related extra information in the javadoc" 2021-04-21 08:22:43 +00:00
lucaslin
311b690343 Add the related extra information in the javadoc
Bug: 185876442
Test: make docs
Change-Id: Ib0abc43e2009dbf5ee7b6c2a076424834d3d53f2
2021-04-21 10:43:15 +08:00
junyulai
2217becf8d [VCN19] Rename get/setSubIds to get/setSubscriptionIds
Test: atest FrameworksNetTests FrameworksVcnTests
Fix: 185215036
Merged-In: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7
Change-Id: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7
  (cherry-picked from ag/14198665)
2021-04-19 17:41:01 +08:00
Junyu Lai
8ef8d57e18 Merge "[VCN20] Change requestBackgroundNetwork argument order" 2021-04-16 16:04:31 +00:00
Lorenzo Colitti
fe3676b6f2 Merge "Don't expose raw IBinder APIs." 2021-04-16 07:22:13 +00:00
junyulai
05738ae9d3 [VCN20] Change requestBackgroundNetwork argument order
Test: atest FrameworksNetTests FrameworksVcnTests
Fix: 185215095
Merged-In: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb
Change-Id: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb
  (cherry-picked from ag/14198667)
2021-04-16 00:16:21 +08:00
Lorenzo Colitti
34a294fc76 Don't expose raw IBinder APIs.
APIs should not expose raw IBinder objects.

Fix: 184735751
Test: builds, boots
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest
Test: atest CtsNetTestCases:android.net.cts.DnsResolverTest
Change-Id: Ia0c4170def31123f0b79318fec2cfe02e4fcd3bf
2021-04-15 18:47:21 +09:00
Chiachang Wang
52a55928a8 Remove hidden method link in public addRoute API
The build will complain after moving connectivity framework code
outside framework because the hidden methods/members accesses are
not allowed anymore. Link to a hidden class will not work since
it's not visible in public.

Bug: 182859030
Test: make docs
Change-Id: I5726f80be7cf92b648ce851d9601d5f58bc2b647
2021-04-15 16:21:00 +08:00
Lorenzo Colitti
1295ddf15e Add @RedactionType annotations to VpnTransportInfo.
This is in response to API council feedback.

Test: m
Bug: 185226718
Change-Id: I63d7249e7d14ac00558f311a3583f6adbf80e3d9
2021-04-14 00:28:19 +09:00
Chiachang Wang
34d1abd51d Merge "Make getUid a method on UserHandle itself instead of static" 2021-04-13 08:15:47 +00:00
Chiachang Wang
94335a3198 Merge "Rename APIs in NetworkAgentConfig.Builder" 2021-04-12 14:10:46 +00:00
Chiachang Wang
ef8132e88d Rename APIs in NetworkAgentConfig.Builder
As API review feedback, rename disableProvisioningNotification()
to setEnabledProvisioningNotification and disableNat64Detection()
to setEnabledNat64Detection. Also, update code in caller side
accordingly.

Bug: 184735772
Test: make update-api ; atest FrameworksNetTests
Change-Id: If7305634863d1503c967e5593ebd0c8af2174bea
2021-04-12 17:27:47 +08:00
paulhu
71824f0d35 Remove TcpRepairWindow from module-lib API
Both TcpRepairWindow and TcpKeepaliveController(user) are in the
connectivity module, so TcpRepairWindow doesn't need to be
the module-lib API. Thus, remove TcpRepairWindow from
module-lib API.

Bug: 172183305
Test: m update-api
Change-Id: I8fde726f8ad73637e6deab69ea83b3699bb2cf45
2021-04-12 14:26:55 +08:00
Chiachang Wang
612cc034a1 Make getUid a method on UserHandle itself instead of static
This commit addresses the API review feedback that getUid()
will be better to make it be a method on UserHandle itself
rather than a static method.

Update as it is and update the corresponding usages.

Fix: 184735865
Test: make update-api
Test: atest FrameworksNetTests
Test: atest CtsNetTestCasesLatestSdk
Change-Id: I33844309224d84764704255d251fadc8940202ca
2021-04-09 08:33:07 +08:00
Remi NGUYEN VAN
8ee838ce27 Merge "Improve documentation on simulateDataStall" 2021-04-09 00:21:34 +00:00
Remi NGUYEN VAN
9304a15955 Merge "Set ParseException constructors as public" 2021-04-09 00:20:33 +00:00
Remi NGUYEN VAN
b8810ea84d Merge "Replace fields with getters in keepalive API" 2021-04-09 00:20:13 +00:00
Remi NGUYEN VAN
5fe5503275 Merge "Add RequiresPermission to TestNetworkManager" 2021-04-09 00:19:51 +00:00
Remi NGUYEN VAN
e062de00c8 Merge "Use String in CaptivePortalData underlying types" 2021-04-09 00:17:59 +00:00
James Mattis
703ee9ae09 Merge "Adding OEM Network Preferences for testing" 2021-04-08 20:51:05 +00:00
Remi NGUYEN VAN
16d68bae63 Use String in CaptivePortalData underlying types
The venue friendly name comes from the network, and only plain strings
should be used in practice. writeCharSequence is also not usable in
CaptivePortalData, as it must build using module_api.

Use a String as the underlying type in CaptivePortalData, keeping
CharSequence in the API for consistency with UI-related elements.

This brings CaptivePortalData in line with downstream branches.

Bug: 183174863
Test: atest FrameworksNetTests
Merged-In: Ifa3ea9aae0cabf5757791c4ae13e6f551759ed97
Change-Id: Ic662d3b546d52f825f9c3a24c5e0d4ba03818ab0
2021-04-08 08:23:20 +00:00
Remi NGUYEN VAN
d2d60c6aa6 Improve documentation on simulateDataStall
Explain that:
 - The method does not cause an actual data stall.
 - The detectionMethod parameter refers to
   ConnectivityDiagnosticsManager.DataStallReport constants (which
   already use an IntDef).
 - timestampMillis is relative to SystemClock.elapsedRealtime.

Fixes: 183972768
Test: m
Change-Id: I2eeb79e0e8ec6e8fd3b8fe1dcb1abbf2e6338983
2021-04-08 16:30:25 +09:00
Remi NGUYEN VAN
d8d625c5db Add RequiresPermission to TestNetworkManager
All API methods in TestNetworkManager require the MANAGE_TEST_NETWORKS
permission.

Fixes: 183972672
Test: m
Change-Id: Ic5929c24ea88d7259d367a81fec8f223a2e3ecb0
2021-04-08 16:12:23 +09:00