Commit Graph

14215 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
75a61a36d6 Merge changes from topic "libframework_jni_ndk" into sc-dev
* changes:
  Build connectivity JNI against libc++_static
  Remove dependency on libnetd_client
2021-03-24 12:46:06 +00:00
Remi NGUYEN VAN
35b485e106 Build connectivity JNI against libc++_static
Instead of including the whole libc++ library by linking it dynamically,
use the static version so that unused symbols can be stripped.

This allows reducing the APEX size by 1MB (3.7MB -> 2.7MB), as otherwise
libc++ is included twice for 32 and 64 bit variants.

Bug: 171540887
Test: Device boots and has connectivity, size reduced

Change-Id: Ia66d795cf23d6f45997278300c103976433f7c5c
2021-03-24 10:08:39 +00:00
Remi NGUYEN VAN
6630463cbe Remove dependency on libnetd_client
NetworkUtils can just use the NDK to achieve the same.

Also make sure network handles can have the local nameservers flag, for
the JNI API, and create/parse them accordingly in Network.

Bug: 171540887
Test: atest CtsNetTestCases (in particular MultinetworkApiTest,
          DnsResolverTest, NetworkTest)
Change-Id: I2e7b78263f7ca0cab9458854858a7423f6bd2854
2021-03-24 10:08:39 +00:00
Chalard Jean
7618f1a492 [NS04.7] Reinstate a necessary change
NS04.5 removed a security that it shouldn't have. Reinstate it.

Bug: 167544279
Test: ConnectivityServiceTest
Change-Id: If614da813a96d1b50a16fa4be5659e1647d9469d
2021-03-24 15:57:26 +09:00
Chalard Jean
7015275e2e Merge changes I975a9439,Idec1fe8e into sc-dev
* changes:
  [NS04.5] Have NetworkOffer embark a provider ID
  [NS04] Introduce Network Offers and their callbacks
2021-03-24 06:45:50 +00:00
Sarah Chin
605ea88c66 Merge "API to get network visible network capability name" into sc-dev 2021-03-24 05:27:45 +00:00
Lucas Lin
26990d5bc8 Merge "Add annotation for Vpn#getNetwork()" into sc-dev 2021-03-24 03:25:23 +00:00
Frank Li
00fa3f2725 Merge "Fix cannot success verify count of the networkAgent Config items on R device" into sc-dev 2021-03-24 02:35:51 +00:00
Remi NGUYEN VAN
48cd32c356 Merge "Re-implement NetworkUtils#queryUserAccess." into sc-dev 2021-03-24 01:28:35 +00:00
Lucas Lin
ffe4be60fb Merge "Get NetworkCapabilities from NetworkCallback" into sc-dev 2021-03-24 01:07:50 +00:00
Sarah Chin
89888d72e7 API to get network visible network capability name
Test: atest DataConnectionTest, DcTrackerTest
Bug: 181916712
CTS-Coverage-Bug: 183553812
Change-Id: Iae63ac4d62641cee2bd0f0c5f50dd729750d514c
2021-03-24 00:27:11 +00:00
Jeff DeCew
8bbf0abc6a Merge "Remove Notification.DevFlags" into sc-dev 2021-03-23 19:50:27 +00:00
Junyu Lai
83eaae118e [automerger skipped] Merge "Fix cannot find removeUnwantedCapability on R device" am: 3ef6584f1b am: f85195ae06 am: b5d62d1f83 -s ours
am skip reason: skip tag Change-Id Icf2cda325795acee22a6c634e8d978f64c5ac3cb with SHA-1 8428118d0f is already in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1649302

Change-Id: I74d0e6ea112c4714c09a12f908fb9273c8477584
2021-03-23 14:09:59 +00:00
Chiachang Wang
a391ad837f Merge "Correct the logic in NetworkCapabilitiesTest" am: 2848cdf348 am: 06238861b5 am: b948cc3ba0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1649297

