Commit Graph

749 Commits

Author SHA1 Message Date
Remi NGUYEN VAN
dd5f6037ec Migrate framework-connectivity internal resources
Use ServiceConnectivityResources instead.
Start by creating resources in the ServiceConnectivityResources package
to match the internal configuration, and common overlays.

Bug: 182125649
Test: device boots, has connectivity
Change-Id: I77a3efca2cd644f9828db1ed5d3cae8070fb8363
2021-03-18 09:02:13 +00:00
Paul Hu
c424a39437 Merge "Remove Settings.Global.TCP_DEFAULT_INIT_RWND on CS" am: 86203dde89 am: a7153b1fe8 am: 5e087c80d3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1635043

Change-Id: I2a83ab615ae2b40304a65f7ea8e40c6a93fc122a
2021-03-17 22:20:36 +00:00
Remi NGUYEN VAN
63e13a38e6 Merge "Remove usage of networkAttributes" am: f6ecb0017c am: 1a0ccc5771 am: 0aff3ed968
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1623260

Change-Id: I84aa41ee98535b3b258e52cb67b8f7964d63851b
2021-03-17 22:18:55 +00:00
Chalard Jean
d28b0419e7 Merge changes I335e82e2,I84ba363d,I8f18083b,I854a952d,I00e23441 am: 3ee9b7f251 am: f468d78fa5 am: 35b284e0ff
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1622621

Change-Id: I5fa8e7b8bf35a5464868fdca4d115b3f9132c65f
2021-03-17 22:13:06 +00:00
Junyu Lai
dc8f8d8b69 Merge "[VCN13] Implement tracking best matching network" am: f98037abb3 am: a2a3640aab am: 14865c4e07
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1633519

Change-Id: Ie252014cd9047c27fad3e451b80047493935dc3d
2021-03-17 16:08:50 +00:00
Chalard Jean
320315ac8c Merge "[NS01] Add NetworkScore" am: 1a645067e5 am: 8cde8bbe9a am: 2d07595731
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556099

Change-Id: I953a773f8914152578a98d71b43d0a2e30a51aba
2021-03-17 16:04:22 +00:00
Paul Hu
86203dde89 Merge "Remove Settings.Global.TCP_DEFAULT_INIT_RWND on CS" 2021-03-17 14:44:17 +00:00
Remi NGUYEN VAN
f6ecb0017c Merge "Remove usage of networkAttributes" 2021-03-17 11:24:28 +00:00
paulhu
62dc76edf0 Remove Settings.Global.TCP_DEFAULT_INIT_RWND on CS
TCP_DEFAULT_INIT_RWND setting has never been set before, CS
always read the tcp receive window size from
net.tcp.default_init_rwnd then set to net.tcp_def_init_rwnd.
Thus, remove the unnecessary setting from CS, and the property
doesn't need to set either. Because aosp/1639922 migrate the
properties, the default value has been set to kernel already.

Bug: 182538166
Test: atest FrameworksNetTests
Change-Id: I13e175ab4dea72446af7df4a25e307e5934fa813
2021-03-17 11:14:35 +00:00
Chalard Jean
3ee9b7f251 Merge changes I335e82e2,I84ba363d,I8f18083b,I854a952d,I00e23441
* changes:
  Remove per-user preference when the user is removed
  Expose the enterprise per-profile networking API.
  Implement setNetworkPreferenceForUser.
  Public API for per-profile network preference.
  Add tests for setNetworkPreferenceForUser
2021-03-17 05:48:18 +00:00
junyulai
dbf52a2834 [VCN13] Implement tracking best matching network
This is done by:
  1. In requestNetwork, provide a basic permission check.
  2. rematchNetworksAndRequests: no change, since non listen
     requests will be automatically processed to track
     best satisfying network.
  3. applyNetworkReassignment: no change, since non-request
     will not be sent to factories.

Test: atest ConnectivityServiceTest#testRegisterBestMatchingNetworkCallback_noIssueToFactory
Test: atest ConnectivityServiceTest#testRegisterBestMatchingNetworkCallback_trackBestNetwork
Bug: 175662146
Change-Id: I8cf4ab334df6812d84cdda160e9b72b6f54062af
2021-03-16 21:30:55 +08:00
Chalard Jean
d1343a21e9 Remove per-user preference when the user is removed
Test: new test for this
Change-Id: I335e82e29ec8f4c8da9def8b40153858cfd5bacb
2021-03-16 12:14:12 +00:00
Chalard Jean
0bd0dc2c83 Add tests for setNetworkPreferenceForUser
Test: this
Change-Id: I00e2344118408da307439a0a993eb67cb17bf777
2021-03-16 12:11:27 +00:00
Remi NGUYEN VAN
62966b715b Remove usage of networkAttributes
networkAttributes is a legacy configuration that is now only used to
configure which legacy type networks are supported, and what the restore
timer is for that network type, for the deprecated
startUsingNetworkFeature API.

