Commit graph android_packages_modules_Co.../tests/unit/java
Message SHA1
Merge "Require location permission for ConnDiags WiFi only."
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-06-07 18:44:48 +00:00
5cfbc2e4cc
[NS09] Implement the new ranking code
At this stage, this is turned off. Unit tests will be
in a followup change.

Test: In a followup
Bug: 167544279
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: I4448a3546fbc1a3dddf757982c031c5f39ba2889
Change-Id: I4448a3546fbc1a3dddf757982c031c5f39ba2889
  (cherry-picked from ag/14010222 with fixes)

Chalard Jean   authored and   Junyu Lai   commited 2021-06-07 11:00:46 +00:00
e4aeac6d75
[NS07] Add the rest of the scoring policy
Bug: 167544279
Test: FrameworksNetTests
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: I5ea44a94ac6f16486274e9091f15a84734db2341
Change-Id: I5ea44a94ac6f16486274e9091f15a84734db2341
  (cherry-picked from ag/13988828)

Chalard Jean   authored and   Junyu Lai   commited 2021-06-07 10:57:49 +00:00
f3ff362210
[NS06] Implement the don't-reap mechanism
This exposes a mechanism for network providers to tell
the network stack that a given network must be kept up
for some specific reason. This is meant to be easier
for them than to have to file a request, in particular
because there is no guaranteed way to make sure the
request will be best matched by any given network.

Test: new test for this
Bug: 167544279
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: I238a3ee5ee9262477a23b897e4141769dd1505d1
Change-Id: I238a3ee5ee9262477a23b897e4141769dd1505d1
  (cherry-picked from ag/13929760)

Chalard Jean   authored and   Junyu Lai   commited 2021-06-07 10:57:49 +00:00
947acd4275
Updating tests to honor per-app TRACK_DEFAULT
Per-app APIs in ConnectivityService will now have their fallback
request which tracks the system default be of type TRACK_DEFAULT
as opposed to REQUEST. Existing tests which expect this fallback request
to be sent to network factories need to be updated to validate this
change.

Bug: 180452284
Bug: 176494815
Test: atest FrameworksNetTests
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: I5125755b3ed1ec535494e2d7a48c0860710ed056
Change-Id: I5125755b3ed1ec535494e2d7a48c0860710ed056
  (cherry-picked from ag/14286730)

James Mattis   authored and   Junyu Lai   commited 2021-06-07 10:57:48 +00:00
5c3bb5b1ce
[NS05] Feed network offer callbacks
The design is very simply expressed :
An offer is needed for a request if and only if that offer
might beat the satisfier for that request.

The implementation of "might beat" is NetworkRanker#mightBeat.

Test: FrameworksNetTests FrameworksWifiTests NetworkStackTests
Bug: 167544279
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: I0fe911eef2483ecbac48c733d56283b81538690a
Change-Id: I0fe911eef2483ecbac48c733d56283b81538690a
  (cherry-picked from 7b6a33bd50)

Chalard Jean   authored and   Junyu Lai   commited 2021-06-07 10:57:48 +00:00
0354d8c7e0
Implement mobile data preferred uids feature
- Read MOBILE_DATA_PREFERRED_UIDS setting when system ready
- Register MOBILE_DATA_PREFERRED_UIDS setting observer
- Send uid ranges to netd when update mobile data preferred uids

Bug: 171872461
Test: atest FrameworksNetTests
Merged-In: I5153c770650594e05dfa8cf230d7381d790f4a55
(cherry-pick with minor conflicts)

Change-Id: I5153c770650594e05dfa8cf230d7381d790f4a55

paulhu   authored and   Paul Hu   commited 2021-06-07 02:55:25 +00:00
51f77dcc49
Merge "Update allowed on restricted networks getter/setter"
Paul Hu   authored and   Gerrit Code Review   commited 2021-06-04 10:31:50 +00:00
c30c57c210
Remove NetdService, NetworkStackClient dependency
Netd should be obtained via getSystemService, and
ModuleNetworkStackClient must be used instead of NetworkStackClient for
modules.

