Commit Graph

2762 Commits

Author SHA1 Message Date
Junyu Lai
458a60dab5 Merge changes I3ba50cbd,I970ee365 into sc-dev
* changes:
  [FUI29] Migrate ConnectivityService to use getAllNetworkStateSnapshots
  [FUI27] Fix internal naming of notifyNetworkStatus
2021-05-19 12:36:03 +00:00
Remi NGUYEN VAN
1ac0e834c9 Merge "Move config_apf* resources to NetworkStack" into sc-dev 2021-05-19 07:54:19 +00:00
lesl
f96f02703e 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
Merged-In: I7196d62bb60844458a6c4b1d94e2baccb71e15cd
2021-05-19 02:53:39 +00:00
lesl
cf4a1b59ea 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
Merged-In: Ia033521a24e2bb56182d74a41bb2b39710571782
2021-05-19 02:53:16 +00:00
Remi NGUYEN VAN
be047e2855 Move config_apf* resources to NetworkStack
The resources are only read by NetworkStack through their respective
ApfCapabilities SystemApi methods.
As the resources are being migrated out of frameworks/base resources
anyway, move them directly to NetworkStack instead of moving them to
ServiceConnectivityResources.

Also test that the framework resources are not overlaid or modified.
This should avoid OEM integration errors where the overlays are kept as
in R, without overlaying the resource in the NetworkStack package.

Bug: 185850634
Test: atest CtsNetTestCases
BYPASS_INCLUSIVE_LANGUAGE_REASON=Need to mention legacy APIs

Merged-In: I7a15ddcad5af11fa307d9dbe3a77b31a1179e5b3
(clean cherry-pick)

Change-Id: I7a15ddcad5af11fa307d9dbe3a77b31a1179e5b3
2021-05-19 11:00:58 +09:00
Remi NGUYEN VAN
999427e138 Merge "Move config_apf* resources to NetworkStack" 2021-05-19 00:58:52 +00:00
Nikita Iashchenko
fc41cdfd4c Merge "Move IoUtils#deleteContents from CorePlatformApi set to framework" 2021-05-18 22:13:56 +00:00
Paul Hu
206157788c 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
Merged-In: I4b6a21bd3f47b7bcaac36fcabf1202a5a84a4520
(clean cherry-pick)

Change-Id: I4b6a21bd3f47b7bcaac36fcabf1202a5a84a4520
2021-05-18 14:19:56 +00:00
Paul Hu
deb3f2e7a7 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
Merged-In: I856b545c0339a262abbe9d432cfda125bc82dc12
(clean cherry-pick)

Change-Id: I856b545c0339a262abbe9d432cfda125bc82dc12
2021-05-18 14:16:57 +00:00
Les Lee
ad9e8eeabd Merge "Support to query TYPE_WIFI usage with subscriberId" 2021-05-18 13:02:07 +00:00
Les Lee
4c7cc726d1 Merge "Add metered filter for API: buildTemplateCarrier" 2021-05-18 13:01:38 +00:00
Treehugger Robot
c831d5a60b Merge "[VCN21.1] Verify capability is not added if specifier is present" am: 20d9f4722e am: 82e910ecc5 am: 68f8081aae
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1705134

Change-Id: Iba23024382a3b9ab8d8f0946eb902c6c3dd19975
2021-05-18 10:16:58 +00:00
Treehugger Robot
68f8081aae Merge "[VCN21.1] Verify capability is not added if specifier is present" am: 20d9f4722e am: 82e910ecc5
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1705134

Change-Id: Iefa25664714ee187be4ddc4359afcd0968ab4ecf
2021-05-18 09:56:05 +00:00
Treehugger Robot
20d9f4722e Merge "[VCN21.1] Verify capability is not added if specifier is present" 2021-05-18 08:35:06 +00:00
Lorenzo Colitti
ad9c644b6b Add a CTS tests for setIncludeOtherUidNetworks.
Bug: 187921303
Test: test-only change
Ignore-AOSP-First: avoid merge conflicts
Change-Id: I8e259041dad3fb9c38202cbb12b344de15f4101f
2021-05-18 04:43:20 +00:00
Lorenzo Colitti
86714b1fd2 Allow unprivileged NetworkCallbacks to see other UIDs' networks.
Currently, unprivileged apps can call getAllNetworks() to see
all networks on the system, even networks that do not apply to
them. Allow them to do this via NetworkCallbacks as well.