Use a dedicated resource for the restore timers, and build supported
legacy network types using hasSystemFeature for wifi, wifi p2p,
bluetooth, proxy types, and TelephonyManager.isDataCapable for the
mobile types.

Bug: 146206136
Test: atest FrameworksNetTests
Change-Id: I3a771d3de6c5e912f18d2834e3a50af797ac4991
2021-03-16 16:01:40 +09:00
Chalard Jean
1a645067e5 Merge "[NS01] Add NetworkScore" 2021-03-16 06:36:07 +00:00
Remi NGUYEN VAN
03aeadc030 Merge "Create ServiceConnectivityResources" 2021-03-16 02:29:31 +00:00
Chalard Jean
5c4bb91134 [NS01] Add NetworkScore
As attested by numerous TODOs in the code, a new way of
representing network quality and policy is needed instead
of an int.

An int representing the quality of the network requires
all parties using it to know how all other parties are
using it, and implementation details about the decision
algorithm. For all intents and purposes, the selection
is left to individual network factories who try to
achieve a desired result while piecing together all
possible states of the system.

As the number of such cases and desires increases, this
becomes both intractable and unmaintainable. Indeed, at
this time in the codebase nobody can really predict exactly
how a given change in score will affect selection across
the board, and it is essentially impossible to figure out
the behavior of network selection by inspecting the code
because the moving parts are scattered throughout the
entire codebase.

Having an object encapsulating policy and quality values
will let us centralize the selection and make it again
possible to maintain without knowledge of all behaviors
of all network factories. It will also provide better
guarantees of respecting policy, and allow bugfixes that
were not possible before because they'd touch too many
parts of the code.

Test: FrameworksNetTests FrameworksWifiTests NetworkStackTests
Change-Id: I3185a6412b9b659798faf0c6882699e9c63cc115
2021-03-15 09:49:47 +00:00
Roshan Pius
9efe4fad00 Merge "ConnectivityManager: Provide API's to include location sensitive info" am: a982725793 am: 890fdb016e am: 0659f32f4d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1595396

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Icf60935623b62e29cb2ba52b4de554c7f0d78ef1
2021-03-12 07:12:03 +00:00
Remi NGUYEN VAN
542b351a4d Create ServiceConnectivityResources
Create the ServiceConnectivityResources package, which contains
resources Connectivity unbundled from platform resources.

Migrate the first few resources from ConnectivityService that have no
RRO in AOSP. To avoid boot time impact, avoid loading the resources in
the ConnectivityService constructor.

Bug: 182125649
Test: atest FrameworksNetTests
Merged-In: I77ac6f4303c54acc96f16e18ef02add30298ff3d
Change-Id: I77ac6f4303c54acc96f16e18ef02add30298ff3d
2021-03-12 12:09:13 +09:00
Roshan Pius
d9c78f6992 ConnectivityManager: Provide API's to include location sensitive info
Existing NetworkCallback users will get NetworkCapabilities with
location sensitive data removed (except for ownerUid which will be
added for existing apps for backwards compatibility). Apps
have to opt-in to receive location sensitive data.

Note: This was chosen because WifiInfo is the only TransportInfo tha
has location sensitive info & that was added only in Android 12. If we
choose to default to true, all existings apps retrieving
NetworkCapabilities for wifi networks will be blamed for location access
unnecessarily.

Changes:
i) Add a flag in NetworkCallback creation to retrieve
NetworkCapabilities with location sensitive info in their callback.
(More flags are being planned for NetworkCallback for throttling
callback frequency, etc)
ii) For NetworkCapabilities.getOwnerUid(), we will continue to send the
data for apps targeting older SDK (since this is an existing field and
the new flag defaults location sensitive data to off).