Original change (project moved):
Ibe703ac56dd70673115cd8b95b44b856a7fc01f3

Bug: 171540887
Test: m
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: I6c8593712c0e86da139d425ef6240c5004e392e2

Remi NGUYEN VAN   commited 2021-06-01 18:41:33 +09:00
8ae54f7a3e
Update allowed on restricted networks getter/setter
As API review feedback, setting allowed on restricted networks
should be by uid instead of package name for security reason.
Thus, update the getter/setter to return/accept set of uids.

Bug: 188085693
Test: atest FrameworksNetTests
Merged-In: I979bf98075e6c9c0ed7e891582843fddb62643cb

Change-Id: I979bf98075e6c9c0ed7e891582843fddb62643cb

paulhu   commited 2021-05-27 16:24:50 +08:00
91e7806938
Require location permission for ConnDiags WiFi only.
This CL updates ConnectivityDiagnostics permission checks in
ConnectivityService to only require location permission for Networks
that have TRANSPORT_WIFI. This change is consistent with the location
restrictions required for the transports themselves. Previously,
location permissions were required for all Network types.

Bug: 187310575
Test: atest ConnectivityServiceTest ConnectivityDiagnosticsManagerTest
Change-Id: I48806533e4e705d2d9be45f3b3d3931d9294b167

Cody Kesting   commited 2021-05-25 13:43:48 -07:00
7474f67454
Merge "Improve IKEv2/IPsec VPN by proposing more IPsec algorithms"
Yan Yan   authored and   Gerrit Code Review   commited 2021-05-21 22:00:30 +00:00
70a118d80d
Merge "Improve IKEv2/IPsec VPN by proposing more IPsec algorithms"
Yan Yan   authored and   Gerrit Code Review   commited 2021-05-21 22:00:30 +00:00
5cb9e37a55
Improve IKEv2/IPsec VPN by proposing more IPsec algorithms
This commit allows IKEv2/IPsec VPN to propose more algorithms that
newly added in IpSecAlgorithm. Those new algorithms have stronger
security guarantees and better performances.

This commit also removes algorithm name validation because all
algorithms are URL encoded to ensure no special characters create
problems due to their use by VpnProfile for list or field delimiting
(e.g. rfc7539esp(chacha20,poly1305))

Bug: 185265778
Test: atest FrameworksNetTests, CtsNetTestCases
Test: All new algorithms are manually verified
Change-Id: I1de322c95aacc8924e95bcdbcfdbd1ec441de99c

Yan Yan   commited 2021-05-21 17:46:54 +00:00
86783c3711
Improve IKEv2/IPsec VPN by proposing more IPsec algorithms
This commit allows IKEv2/IPsec VPN to propose more algorithms that
newly added in IpSecAlgorithm. Those new algorithms have stronger
security guarantees and better performances.

This commit also removes algorithm name validation because all
algorithms are URL encoded to ensure no special characters create
problems due to their use by VpnProfile for list or field delimiting
(e.g. rfc7539esp(chacha20,poly1305))

Bug: 185265778
Test: atest FrameworksNetTests, CtsNetTestCases
Test: All new algorithms are manually verified
Change-Id: I1de322c95aacc8924e95bcdbcfdbd1ec441de99c