This is the last piece of information that was only available
through getAllNetworks, so this CL deprecates that API.

Bug: 187921303
Test: new unit tests
Test: CTS test in other CL in topic
Change-Id: I30f1021927d3c8eae6525116c61ff4a4acecff6d
2021-05-18 12:24:07 +09:00
Cody Kesting
8533f883c2 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
2021-05-17 19:36:47 -07:00
junyulai
f15fb56f73 [VCN21.1] Verify capability is not added if specifier is present
Test: atest NetworkRequestTest#testBypassingVcn
Bug: 176939355
Change-Id: I3fdd7a08ac9fd667633b68dc935abce024dd3a4d
2021-05-17 07:03:53 +00:00
Paul Hu
43864e564b Merge "Register APPS_ALLOWED_ON_RESTRICTED_NETWORKS setting observer" 2021-05-17 06:45:52 +00:00
junyulai
6322aeb7f0 [FUI27] Fix internal naming of notifyNetworkStatus
Test: TH
Bug: 174123988
Merged-In: I970ee365ca221956ee85788005d331374b5fa71a
Change-Id: I970ee365ca221956ee85788005d331374b5fa71a
  (cherry-picked from aosp/1620539)
2021-05-17 14:07:00 +08:00
Paul Hu
8665f56ca1 Merge "Read APPS_ALLOWED_ON_RESTRICTED_NETWORKS setting from PermissionMonitor" 2021-05-17 03:04:59 +00:00
paulhu
f11da7e205 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
2021-05-16 15:52:36 +00:00
paulhu
a7b9535fde 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
2021-05-16 23:48:55 +08:00
lesl
614551c3b6 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
2021-05-16 22:18:32 +08:00
Junyu Lai
2a7ab18c0b Merge changes I3ba50cbd,I970ee365
* changes:
  [FUI29] Migrate ConnectivityService to use getAllNetworkStateSnapshots
  [FUI27] Fix internal naming of notifyNetworkStatus
2021-05-15 16:21:38 +00:00
Jayachandran Chinnakkannu
65a0e0d0e5 Merge "QOS filter matching support based on remote address and port number for connected sockets" am: 6c5553aaaa am: f84276bde1 am: 9896622bd3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1687813

Change-Id: I04ada71bdea2c3851fd6925126f6ff2bfdecad2c
2021-05-14 21:19:17 +00:00
Jayachandran Chinnakkannu
6c5553aaaa Merge "QOS filter matching support based on remote address and port number for connected sockets" 2021-05-14 20:02:30 +00:00
Junyu Lai
3239a62913 Merge "[FUI26] Address comments on aosp/1560408" am: 8f03f1e788 am: e5929c073c am: 13bcaf5446
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1618845

Change-Id: I8c62d218953027ee2fb5426ddacae5a6f8bb6c73
2021-05-14 12:20:10 +00:00
junyulai
07f3432fab [FUI27] Fix internal naming of notifyNetworkStatus
Test: TH
Bug: 174123988
Change-Id: I970ee365ca221956ee85788005d331374b5fa71a
2021-05-14 19:48:17 +08:00
TreeHugger Robot
6d13c8325b Merge "Move connectivity test defaults to tests/common" into sc-dev 2021-05-14 10:40:28 +00:00
Mark Chien
540f0d3ce3 Merge "Test mts against last stable api level" am: a59a146b36 am: 9015e276aa am: 726b814899
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1686012

Change-Id: I9d2d08b9c9397c247e2afd54b25a21631233c585
2021-05-14 10:26:06 +00:00
Mark Chien
726b814899 Merge "Test mts against last stable api level" am: a59a146b36 am: 9015e276aa
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1686012

Change-Id: I34e9a66e7d603fe71c5ee1591787344e245b70ac
2021-05-14 10:03:22 +00:00
Mark Chien
a59a146b36 Merge "Test mts against last stable api level" 2021-05-14 09:00:11 +00:00
junyulai
c6422b78ea [FUI26] Address comments on aosp/1560408
Test: TH
Bug: 174123988
Change-Id: I949eeb8903e903d8ede90521442b1f917d5cdfeb
2021-05-14 15:57:44 +08:00
Remi NGUYEN VAN
dc56aa2620 Move connectivity test defaults to tests/common
The build file currently holds a single build rule in test/. Move it to
the existing build file in tests/common/Android.bp.