Bug: 156867433
Test: atest android.net
Test: atest com.android.server
Change-Id: If70b5ea6f5c8885f0c353c8df08a826d55fe7f7a
2021-03-11 18:27:18 -08:00
Remi NGUYEN VAN
7c4d278749 Merge "Create ServiceConnectivityResources" into sc-dev 2021-03-12 02:10:20 +00:00
Treehugger Robot
1c80dea734 Merge changes Iac9487e8,Ifa411c7b am: 999506022f am: 7d70dd9c33 am: bec7ce5cf4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1622675

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If1b3f0447705f910467a52d2504ba1aaef850a80
2021-03-12 00:49:24 +00:00
junyulai
229c646608 [VCN11] Make requestBackgroundNetwork requires handler
Test: atest FrameworksNetTests android.net.cts.ConnectivityManagerTest
Bug: 175662146
Change-Id: Iac9487e8de8bfdd87fc7a0153b228ae2a7ba4e19
2021-03-11 21:05:27 +08:00
junyulai
1f16d21527 [VCN10] Add new API to listen for highest score network
Test: atest ConnectivityServiceTest#testRegisterBestMatchingNetworkCallback
Bug: 175662146
Change-Id: Ifa411c7b53da789c74fff7e1a95f9c9ebf5bd05c
2021-03-11 21:04:06 +08:00
Lorenzo Colitti
f8d3be378f Merge "Don't start clatd if disabled by vendor property." am: a517079da0 am: c147019ab2 am: 67b99e7bee
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1625702

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I6989361f1dae72cb94d6e6cf6144ae61cb80c328
2021-03-11 13:02:29 +00:00
Lorenzo Colitti
a517079da0 Merge "Don't start clatd if disabled by vendor property." 2021-03-11 12:22:34 +00:00
Lorenzo Colitti
c94fb65057 Merge "Unbreak extraInfo values returned to apps." am: 78cf2f60e5 am: 4fe7f5bf8b am: f7bc7a0532
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1624040

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I5e50ac962959387ec42ee644376e1c10df0dc677
2021-03-11 10:09:42 +00:00
Lorenzo Colitti
78cf2f60e5 Merge "Unbreak extraInfo values returned to apps." 2021-03-11 08:06:03 +00:00
Lorenzo Colitti
d2a152ebcb Merge "Set extraInfo on cellular TestNetworkAgents." am: f0f69b46e2 am: 55c89d19f8 am: bfd6610a59
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1624039

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I41e016fa2cf4907905e3c4f9ab4dbc3d7c0ad418
2021-03-11 05:17:45 +00:00
Lorenzo Colitti
f0f69b46e2 Merge "Set extraInfo on cellular TestNetworkAgents." 2021-03-11 03:31:49 +00:00
Aaron Huang
b6240c03d1 Merge "Remove IBatteryStats from ConnectivityService module" am: a06c417b0f am: 7ed2eb0997 am: fe4b159779
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1623262

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I58a89eee64c57fbf04e21ee0996eff435584f709
2021-03-11 03:08:13 +00:00
Aaron Huang
a06c417b0f Merge "Remove IBatteryStats from ConnectivityService module" 2021-03-11 02:04:41 +00:00
Lorenzo Colitti
305b301f2b Don't start clatd if disabled by vendor property.
Fix: 182333299
Test: new unit tests
Change-Id: Ic15dc4fff6a13aa916e3d2dc6203829e96ddeda4
2021-03-11 00:59:14 +09:00
Lorenzo Colitti
8a7bb857ac Unbreak extraInfo values returned to apps.
These were broken by aosp/1553463, which made filterNetworkInfo
unconditionally call setDetailedState with a reason of "" and an
extraInfo of null.

Fix both synchronous getter APIs (e.g., getNetworkInfo) and
CONNECTIVITY_ACTION broadcasts by calling a new
filterForLegacyLockdown method that behaves similarly to how the
now-deleted LockdownVpnTracker#augmentNetworkInfo used to behave.

While I'm at it, move back to private a method that was public
only because LockdownVpnTracker used it.

Fix: 181855958
Test: new unit test coverage
Change-Id: I2c7b88fcec9dd36b45cb51db8d19b3ee8bad44a6
2021-03-11 00:59:14 +09:00
Lorenzo Colitti
e93309bff7 Set extraInfo on cellular TestNetworkAgents.
This makes the test more realistic, since telephony always puts
the APN name in the extraInfo field. It also makes it easy to
test that various APIs properly return the extra info without
plumbing a new parameter through TestNetworkAgentWrapper,
NetworkAgentWrapper, and InstrumentedNetworkAgent.

Also make the extraInfo and the legacyType available to tests.
This will be used in future tests that assert the contents of
extraInfo.

Bug: 181855958
Test: test-only change
Change-Id: If4eddb6cd9e70bb33e10d72aceebaea843244246
2021-03-10 23:33:08 +09:00
Chalard Jean
3f52c2a117 Merge "Fix a bug where listen callbacks would not be called" am: d36130f759 am: 2d51f15105 am: 0a07cc6615
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1620900

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I216167c2809ddc12e4a92faedf3bb4dc5c1a56cb
2021-03-10 02:37:36 +00:00
Chalard Jean
d36130f759 Merge "Fix a bug where listen callbacks would not be called" 2021-03-10 00:32:58 +00:00
Aaron Huang
558da330a4 Remove IBatteryStats from ConnectivityService module
Currently ConnectivityService calls the methods in
BatteryStatsService through BatteryStatsManager so
IBatteryStats can be removed from ConnectivityService.

Bug: 171686421
Test: FrameworksNetTests
Change-Id: I559369c9900e8100cdae187bc9cec603ed85a131
2021-03-09 21:39:17 +08:00
Aaron Huang
c4f2a30c20 Merge changes I1d1f0d2d,Ifbd4a978
* changes:
  Communicate with BatteryStatsService through BatteryStatsManager
  Add a new API in BatteryStatsManager for connectivity service