Change-Id: I3a99cab2dc0bdaa88a9671e1978c29cb40cd7a5b
2021-03-23 14:09:30 +00:00
Chiachang Wang
60721636cd [automerger skipped] Merge "Add NetworkRequest.Builder creating from an existing instance" am: 08bebe4609 am: eefea38ae5 am: 5898f562ed -s ours
am skip reason: skip tag Change-Id I068462b2a1410daf67b0c95f2b643d396f079531 with SHA-1 c2e79ada6c is already in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1649294

Change-Id: Icd22cc8edbfbbfe0dc8baecdc966d11c9a43a2ff
2021-03-23 14:05:23 +00:00
Junyu Lai
86b155f624 [automerger skipped] Merge "[VCN15] expose addUnwantedCapability and related APIs" am: 20d187254b am: 4a074bc753 am: aec7499fca -s ours
am skip reason: skip tag Change-Id I3f2e6a99e015f09cc4405f6804eac4ae33e3dcc7 with SHA-1 ce8c92d956 is already in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1639654

Change-Id: Id34011ffbdd997f29140b12cae5a0caeae745d3e
2021-03-23 14:03:13 +00:00
Lorenzo Colitti
2a4d6f6d43 Merge "Have a new method in NetworkAgentConfig.Builder to set allowBypass" am: c643098b0b am: 70e7af26c4 am: bb50fd24b3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1649288

Change-Id: Ibc6553b1471ee8e0ab362979ba9525c2e328a275
2021-03-23 14:02:47 +00:00
Lorenzo Colitti
56ad3fabe4 Merge changes I638ed5cd,I29f15571,I21a22ed1 am: 71996469d2 am: 068f44831d am: 12b8bb5c19
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1648068

Change-Id: I6d897cdcfb5b0e4809a32312071eb77623754f94
2021-03-23 14:01:19 +00:00
Junyu Lai
b5d62d1f83 Merge "Fix cannot find removeUnwantedCapability on R device" am: 3ef6584f1b am: f85195ae06
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1649302

Change-Id: Ia574c52344290f5baf5fbee90ed1f6f7c7e0f92c
2021-03-23 13:29:15 +00:00
Jeff DeCew
6a77410cf1 Remove Notification.DevFlags
Fixes: 176239013
Test: manual
Change-Id: I1aeed1c79e4a829d8829eb08224f9b21fafc50fe
2021-03-23 13:28:55 +00:00
Aaron Huang
8be8042248 Merge "Remove Network, NetworkRequest metrics from jobscheduler" into sc-dev 2021-03-23 13:22:32 +00:00
Lorenzo Colitti
d81932b836 Re-implement NetworkUtils#queryUserAccess.
Currently, queryUserAccess talks to netd via FwmarkServer.
Doing this from the module would require exposing queryUserAccess
as an NDK API or reimplementing FwmarkClient.

Because queryUserAccess really only uses information that comes
from ConnectivityService/PermissionMonitor anyway, just use that
information without calling to net.

Test: atest HostsideVpnTests
Bug: 171540887
Change-Id: If855de1ea3e1fd2ed30f2795d9b4acfcf969a2dc
2021-03-23 13:20:44 +00:00
Aaron Huang
457dda7eb4 Merge "Move deduceRestrictedCapability to libs/net and rename it" into sc-dev 2021-03-23 12:50:40 +00:00
Junyu Lai
f85195ae06 Merge "Fix cannot find removeUnwantedCapability on R device" am: 3ef6584f1b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1649302

Change-Id: I11ee0a8d6388f78a9db90756c0cbee93c923e1b8
2021-03-23 12:46:45 +00:00
TreeHugger Robot
e719bfb2bc Merge "Expose NetworkAgent constructor taking a NetworkScore parameter" into sc-dev 2021-03-23 12:45:24 +00:00
Chalard Jean
b004da599b [NS04.5] Have NetworkOffer embark a provider ID
...instead of a Messenger.
This will be useful later to compare whether a given offer is
offered by the same provider satisfying a request.