Test: m
Bug: 186628461
Change-Id: I3948c9b46e2647f945a22f16aad493e94fe50b4d
2021-05-14 07:24:53 +00:00
Treehugger Robot
3c5a00a31c Merge "Re-enable check for VpnTransportInfo session ID." am: 6748f93e56 am: c7ea77ce6a am: ad56a81b2d
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1705135

Change-Id: I0e4deaccf95ea9422654e85a3fa4df9d6752455e
2021-05-14 06:41:40 +00:00
Chalard Jean
6948544a4d Make yield-to-bad-wifi behavior backward compatible with R
Yielding cell wins to exiting wifi (whether good or bad).
It loses to bad wifi that's not exiting.

In R, yielding to bad wifi only affects wifis that are
unvalidated, but a wifi that is exiting should still be
dropped in favor of a cell that yields to bad wifi.

I had misunderstood the policy and implemented it wrong.
Now it's implemented right, and has careful tests.

Test: new tests for this
Bug: 186458024
Change-Id: Ib8637100d491e72a2edb837584ce55b7dda58524
2021-05-14 15:27:12 +09:00
Treehugger Robot
ad56a81b2d Merge "Re-enable check for VpnTransportInfo session ID." am: 6748f93e56 am: c7ea77ce6a
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1705135

Change-Id: If5ab413d6cea71a3dcc98634d7ad8a11fbd2bbd1
2021-05-14 06:25:15 +00:00
Treehugger Robot
6748f93e56 Merge "Re-enable check for VpnTransportInfo session ID." 2021-05-14 05:58:35 +00:00
Treehugger Robot
e7cbc00b27 Merge "Don't run testRequestBackgroundNetwork in instant app mode" am: 3531b188ce am: e7bb625eaf am: 0d5000dbbd
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1695289

Change-Id: Icc5b0fff3d74f3f577e591fcb7046f4c42da558e
2021-05-14 05:09:38 +00:00
Treehugger Robot
0d5000dbbd Merge "Don't run testRequestBackgroundNetwork in instant app mode" am: 3531b188ce am: e7bb625eaf
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1695289

Change-Id: Iec0e338d556495c7a2e14b273d8fefad31983dd8
2021-05-14 04:53:58 +00:00
Treehugger Robot
3531b188ce Merge "Don't run testRequestBackgroundNetwork in instant app mode" 2021-05-14 04:09:43 +00:00
Aaron Huang
9ff12842da 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
2021-05-14 11:05:22 +08:00
lesl
575b5569f6 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
2021-05-14 11:04:17 +08:00
Jayachandran C
735e1ce55b 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
2021-05-13 09:50:13 -07:00
Lorenzo Colitti
8f67bdec5a Re-enable check for VpnTransportInfo session ID.
This check was commented out because VpnTransportInfo was not
correctly propagated to ConnectivityService. This is now fixed.

Bug: 183938194
Test: atest CtsNetTestCases:NetworkAgentTest
Change-Id: Iab9987c8b58487ee44d8479b02e030c7e1e4465f
2021-05-14 00:47:55 +09:00
Remi NGUYEN VAN
b11ba415f6 Move config_apf* resources to NetworkStack
The resources are only read by NetworkStack through their respective
ApfCapabilities SystemApi methods.
As the resources are being migrated out of frameworks/base resources
anyway, move them directly to NetworkStack instead of moving them to
ServiceConnectivityResources.

Also test that the framework resources are not overlaid or modified.
This should avoid OEM integration errors where the overlays are kept as
in R, without overlaying the resource in the NetworkStack package.

Bug: 185850634
Test: atest CtsNetTestCases
BYPASS_INCLUSIVE_LANGUAGE_REASON=Need to mention legacy APIs

Change-Id: I7a15ddcad5af11fa307d9dbe3a77b31a1179e5b3
2021-05-13 14:40:10 +00:00
Nikita Iashchenko
0312c4593d 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
2021-05-13 14:23:54 +01:00
Lorenzo Colitti
a869887d4f 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
Chiachang Wang
49c94c8500 Merge "Add test for ConnectivityManager.setGlobalProxy()" am: 78c1663ba3 am: 650927c734 am: 3fea4fa064
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1688272

Change-Id: I3a50a087f945bb951eb2eaff40838a0bea15e3b9
2021-05-13 10:23:57 +00:00