2021-03-09 10:33:56 +00:00
Chalard Jean
92eab0dea7 Fix a bug where listen callbacks would not be called
NetworkAgentInfos cache the list of requests they satisfy,
and that list is used to send callbacks. Therefore, when
the TRACK_DEFAULTs are copied, this list needs to be
updated.

The best way to do this is to figure out what was the old
active request and find which requests corresponds to it
in the new list, and then upon registering adding the
active request to the relevant satisfier if present.

A few other ways can be considered like replacing the
request as it gets added, but this would temporarily
increase the number of callbacks allocated to the app
and risks crashing it for no good reason ; furthermore
the call to remove would have to be eschewed somehow
for those requests that are replaced. This is much
simpler.

Test: new test for this. This also passes the future
      tests for per-profile default network preference.
Change-Id: I001351e5c478c2c77cbf2844abca77b205291778
2021-03-09 19:05:55 +09:00
Remi NGUYEN VAN
9e8264dc32 Create ServiceConnectivityResources
Create the ServiceConnectivityResources package, which contains
resources Connectivity unbundled from platform resources.

Migrate the first few resources from ConnectivityService that have no
RRO in AOSP. To avoid boot time impact, avoid loading the resources in
the ConnectivityService constructor.

Bug: 182125649
Test: atest FrameworksNetTests
Change-Id: I77ac6f4303c54acc96f16e18ef02add30298ff3d
2021-03-09 17:41:51 +09:00
Aaron Huang
d394db6b4f Communicate with BatteryStatsService through BatteryStatsManager
Mainline connectivity service is only allowed to use formal
APIs. Use new system API in BatteryStatsManager instead of
calling BatteryStatsService directly.

Bug: 171686421
Test: FrameworksNetTests
Change-Id: I1d1f0d2d456003e842ad77519667c0532995610d
Merged-In: I1d1f0d2d456003e842ad77519667c0532995610d
2021-03-09 06:29:30 +00:00
Aaron Huang
af4e6b7cc8 Communicate with BatteryStatsService through BatteryStatsManager
Mainline connectivity service is only allowed to use formal
APIs. Use new system API in BatteryStatsManager instead of
calling BatteryStatsService directly.

Bug: 171686421
Test: FrameworksNetTests
Change-Id: I1d1f0d2d456003e842ad77519667c0532995610d
2021-03-08 15:04:22 +08:00
James Mattis
c4b1e28957 Merge "Applying OEM network pref to all users" am: c1a548b132 am: b6625e5976 am: a5e243419a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1612760

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I9988f9ecac19976dd78dbcf9a749adba5daa578c
2021-03-05 22:37:45 +00:00
James Mattis
c1a548b132 Merge "Applying OEM network pref to all users" 2021-03-05 19:09:24 +00:00
Treehugger Robot
f34a8e1bb2 Merge "[FUI22] Support getAllNetworkStateSnapshot" am: 4c73e05c1d am: 1e1379b245 am: ee3fc01443
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1614779

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I52f8339bd1cda35a3f26f28fd3c0165f6f6ff91e
2021-03-05 07:10:46 +00:00
Treehugger Robot
4c73e05c1d Merge "[FUI22] Support getAllNetworkStateSnapshot" 2021-03-05 05:16:43 +00:00
Janis Danisevskis
421c5739ea Merge "Keystore 2.0: Make VPN Keystore 2.0 ready." 2021-03-05 02:57:34 +00:00
James Mattis
10b6a94f82 Unit test automation for Multi-Default Tracking
Unit test automation validating how multiple default networks are
tracked within ConnectivityService when set by network preferences
used with setOemNetworkPreference() API functionality.

Bug: 178632672
Bug: 172347841
Bug: 170068946
Test: atest FrameworksNetTests
Change-Id: Iae1935944214efaa8a21636c55e6d8be816275f7
Merged-In: Iae1935944214efaa8a21636c55e6d8be816275f7
2021-03-04 13:13:48 -08:00
James Mattis
b6a486bf63 Applying OEM network pref to all users
Updating handleSetOemNetworkPreference so that the given policy is
applied to all users on the device. Additionally, remove uids for all
users/apps so that stale uids don't stay present after rematch. Finally,
small cleanup on how we deal with remote exceptions.

Bug: 181581017
Bug: 176494815
Test: atest FrameworksNetTests
atest NetworkStackTests
atest FrameworksNetIntegrationTests
atest NetworkStackIntegrationTests
atest CtsNetTestCasesLatestSdk

Change-Id: I214717ee0c78cfe8322e551c2c2e9dc01c0242b2
2021-03-04 11:32:10 -08:00