Commit Graph

12988 Commits

Author SHA1 Message Date
Ken Chen
b9c8676b67 [DO NOT MERGE] Revert "Reference unreachable netId from INetd" am: d901acbdfb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1705391

Change-Id: I9735b2c50de8899ca7c856ee02ade2fa3ec1a357
2021-05-13 18:41:12 +00:00
Ken Chen
d901acbdfb [DO NOT MERGE] Revert "Reference unreachable netId from INetd"
This reverts commit 8a3400d134.

Reason for revert: Automerge conflict on sc-dev. The target file has been moved to other folder in sc-dev (ag/14516148). Revert this change and check-in again from AOSP bases on aosp/1706845.

Change-Id: I93a8bf4a3f59d789d88adceb3760c586b9951750
2021-05-13 17:40:51 +00:00
Ken Chen
47e424ca26 Merge "Reference unreachable netId from INetd" am: 64c2bc7165
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1705386

Change-Id: I522103bab137e3c1c8941d3611ccd968fdfdd781
2021-05-13 16:30:10 +00:00
Ken Chen
64c2bc7165 Merge "Reference unreachable netId from INetd" 2021-05-13 16:10:49 +00:00
Remi NGUYEN VAN
06e72bc268 Merge "[NS04] Introduce Network Offers and their callbacks" am: d603e40fa5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556102

Change-Id: Ifcdc55f7b202b9fe1ea10c9546c07d4563e9988c
2021-05-13 15:35:10 +00:00
Lorenzo Colitti
e85055d0a8 Merge changes Ia5bc896c,I0c9406f4,I3108ee94 am: dff00cd42b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1705389

Change-Id: I30c22bae1e2df6497483fd863396f2abb6def278
2021-05-13 15:30:59 +00:00
Remi NGUYEN VAN
d603e40fa5 Merge "[NS04] Introduce Network Offers and their callbacks" 2021-05-13 15:11:45 +00:00
Lorenzo Colitti
dff00cd42b 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
6d5c51149c Merge "Update mobile data preference getter/setter" am: d0b2ba479b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1702486