Yan Yan   commited 2021-05-21 17:46:54 +00:00
f3cf55f793
Merge "Check location permission for ConnDiags last."
Cody Kesting   authored and   Gerrit Code Review   commited 2021-05-20 21:27:46 +00:00
7f092f1f90
Merge "Check location permission for ConnDiags last."
Cody Kesting   authored and   Gerrit Code Review   commited 2021-05-20 21:27:46 +00:00
c5f9939bf3
Merge "Move IoUtils#deleteContents from CorePlatformApi set to framework"
Nikita Iashchenko   authored and   Gerrit Code Review   commited 2021-05-18 22:13:56 +00:00
1ae284330f
Merge "Move IoUtils#deleteContents from CorePlatformApi set to framework"
Nikita Iashchenko   authored and   Gerrit Code Review   commited 2021-05-18 22:13:56 +00:00
fc41cdfd4c
Merge "Support to query TYPE_WIFI usage with subscriberId"
Les Lee   authored and   Gerrit Code Review   commited 2021-05-18 13:02:07 +00:00
c0e15c5db2
Merge "Support to query TYPE_WIFI usage with subscriberId"
Les Lee   authored and   Gerrit Code Review   commited 2021-05-18 13:02:07 +00:00
ad9e8eeabd
Merge "Add metered filter for API: buildTemplateCarrier"
Les Lee   authored and   Gerrit Code Review   commited 2021-05-18 13:01:38 +00:00
e14af82411
Merge "Add metered filter for API: buildTemplateCarrier"
Les Lee   authored and   Gerrit Code Review   commited 2021-05-18 13:01:38 +00:00
4c7cc726d1
Check location permission for ConnDiags last.
This CL updates ConnectivityService to check location permissions for
ConnectivityDiagnostics callbacks last in the permission check process.
This minimizes misattribution of location access for networks that an
app is not administering.

This CL also updates ConnectivityDiagnosticsManager documentation to
clearly state that location permissions are required in order to receive
callbacks.

Bug: 187310575
Test: atest ConnectivityDiagnosticsManagerTest
Test: atest ConnectivityServiceTest
Change-Id: I2dbeddac6273e2392ccaeae51a1c7776d6d3da75

Cody Kesting   commited 2021-05-17 19:36:47 -07:00
160ef3936a
Check location permission for ConnDiags last.
This CL updates ConnectivityService to check location permissions for
ConnectivityDiagnostics callbacks last in the permission check process.
This minimizes misattribution of location access for networks that an
app is not administering.

This CL also updates ConnectivityDiagnosticsManager documentation to
clearly state that location permissions are required in order to receive
callbacks.

Bug: 187310575
Test: atest ConnectivityDiagnosticsManagerTest
Test: atest ConnectivityServiceTest
Change-Id: I2dbeddac6273e2392ccaeae51a1c7776d6d3da75

Cody Kesting   commited 2021-05-17 19:36:47 -07:00
8533f883c2
Merge "Register APPS_ALLOWED_ON_RESTRICTED_NETWORKS setting observer"
Paul Hu   authored and   Gerrit Code Review   commited 2021-05-17 06:45:52 +00:00
ca98d3d814
Merge "Register APPS_ALLOWED_ON_RESTRICTED_NETWORKS setting observer"
Paul Hu   authored and   Gerrit Code Review   commited 2021-05-17 06:45:52 +00:00
43864e564b
Merge "Read APPS_ALLOWED_ON_RESTRICTED_NETWORKS setting from PermissionMonitor"
Paul Hu   authored and   Gerrit Code Review   commited 2021-05-17 03:04:59 +00:00
0576511565
Merge "Read APPS_ALLOWED_ON_RESTRICTED_NETWORKS setting from PermissionMonitor"
Paul Hu   authored and   Gerrit Code Review   commited 2021-05-17 03:04:59 +00:00
8665f56ca1
Register APPS_ALLOWED_ON_RESTRICTED_NETWORKS setting observer
PermissionMonitor register APPS_ALLOWED_ON_RESTRICTED_NETWORKS
setting observer to listen setting changed callback. Then update
or revoke permission for those apps.

Bug: 185149952
Test: atest FrameworksNetTests
Change-Id: I4b6a21bd3f47b7bcaac36fcabf1202a5a84a4520

paulhu   authored and   Paul Hu   commited 2021-05-16 15:52:36 +00:00
85b4bec5b3
Register APPS_ALLOWED_ON_RESTRICTED_NETWORKS setting observer
PermissionMonitor register APPS_ALLOWED_ON_RESTRICTED_NETWORKS
setting observer to listen setting changed callback. Then update
or revoke permission for those apps.

Bug: 185149952
Test: atest FrameworksNetTests
Change-Id: I4b6a21bd3f47b7bcaac36fcabf1202a5a84a4520