Bug: 167544279
Test: ConnectivityServiceTest
Change-Id: I975a9439021c7fa511c50ac982819b6dd146291e
2021-03-23 21:41:11 +09:00
Chalard Jean
1ef1d90ee0 [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
Change-Id: Idec1fe8eb4ac6f562bf098e3dd470f11024d04f2
2021-03-23 21:41:11 +09:00
Lucas Lin
a652f6bec8 Merge "Expose NetworkScore to external caller" into sc-dev 2021-03-23 12:18:23 +00:00
Junyu Lai
3ef6584f1b Merge "Fix cannot find removeUnwantedCapability on R device" 2021-03-23 12:16:18 +00:00
Chiachang Wang
b948cc3ba0 Merge "Correct the logic in NetworkCapabilitiesTest" am: 2848cdf348 am: 06238861b5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1649297

Change-Id: I224e3c120ac07677d80396247f5b9e74c1bfd1a4
2021-03-23 12:10:57 +00:00
Chiachang Wang
5898f562ed Merge "Add NetworkRequest.Builder creating from an existing instance" am: 08bebe4609 am: eefea38ae5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1649294

Change-Id: I96516eb0d976d6e6250d2e96c316c560bfa21ab5
2021-03-23 12:09:42 +00:00
Chiachang Wang
06238861b5 Merge "Correct the logic in NetworkCapabilitiesTest" am: 2848cdf348
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1649297

Change-Id: I32bc9ee2db0b192513f782455a91d7336875a039
2021-03-23 12:07:47 +00:00
lucaslin
ad74ac58dd Get NetworkCapabilities from NetworkCallback
Register network callback for all networks and record
NetworkCapabilities for every networks. Once onDnsEvent is
triggered, use the netId it passes in to find the corresponding
NetworkCapabilities instead of using netId to create a Network
object(hidden API) then get the NetworkCapabilities by
ConnectivityManager#getNetworkCapabilities.

Bug: 182963397
Test: m
Test: atest IpConnectivityMetricsTest
Test: atest NetdEventListenerServiceTest
Change-Id: I91d68ca33253831b78def1ddeb074ba944a5d6ad
2021-03-23 20:02:09 +08:00
Chiachang Wang
2848cdf348 Merge "Correct the logic in NetworkCapabilitiesTest" 2021-03-23 11:46:31 +00:00
Chiachang Wang
eefea38ae5 Merge "Add NetworkRequest.Builder creating from an existing instance" am: 08bebe4609
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1649294

Change-Id: Ib990cb25d50c11b103e248c0c13c584e78aa3450
2021-03-23 11:36:07 +00:00
TreeHugger Robot
0da9e8b1e7 Merge "Fix cannot find removeUnwantedCapability on R device" into sc-dev 2021-03-23 11:03:43 +00:00
Chiachang Wang
08bebe4609 Merge "Add NetworkRequest.Builder creating from an existing instance" 2021-03-23 10:46:20 +00:00
Frank Li
2fdfc9fce8 Merge "[JS01]Remove hidden API usage of Connectivity Sevice" into sc-dev 2021-03-23 10:22:28 +00:00
Aaron Huang
f668c3b2b2 Remove Network, NetworkRequest metrics from jobscheduler
These metrics are deprecated so remove them from jobscheduler.
Also remove dumpDebug method from Network, NetworkRequest and
NetworkCapabilities because there's no caller anymore.

This change also for connectivity mainline module. These
three classes are inculded in framework-connectivity so
external module cannot have dependencies on its hidden API.
With this change, the dependencies can be removed.

Bug: 178777253
Test: FrameworksNetTests
      JobStoreTest
      adb shell dumpsys jobscheduler --proto
      CtsIncidentHostTestCases:JobSchedulerIncidentTest
Change-Id: Ie0c540303ba06b8fba029d2b98ae753afb08c963
2021-03-23 10:19:41 +00:00
lifr
a3f6cae74b Fix cannot success verify count of the networkAgent Config items on R
device

Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkAgentConfigTest
Fix: 183474500
Change-Id: Ie0fd5ba816c390bfb7bc6512d896a88482c217ec
2021-03-23 18:07:11 +08:00
junyulai
1ed0b04410 Fix cannot find removeUnwantedCapability on R device
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkCapabilitiesTest
Fix: 183473863
Merged-In: Icf2cda325795acee22a6c634e8d978f64c5ac3cb
Change-Id: Icf2cda325795acee22a6c634e8d978f64c5ac3cb
  (cherry-picked from ag/13966708)
2021-03-23 17:40:55 +08:00
junyulai
8428118d0f Fix cannot find removeUnwantedCapability on R device
Test: atest CtsNetTestCasesLatestSdk:android.net.NetworkCapabilitiesTest
Fix: 183473863
Change-Id: Icf2cda325795acee22a6c634e8d978f64c5ac3cb
2021-03-23 17:21:34 +08:00
Remi NGUYEN VAN
39d74d41ac Merge "Build service-connectivity with system_server API" into sc-dev 2021-03-23 09:18:53 +00:00
Remi NGUYEN VAN
f875d371c9 Merge "Add OsCompat" into sc-dev 2021-03-23 09:17:36 +00:00
Chiachang Wang
5c3c52975a Expose NetworkAgent constructor taking a NetworkScore parameter
Vpn constructs NetworkAgent with this exposed NetworkAgent
constructor. Given NetworkAgent is moving into the incoming
connectivity module, Vpn which is outside the module will not
be able to access it if it's not in the API surface. Thus,
expose it to allow Vpn to use it.

Bug: 182963397
Test: make update-api
Change-Id: Ic2357dcfff3233e0dd17b48b0e376a5095ef60fa
CTS-Coverage-Bug: 172183305
2021-03-23 08:51:05 +00:00
lucaslin
10d347a2fe Expose NetworkScore to external caller
NetworkScore will be a part of mainline module, so the external
callers cannot call its hidden APIs. Expose needed APIs to
the external callers.

CTS-Coverage-Bug: 182963397
Bug: 182963397
Test: m
Change-Id: Iddf8c71a5f51a40bc6ff78626b3e8ee530d1b7eb
2021-03-23 16:17:37 +08:00
Remi NGUYEN VAN
5f100ec524 Merge "Remove NetdService, NetworkStackClient dependency" into sc-dev 2021-03-23 08:08:01 +00:00
Chiachang Wang
29d00bc32d Correct the logic in NetworkCapabilitiesTest
setOwnerUid() and setAdministratorUids() should run in R+.
Previous logic will skip them in S+. Correct the logic to
what it should be.

Bug: 172183305
Test: atest android.net.NetworkCapabilitiesTest
Change-Id: Ic983aa00f930fb26350469ef093bcba2990433a4
2021-03-23 15:16:39 +08:00
Remi NGUYEN VAN
6f17b5020b Merge "Add NDK API for getprocnetwork" into sc-dev 2021-03-23 07:11:06 +00:00
Chiachang Wang
992047ed78 Add NetworkRequest.Builder creating from an existing instance
Provide a formal way to construct a new NetworkRequest from an
existing instance. The network capabilities inside the
NetworkRequest is hidden. There is no way to pass a
NetworkRequest and update its capabilities. Add
NetworkRequest.Builder creating from an existing instance to
allow to clone the network capabilities.

Bug: 172183305
Test: make update-api
Change-Id: I068462b2a1410daf67b0c95f2b643d396f079531
Merged-In: I068462b2a1410daf67b0c95f2b643d396f079531
2021-03-23 14:50:03 +08:00