Change-Id: Ieb72b4f0284d5439f62037b9d68da054f276120d
2021-05-13 14:07:56 +00:00
Paul Hu
d0b2ba479b Merge "Update mobile data preference getter/setter" 2021-05-13 13:42:05 +00:00
Chalard Jean
97063fe5a1 [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
Remi NGUYEN VAN
8c3d83c0cc Merge "Move net unit tests to packages/Connectivity" am: 5b48156498
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1706685

Change-Id: I86852c79cf06a3bc7b7ccaa18d83f70a2043b258
2021-05-13 11:32:36 +00:00
Lorenzo Colitti
e61ffc1a50 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
96a65940d8 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
0d51e44e09 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
Merged-In: I254ffd1c08ec058d594b4ea55cbae5505f8497cc

Change-Id: I254ffd1c08ec058d594b4ea55cbae5505f8497cc
2021-05-13 08:30:33 +00:00
Paul Hu
93cbfdb5ff Merge "Add RESTRICTED_ALLOWED_APPS setting" am: 26cc1ff94e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1689208

Change-Id: I93c004e7356559436c7dbd95716e52db8fc1ba0d
2021-05-13 05:54:31 +00:00
Paul Hu
26cc1ff94e Merge "Add RESTRICTED_ALLOWED_APPS setting" 2021-05-13 05:32:19 +00:00
paulhu
d82ece857d 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
Ken Chen
f16388a8f5 Merge "Add testVpnTypesEqual to verify consistency" am: edeab9051e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1705385

Change-Id: I18b5716252efc4f7c33ec8263c09df1f9396d1fe
2021-05-13 02:05:37 +00:00
Ken Chen
4728eb0924 Merge "Better log in createNativeNetwork" am: 37dec89b65
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1704925

Change-Id: Ic8afb71d7ac099f6c492dda8f9f54a5da3c79649
2021-05-13 02:01:21 +00:00
Ken Chen
8a3400d134 Reference unreachable netId from INetd
Bug: 181579204
Test: m; atest FrameworksNetTests
Change-Id: I7b59483d888e556ae50a37da539501b046295c16
2021-05-13 09:45:18 +08:00
Ken Chen
aa243fe3ba Merge "Switch from networkCreate[Physical/Vpn] to networkCreate" am: a0b65e1870
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1669648

Change-Id: Ia7b8d56ee75194cfe289dbb3e73667f43344cda3
2021-05-13 01:34:23 +00:00
Ken Chen
edeab9051e Merge "Add testVpnTypesEqual to verify consistency" 2021-05-13 01:22:08 +00:00
Ken Chen
37dec89b65 Merge "Better log in createNativeNetwork" 2021-05-13 01:21:47 +00:00
Ken Chen
a0b65e1870 Merge "Switch from networkCreate[Physical/Vpn] to networkCreate" 2021-05-13 01:20:39 +00:00
Lucas Lin
735250d758 Merge "Update PrivateDnsMode from StringDef to IntDef" am: 0604a2e93e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1675562

Change-Id: I391d8dd2615f090d3112af69248aea70e334f62f
2021-05-12 17:23:45 +00:00
Lucas Lin
0604a2e93e Merge "Update PrivateDnsMode from StringDef to IntDef" 2021-05-12 17:09:50 +00:00
Chalard Jean
e32987bcb9 Merge "Allow any transport with TEST if the network is restricted" am: 03de4e884b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1702489

Change-Id: Ic688c9d328242962c57631632b33236a69852ed6
2021-05-12 14:29:56 +00:00
Remi NGUYEN VAN
cb58eb4732 Merge "Use jniThrowErrnoException from JNIHelp" am: 60ce73bdc5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1703087

Change-Id: I6a1d75a1792883a7dc96c1beb108e83653c668a0
2021-05-12 14:17:28 +00:00
Remi NGUYEN VAN
ba0f6837cc Merge "Move NetworkUtils JNI out of core/jni" am: 8842198f2e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1703086

Change-Id: Icd812cda9e75015093080126bd20210034af5839
2021-05-12 14:13:20 +00:00
Remi NGUYEN VAN
6e64634da0 Merge "Build framework-connectivity using module_current" am: 40d3b1fbea
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1703085

Change-Id: I67461b530e5292f94e3e1426ff0ec93ea657cf21
2021-05-12 14:05:55 +00:00
Chalard Jean
03de4e884b Merge "Allow any transport with TEST if the network is restricted" 2021-05-12 13:57:31 +00:00
Remi NGUYEN VAN
60ce73bdc5 Merge "Use jniThrowErrnoException from JNIHelp" 2021-05-12 13:12:32 +00:00
Remi NGUYEN VAN
8842198f2e Merge "Move NetworkUtils JNI out of core/jni" 2021-05-12 13:12:09 +00:00
Remi NGUYEN VAN
40d3b1fbea Merge "Build framework-connectivity using module_current" 2021-05-12 13:11:22 +00:00
Chiachang Wang
d37e995263 Merge "Remove sendNetworkConditionsBroadcast" am: 536e82f56b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1702485

Change-Id: I858f2364a40d409981b88946887f9619f11cdce4
2021-05-12 09:57:07 +00:00
Ken Chen
4812a3ab7a Add testVpnTypesEqual to verify consistency
VPN types are defined in both VpnManager.java and NativeVpnType.aidl.
The definitions on both sides should match (except TYPE_VPN_NONE).

VpnManager.java:
TYPE_VPN_NONE = -1
TYPE_VPN_SERVICE = 1
TYPE_VPN_PLATFORM = 2
TYPE_VPN_LEGACY = 3
TYPE_VPN_OEM = 4

NativeVpnType.aidl:
SERVICE = 1
PLATFORM = 2
LEGACY = 3
OEM = 4

Bug: N/A
Test: atest android.net.VpnManagerTest#testVpnTypesEqual
Change-Id: Ie618e227d861100c5318da696140e486af1093a0
2021-05-12 17:34:34 +08:00
Chiachang Wang
536e82f56b Merge "Remove sendNetworkConditionsBroadcast" 2021-05-12 09:24:02 +00:00
Lorenzo Colitti
a50875391b Merge "Rename unwanted capabilities to forbidden capabilities." am: dacc5e5f93
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1687485

Change-Id: Iaf8da730305ed7294cc624d4d41b0a11f2872863
2021-05-12 09:15:30 +00:00
Lorenzo Colitti
dacc5e5f93 Merge "Rename unwanted capabilities to forbidden capabilities." 2021-05-12 09:00:17 +00:00
Paul Hu
8f03d96e83 Merge "Add MATCH_ANY_USER flag to PackageInfo queries" am: eda29f73aa
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1689207

Change-Id: Ie4878f35faf62b15c95dc93951b9fa8f868642c4
2021-05-12 07:41:00 +00:00
Paul Hu
eda29f73aa Merge "Add MATCH_ANY_USER flag to PackageInfo queries" 2021-05-12 07:13:17 +00:00
Ken Chen
4e6ae315ac Better log in createNativeNetwork
Dump more information from NetworkAgentInfo in error log.

Bug: N/A
Test: m
Change-Id: I92981c03ad80e8b1d7ffaf45d50cc0bfd0b283b0
2021-05-12 13:44:40 +08:00
David Su
a7472710a5 Merge "Emphasize possibility of multiple networks with same transport" am: 74adc3a813
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1620459

Change-Id: I5ce97c2040817b68c6b70640db22d5d04bb304f3
2021-05-11 16:10:55 +00:00
David Su
74adc3a813 Merge "Emphasize possibility of multiple networks with same transport" 2021-05-11 15:51:28 +00:00
Remi NGUYEN VAN
bf0edd457f 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
Remi NGUYEN VAN
40330008c3 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
472d13d498 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
e1d928aff5 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
Ken Chen
de5e7aa2ba Switch from networkCreate[Physical/Vpn] to networkCreate
networkCreatePhysical and networkCreateVpn are non-extensible. In order
to pass OEM requested VPN type to Netd, we need to migrate to
networkCreate API.

Modify test code accordingly since networkCreatePhysical and
networkCreateVpn have been deprecated on Netd.

Bug: 171872481
Test: atest FrameworksNetTests
atest atest HostsideVpnTests

Change-Id: I50ab8615346c49559c16e815482e7804a1e765c8
2021-05-11 16:06:54 +08:00