paulhu   authored and   Paul Hu   commited 2021-05-16 15:52:36 +00:00
f11da7e205
Read APPS_ALLOWED_ON_RESTRICTED_NETWORKS setting from PermissionMonitor
Let PermissionMonitor read APPS_ALLOWED_ON_RESTRICTED_NETWORKS
setting and grant netd system permission to uids whose package
name is listed in setting.

Bug: 185149952
Test: atest FrameworksNetTests
Change-Id: I856b545c0339a262abbe9d432cfda125bc82dc12

paulhu   commited 2021-05-16 23:48:55 +08:00
4f18561e9c
Read APPS_ALLOWED_ON_RESTRICTED_NETWORKS setting from PermissionMonitor
Let PermissionMonitor read APPS_ALLOWED_ON_RESTRICTED_NETWORKS
setting and grant netd system permission to uids whose package
name is listed in setting.

Bug: 185149952
Test: atest FrameworksNetTests
Change-Id: I856b545c0339a262abbe9d432cfda125bc82dc12

paulhu   commited 2021-05-16 23:48:55 +08:00
a7b9535fde
Support to query TYPE_WIFI usage with subscriberId
Previous the API ignores subscriberId when network type is WIFI.
Allow caller to call querySummaryXXXX with TYPE: WIFI
+ subscriberId: IMSI to get carrier merged wifi usage which matches the wifi
network with the given IMSI.

Bug: 176396812
Test: atest -c NetworkStatsServiceTest
Change-Id: Ia033521a24e2bb56182d74a41bb2b39710571782

lesl   authored and   Les Lee   commited 2021-05-16 22:18:32 +08:00
c22e8b8413
Support to query TYPE_WIFI usage with subscriberId
Previous the API ignores subscriberId when network type is WIFI.
Allow caller to call querySummaryXXXX with TYPE: WIFI
+ subscriberId: IMSI to get carrier merged wifi usage which matches the wifi
network with the given IMSI.

Bug: 176396812
Test: atest -c NetworkStatsServiceTest
Change-Id: Ia033521a24e2bb56182d74a41bb2b39710571782

lesl   authored and   Les Lee   commited 2021-05-16 22:18:32 +08:00
614551c3b6
Merge changes I3ba50cbd,I970ee365
* changes:
  [FUI29] Migrate ConnectivityService to use getAllNetworkStateSnapshots
  [FUI27] Fix internal naming of notifyNetworkStatus

Junyu Lai   authored and   Gerrit Code Review   commited 2021-05-15 16:21:38 +00:00
65b4d74237
Merge changes I3ba50cbd,I970ee365
* changes:
  [FUI29] Migrate ConnectivityService to use getAllNetworkStateSnapshots
  [FUI27] Fix internal naming of notifyNetworkStatus

Junyu Lai   authored and   Gerrit Code Review   commited 2021-05-15 16:21:38 +00:00
2a7ab18c0b
Merge "QOS filter matching support based on remote address and port number for connected sockets"
Jayachandran Chinnakkannu   authored and   Gerrit Code Review   commited 2021-05-14 20:02:30 +00:00
02dabf7bb6
Merge "QOS filter matching support based on remote address and port number for connected sockets"
Jayachandran Chinnakkannu   authored and   Gerrit Code Review   commited 2021-05-14 20:02:30 +00:00
6c5553aaaa
[FUI27] Fix internal naming of notifyNetworkStatus
Test: TH
Bug: 174123988
Change-Id: I970ee365ca221956ee85788005d331374b5fa71a

junyulai   commited 2021-05-14 19:48:17 +08:00
1df306006e
[FUI27] Fix internal naming of notifyNetworkStatus
Test: TH
Bug: 174123988
Change-Id: I970ee365ca221956ee85788005d331374b5fa71a

junyulai   commited 2021-05-14 19:48:17 +08:00
07f3432fab
[FUI26] Address comments on aosp/1560408
Test: TH
Bug: 174123988
Change-Id: I949eeb8903e903d8ede90521442b1f917d5cdfeb

