Commit graph android_packages_modules_Co.../framework
Message SHA1
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
0d7706a10f
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
5dd83f217e
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
975d8216c5
[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
cdd68bcc3a
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
6424cf294f
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
1562bd1c12
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
84b4e1bbb1
Merge "Update PrivateDnsMode from StringDef to IntDef"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-05-12 17:09:50 +00:00
6813b1b794
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
d09b89bca8
Merge "Use jniThrowErrnoException from JNIHelp"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-05-12 13:12:32 +00:00
aaf18dd305
Merge "Move NetworkUtils JNI out of core/jni"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-05-12 13:12:09 +00:00
8ec3067e56
Merge "Build framework-connectivity using module_current"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-05-12 13:11:22 +00:00
d93c6b7585
Merge "Rename unwanted capabilities to forbidden capabilities."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-05-12 09:00:17 +00:00
172abc194e
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
10ee7c54c2
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

Remi NGUYEN VAN   commited 2021-05-11 14:18:27 +00:00
5accf986ea
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

Remi NGUYEN VAN   commited 2021-05-11 13:02:39 +00:00
d7ab21a379
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

Remi NGUYEN VAN   commited 2021-05-11 13:00:42 +00:00
0c00f40374
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
1291166c38
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
0fb0c47869
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
b1ff1b2139
Merge "Add doc to getNetworkCapabilities"
Junyu Lai   authored and   Gerrit Code Review   commited 2021-05-03 03:16:24 +00:00
8ee3a33ee6
Add doc to getNetworkCapabilities
Test: doc-only change
Fixes: 158092418
Change-Id: Ic20fb55e1bdd4e836468794d1f86d3e9d0bc5965

Chalard Jean   commited 2021-04-30 11:24:00 +00:00
53a8bccf94
Merge "Rename getAllNetworkStateSnapshot which should be pluralized"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-04-29 04:40:51 +00:00
bd9d954805
Merge "Address API review feedback"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-04-26 00:22:27 +00:00
79a90c3b8e
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
6ec9b8daed
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
ee78b1fbbf
Merge "[VCN19] Rename get/setSubIds to get/setSubscriptionIds"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-04-22 04:43:26 +00:00
935946812a
Merge "Do not deduce VCN capability if Builder is derived from request"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-04-21 14:06:14 +00:00
7056276574
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

junyulai   commited 2021-04-21 19:10:28 +08:00
561a7467c8
Merge "Add the related extra information in the javadoc"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-04-21 08:22:43 +00:00
e3a86b7ebf
Add the related extra information in the javadoc
Bug: 185876442
Test: make docs
Change-Id: Ib0abc43e2009dbf5ee7b6c2a076424834d3d53f2

lucaslin   commited 2021-04-21 10:43:15 +08:00
311b690343
[VCN19] Rename get/setSubIds to get/setSubscriptionIds
Test: atest FrameworksNetTests FrameworksVcnTests
Fix: 185215036
Merged-In: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7
Change-Id: I9d90df5fc13b36d2cdc4920b456dcc87fcd2b3a7
  (cherry-picked from ag/14198665)

junyulai   commited 2021-04-19 17:41:01 +08:00
2217becf8d
Merge "[VCN20] Change requestBackgroundNetwork argument order"
Junyu Lai   authored and   Gerrit Code Review   commited 2021-04-16 16:04:31 +00:00
8ef8d57e18
Merge "Don't expose raw IBinder APIs."
Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-04-16 07:22:13 +00:00
fe3676b6f2
[VCN20] Change requestBackgroundNetwork argument order
Test: atest FrameworksNetTests FrameworksVcnTests
Fix: 185215095
Merged-In: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb
Change-Id: Id281678fe85ce0894b0e92e11c0283d4d1b4ecdb
  (cherry-picked from ag/14198667)

junyulai   commited 2021-04-16 00:16:21 +08:00
05738ae9d3
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

Lorenzo Colitti   commited 2021-04-15 18:47:21 +09:00
34a294fc76
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

Chiachang Wang   commited 2021-04-15 16:21:00 +08:00
52a55928a8
Add @RedactionType annotations to VpnTransportInfo.
This is in response to API council feedback.

Test: m
Bug: 185226718
Change-Id: I63d7249e7d14ac00558f311a3583f6adbf80e3d9

Lorenzo Colitti   commited 2021-04-14 00:28:19 +09:00
1295ddf15e
Merge "Make getUid a method on UserHandle itself instead of static"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-04-13 08:15:47 +00:00
34d1abd51d
Merge "Rename APIs in NetworkAgentConfig.Builder"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-04-12 14:10:46 +00:00
94335a3198
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

Chiachang Wang   commited 2021-04-12 17:27:47 +08:00
ef8132e88d
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

paulhu   commited 2021-04-12 14:26:55 +08:00
71824f0d35
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

Chiachang Wang   commited 2021-04-09 08:33:07 +08:00
612cc034a1
Merge "Improve documentation on simulateDataStall"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-04-09 00:21:34 +00:00
8ee838ce27
Merge "Set ParseException constructors as public"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-04-09 00:20:33 +00:00
9304a15955
Merge "Replace fields with getters in keepalive API"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-04-09 00:20:13 +00:00
b8810ea84d
Merge "Add RequiresPermission to TestNetworkManager"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-04-09 00:19:51 +00:00
5fe5503275
Merge "Use String in CaptivePortalData underlying types"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-04-09 00:17:59 +00:00
e062de00c8
Merge "Adding OEM Network Preferences for testing"
James Mattis   authored and   Gerrit Code Review   commited 2021-04-08 20:51:05 +00:00
703ee9ae09
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

Remi NGUYEN VAN   commited 2021-04-08 08:23:20 +00:00
16d68bae63