junyulai   commited 2021-05-14 15:57:44 +08:00
369be87265
[FUI26] Address comments on aosp/1560408
Test: TH
Bug: 174123988
Change-Id: I949eeb8903e903d8ede90521442b1f917d5cdfeb

junyulai   commited 2021-05-14 15:57:44 +08:00
c6422b78ea
Rename *Iface* APIs to *Interface*
Address API review feedback, other APIs have been refering to
these as "interface" instead of "iface" so migrate the APIs named
*Iface* to *Interface*.

(cherry-picked from ag/14326779)
Bug: 183972554
Test: atest android.net.UnderlyingNetworkInfoTest
Merged-In: I38b476e762fb57fa88c4a789092d0af6f5330d80
Change-Id: I38b476e762fb57fa88c4a789092d0af6f5330d80

Aaron Huang   commited 2021-05-14 11:05:22 +08:00
3c4e669929
Rename *Iface* APIs to *Interface*
Address API review feedback, other APIs have been refering to
these as "interface" instead of "iface" so migrate the APIs named
*Iface* to *Interface*.

(cherry-picked from ag/14326779)
Bug: 183972554
Test: atest android.net.UnderlyingNetworkInfoTest
Merged-In: I38b476e762fb57fa88c4a789092d0af6f5330d80
Change-Id: I38b476e762fb57fa88c4a789092d0af6f5330d80

Aaron Huang   commited 2021-05-14 11:05:22 +08:00
9ff12842da
Add metered filter for API: buildTemplateCarrier
This CL modifies NetworkTemplate#buildTemplateCarrier to force on
metered carrier network and rename to buildTemplateCarrierMetered.
This method was introduced recently and has no callers.

This method will be used in Settings and NetworkPolicyManagerService
to display and manage data usage on carrier metered networks.

Settings/NetworkPolicyManagerService will use it instead of the existing
method buildTemplateMobileAll method, which only matches metered networks.
That code will change from matching metered mobile networks to matching
metered carrier networks.

Note: The carrier metered network includes metered mobile network and
metered "merged carrier wifi network" that is a specific cerrier wifi network
which provides the same user experience as mobile.

Bug: 176396812
Test: atest -c NetworkTemplateTest
Change-Id: I7196d62bb60844458a6c4b1d94e2baccb71e15cd

lesl   authored and   Les Lee   commited 2021-05-14 11:04:17 +08:00
70d9ccdc9b
Add metered filter for API: buildTemplateCarrier
This CL modifies NetworkTemplate#buildTemplateCarrier to force on
metered carrier network and rename to buildTemplateCarrierMetered.
This method was introduced recently and has no callers.

This method will be used in Settings and NetworkPolicyManagerService
to display and manage data usage on carrier metered networks.

Settings/NetworkPolicyManagerService will use it instead of the existing
method buildTemplateMobileAll method, which only matches metered networks.
That code will change from matching metered mobile networks to matching
metered carrier networks.

Note: The carrier metered network includes metered mobile network and
metered "merged carrier wifi network" that is a specific cerrier wifi network
which provides the same user experience as mobile.

Bug: 176396812
Test: atest -c NetworkTemplateTest
Change-Id: I7196d62bb60844458a6c4b1d94e2baccb71e15cd

lesl   authored and   Les Lee   commited 2021-05-14 11:04:17 +08:00
575b5569f6
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

Jayachandran C   commited 2021-05-13 09:50:13 -07:00
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

Jayachandran C   commited 2021-05-13 09:50:13 -07:00
735e1ce55b
Move IoUtils#deleteContents from CorePlatformApi set to framework
As a part of internal core libraries cleanup move usages of
IoUtils#deleteContents from CorePlatformApi set to framework.

Bug: 154796679
Test: m update-api
Change-Id: If7037029026b6753ab64be09aa52c40e04d5c7b1

Nikita Iashchenko   commited 2021-05-13 14:23:54 +01:00
bac20e3a23