Commit Graph

2808 Commits

Author SHA1 Message Date
Les Lee
7486607f4b Merge "Add metered filter for API: buildTemplateCarrier" 2021-05-18 13:01:38 +00:00
junyulai
4e56bc1c93 [FUI27] Fix internal naming of notifyNetworkStatus
Test: TH
Bug: 174123988
Change-Id: I970ee365ca221956ee85788005d331374b5fa71a
2021-05-14 19:48:17 +08:00
Aaron Huang
a266a9855c 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
c9e6c56067 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
Benedict Wong
47b528cfe7 Add clarifying comments on for IPsec forward policies
This change adds clarifying comments for the usage of the forward
policies in IPsec, and corrects a comment to properly specify the
permissions allowed.

Bug: 185495453
Test: Comment-only changes
Change-Id: I6d36522c344c41b0ebd90d46b216d115b678dd31
2021-05-10 18:26:02 -07:00
Benedict Wong
908d34edcb Add internal support for IPsec forward policies
This change adds support for IPsec forward policies, which are necessary
for packets to be allowed to be forwarded to another interface, as is
the case with tethering. This is necessary and useful only within the
system server, and as such is not exposed as a public API.

This change is safe, since the addition of a FWD policy on IPsec tunnel
interfaces will by default block forwarded traffic (as would be the case
without this patch). In the event that the (system) owner of the tunnel
requires support for forwarded packets (eg tethering), this patch allows
application of transforms in the FWD direction as well.

This will be used to ensure that the VCN can be used as the underlying
network for the purposes of tethering.

Bug: 185495453
Test: atest IpSecServiceTest
Test: atest IpSecServiceParameterizedTest
Test: manual testing with tethering over VCN
Change-Id: I74ecea71f1954029f6fbdbe34598c82e0aac386b
2021-05-07 15:09:42 -07:00
Treehugger Robot
3bcc77078c Merge "Add getters to NetworkStateSnapshot" 2021-04-29 09:20:34 +00:00
Treehugger Robot
05d884470a Merge "Add getters to UnderlyingNetworkInfo" 2021-04-29 07:29:08 +00:00
Aaron Huang
433fb498b5 Add getters to UnderlyingNetworkInfo
Address API review feedback, add getters to UnderlyingNetworkInfo
instead of exposing fields.

Instead of wasting memory by converting this into an array, have
migrateTun take a List<String>. In turn, tunAdjustmentInit should
also take a List<String>.

(cherry picked from ag/14211075)
Bug: 183972554
Test: atest android.net.UnderlyingNetworkInfoTest
Merged-In: Id59744097208d91298a25ef110ade91a9cf291a1
Change-Id: Id59744097208d91298a25ef110ade91a9cf291a1
2021-04-22 22:30:42 +08:00
Aaron Huang
955a1a50df Add getters to NetworkStateSnapshot
Address API council feedback, add getters to NetworkStateSnapshot
instead of exposing the bare fields directly.

(cherry picked from ag/14233655)
Bug: 183972826
Test: FrameworksNetTests
Merged-In: Id1707753b42ae88d2b95e4bd00a792609434e4f5
Change-Id: Id1707753b42ae88d2b95e4bd00a792609434e4f5
2021-04-22 18:21:00 +08:00
lesl
b2cd0b9e57 wifi data usage: support to get carrier merged wifi network.
Carrier merged wifi network is a specific cerrier wifi network
which provides the same user experience as mobile.

To support data usage accounting for carrier merged wifi,
the change provide several APIs in NetworkTemplate:

  1. extend buildTemplateWifi so it could be used for matching
     wifi networks with subscriber Id (IMSI).
  2. add buildTemplateCarrier to let
     NetworkPolicyManagerService creates a single policy for
     a given carrier regardless of network type.

Bug: 176396812
Test: atest -c NetworkTemplateTest
Test: atest -c NetworkStatsServiceTest
Test: Manual Test with test code on mobile and wifi network.
      1. buildTemplateCarrier includes the carrier wifi and
         mobile usage
      2. buildTemplateWifi can get carrier wifi usage and support the
         filter via subscriberId

Change-Id: I667b4adf3eec0bdd3a7385109dd8c1fae8e7be32
2021-04-19 16:13:27 +08:00
Remi NGUYEN VAN
212d6930cc Add documentation on EthernetNetworkSpecifier API
Add javadoc on the constructor and getInterfaceName method.

Fixes: 182979732
Test: m
Change-Id: Iced805149a8344b953331501b48184661be0053a
2021-04-08 15:32:08 +09:00
Aaron Huang
cdbde20884 Fix IpConfigStore dependencies on framework-connectivity
This change fixes IpConfigStore dependencies on framework-connectivity
hidden APIs.
- Use the version of SystemApi to new RouteInfo.
- Inline the implementation of isIPv4Default() directly because
  isDefaultRoute() is a public API so it can be used in this class.

(cherry-picked from ag/13945685)
Bug: 178777253
Test: FrameworksServicesTests:IpConfigStoreTest
Merged-In: I5ed1bc8bc8bee5b0c795fd8577a2d64628998e51
Change-Id: I5ed1bc8bc8bee5b0c795fd8577a2d64628998e51
2021-04-06 07:18:06 +00:00
Aaron Huang
ace9a3d468 Migrate hidden API in IpConfigStore to formal API
IpConfiguration and StaticIpConfiguration are included
in framework-connectivity which cannot have external
hidden API usages dependencies on them. IpConfiguration
and StaticIpConfiguration provide builder and getter
methods for the fields of the objects which are formal APIs.
So, replace the usages in IpConfigStore with those formal
APIs to remove the dependencies.

(cherry-picked from ag/13929104)
Bug: 178777253
Test: FrameworksServicesTests:IpConfigStoreTest
Merged-In: Ie9e6af0efe2c39667bb8faa1e3a498b1f61e1432
Change-Id: Ie9e6af0efe2c39667bb8faa1e3a498b1f61e1432
2021-04-06 07:13:56 +00:00
lesl
1c4cd5c1d8 Fix Wi-Fi SSID null handling
When Wi-Fi SSID is null in NetworkCapabilities,
get Wi-Fi SSID from connection info (WifiInfo) which is non-null design.

Bug: 176396812
Test: FrameworksNetTests NetworkPolicyManagerServiceTest
Change-Id: I59c7d8f7e176d0c6bb100721269f3f6165f0ca21
2021-03-30 23:57:56 +08:00
Junyu Lai
fc6a6628b9 Merge "[SP31] Expose onSetWarningAndLimit System API" 2021-03-30 08:00:45 +00:00
Junyu Lai
8ce0afea2f Merge "[SP29] Send interface warning bytes to NetworkStatsProvider" 2021-03-30 02:56:25 +00:00
Junyu Lai
f1a1d71020 Merge "[SP28] Add API for set data warning" 2021-03-29 11:06:05 +00:00
Junyu Lai
df875106a7 Merge "Support Dual ViLTE stats" 2021-03-29 06:59:19 +00:00
Lucas Lin
0cf3234045 Merge changes I6d5dd0a8,I106b3e4f
* changes:
  Use public API Network#getNetId() to get netid
  Remove unused import IConnectivityManager
2021-03-25 10:49:35 +00:00
lucaslin
20966d9193 Use public API Network#getNetId() to get netid
Network class will be a part of mainline module, external callers
cannot call its hidden constant. Use public API - getNetId() to
get netid instead.

Bug: 182963397
Test: m
Change-Id: I6d5dd0a8c3879df7bdc1d58e36022045c303bb40
Merged-In: I6d5dd0a8c3879df7bdc1d58e36022045c303bb40
  (cherry-picked from ag/13927649)
2021-03-25 10:48:55 +00:00
lucaslin
11e8857033 Use getAllInterfaceNames to get all interface names
The current design is using hidden API - getStackedLinks() to
get LinkProperties then call getInterfaceName() to get the
interface name. In fact, this behavior could be replaced by
system API - getAllInterfaceNames().

Bug: 182963397
Test: atest FrameworksNetTests
Test: atest CtsNetTestCases
Change-Id: Id2b19dc5099355af69d23a6d99d2b7e6c0e1e88a
Merged-In: Id2b19dc5099355af69d23a6d99d2b7e6c0e1e88a
  (cherry-picked from ag/13927660)
2021-03-25 08:10:28 +00:00
junyulai
47597b92ab [SP31] Expose onSetWarningAndLimit System API
Test: atest NetworkPolicyManagerServiceTest NetworkStatsServiceTest
Bug: 149467454
CTS-Coverage-Bug: 183598414
Merged-In: I6f5e22e3a7b80a38cae9f3c5d7296a1dff34facf
Change-Id: I6f5e22e3a7b80a38cae9f3c5d7296a1dff34facf
  (cherry-picked from ag/13981689)
2021-03-25 09:32:43 +08:00
junyulai
8947c7125a [SP29] Send interface warning bytes to NetworkStatsProvider
This change contains necessary modification in NPMS and NSS
to send warning bytes to NetworkStatsProvider. But since
no any provider has been upgraded to handle such parameter.
Thus, no behavior change is made in this patch.

Test: atest NetworkPolicyManagerServiceTest NetworkStatsServiceTest
Test: atest NetworkPolicyManagerServiceTest#testStatsProviderWarningAndLimitReached
Bug: 149467454
Bug: 170699770
Bug: 170179169
Merged-In: I6c4863030c36328db571294fd12a40e59864def5
Change-Id: I6c4863030c36328db571294fd12a40e59864def5
  (cherry-picked from ag/13982166)
2021-03-25 09:23:24 +08:00
junyulai
d66c225def [SP28] Add API for set data warning
To have better control and race-free of set data warning
to tether offload hardware, an interface of set warning and
limit at the same time in the NetworkStatsProvider is needed.

This is a no-op change which expose such interface with minimum
changes in service side to get build pass. The implementation
would be included in follow-up patches.

Test: atest NetworkStatsServiceTest
Test: atest NetworkPolicyManagerServiceTest
Test: atest GtsNetworkStackHostTestCases
Test: m doc-comment-check-docs
Bug: 149467454
Bug: 170699770
Bug: 170179169
Merged-In: I6ee661497f7dedb871c85786d1950cab951d8aa2
Change-Id: I6ee661497f7dedb871c85786d1950cab951d8aa2
  (cherry-picked from ag/13959436)
2021-03-24 22:48:26 +08:00
Chalard Jean
e096339dc3 Merge "Annotate NSM heavy methods with @WorkerThread" 2021-03-17 02:03:22 +00:00
Zhengyu Zhan
63a5820b4f Support Dual ViLTE stats
Some operator supports multiple VILTE,
both two SIM cards can make VILTE call.
We need to record VILTE data to different interface.
Now NetworkStatsService has only one VILTE data
interface: "vt_data0". All VILTE data stats will
be recorded in this interface.

Bug: 130871087
Test: NetworkStatsServiceTest#testDualVilteProviderStats
Change-Id: I000ec756827bc42cac88dd0a2ca6b7999252357e
2021-03-15 10:00:59 +08:00
Lucas Lin
02929bde11 Merge changes Ib80f814f,Ic605e489
* changes:
  Use new API - getIpSecNetIdRange() in IpSecService
  Add a new API to get the network ID range of IPSec tunnel interface
2021-03-12 03:30:32 +00:00
lucaslin
7eb76590b8 Use new API - getIpSecNetIdRange() in IpSecService
Use new API - getIpSecNetIdRange() to get the network ID range
of IPSec tunnel interface.

Bug: 172183305
Test: atest FrameworksNetTests:IpSecServiceTest
Change-Id: Ib80f814f991e9f000a68f5c539d15d97cf56930e
2021-03-11 17:30:18 +00:00
Remi NGUYEN VAN
65949518fa Add Ethernet, TestNetworkSpecifier API
Rename StringNetworkSpecifier to EthernetNetworkSpecifier (its only
production user), and make it module-lib API.
The original StringNetworkSpecifier file is actually kept to satisfy
some invalid dependencies; it will be removed separately.

This allows specifying an Ethernet interface with a non-deprecated API:
until this change the only way to do so would be to use
NetworkRequest#setSpecifier(String), which is deprecated.

Similarly, add the TestNetworkSpecifier API for TestNetworkManager, to
replace previous usage of StringNetworkSpecifier. TestNetworkManager is
module API, so TestNetworkSpecifier should be module API too. This
allows tests to request the test interface specifically, without using
the deprecated NetworkRequest#setSpecifier(String).

Bug: 179329291
Test: m
Merged-In: Iee569f5c8bbdc4bc979610e1191308281f3d4620

Change-Id: Iee569f5c8bbdc4bc979610e1191308281f3d4620
2021-03-11 23:02:02 +08:00
Chalard Jean
63595c6f88 Annotate NSM heavy methods with @WorkerThread
Test: TH
Bug: 181906747
Change-Id: Ia30273466c1b91a3dcc5d36dac61f92185dec96e
2021-03-11 10:47:46 +00:00
Remi NGUYEN VAN
872fe3f815 Remove unused buildNetworkIdentity
The overload using a NetworkState is now unused.

Bug: 174123988
Change-Id: I22f2d2fffd2d70c08097d3217f01393ff8e75ab5
Test: m
2021-03-09 09:31:21 +00:00
Chiachang Wang
055165000e Replace ConnectivityManager.isNetworkTypeMobile usage in NSS
ConnectivityManager is a part of connectivity mainline. The
hidden methods dependency in ConnectivityManager should be
removed to make it a moudle. NSS use isNetworkTypeMobile to
check if the NetworkState belongs to a cellular network or not.
It should be replaced by the NetworkCapabilities inside the
NetworkState.

The result of isNetworkTypeMobile relies on the legacy network
type. The legacy network type comes from the network type
of its network info. The replacement should consider VPN active
case because the network type will not be TYPE_MOBILE. Thus,
replace it with Networkcapabilities.getDisplayTransport() to
get a transport that can be used to classify a network when
displaying its info to users, i.e. it will return TRANSPORT_VPN
for a vpn network on cellular network.

Bug: 172183305
Test: atest FrameworksNetTests
Change-Id: I2132a7288a93e4430cbd9efabc33ae56ce8bdd9b
2021-03-08 09:11:24 +00:00
Treehugger Robot
89f7c5570a Merge "[FUI22] Support getAllNetworkStateSnapshot" 2021-03-05 05:16:43 +00:00
Yan Yan
d032de0ecd Merge "Revert "Use VERSION_CODES.S instead of VERSION_CODES.R + 1"" 2021-03-05 02:30:21 +00:00
Yan Yan
88f5da0903 Revert "Use VERSION_CODES.S instead of VERSION_CODES.R + 1"
This reverts commit 272ee7c909.

Reason for revert:
1. The BUILD_VERSIONS.S is 1000, and thus it will prevent
   the code from requiring new algorithms on devices whose
   first sdk is 31 (e.g. cuttlefish), though these devices
   should be treated as first launched with SDK S.
2. It will break #testValidationForAlgosAddedInS, because
   the test code is using BUILD_VERSIONS.R to gate the test,
   which is inconsistent with the implementation.

Bug: 181887451
Test: atest IpSecAlgorithmTest
Change-Id: I5cd717c5ebd6086ae5cf9abf76311ae4fca0c6e9
2021-03-05 00:15:15 +00:00
junyulai
41c85f50c4 [FUI22] Support getAllNetworkStateSnapshot
Currently, ConnectivityService has getAllNetworkState but it is
not ideal to expose as system API since the plan is to get rid
of NetworkState. Thus, create a new one that returns
NetworkStateSnapshot to fulfill the needs.

Note the original getAllNetworkState cannot be deleted now since
it has @UnsupportedAppUsage annotation.

Test: atest FrameworksNetTests
Bug: 174123988
Change-Id: Icddd434552b0e9ecbc8299e7242ec88cf3145aca
2021-03-04 18:41:09 +08:00
Paul Hu
1984fb1cb0 Merge "Replace ConnectivityManager hidden symbols on framework" 2021-03-04 03:07:08 +00:00
Xin Li
d60cc74f32 Merge "Merge RQ2A.210305.007" 2021-03-03 21:41:39 +00:00
Yan Yan
90b5d871e1 Merge "Use VERSION_CODES.S instead of VERSION_CODES.R + 1" 2021-03-03 18:04:52 +00:00
junyulai
f72320776d [FUI18] Expose notifyNetworkStatus as system API
Test: m -j doc-comment-check-docs
Bug: 174123988
Merged-In: I11d4c9ab24de87fb2ad120e3787b78b73133e874
Change-Id: I11d4c9ab24de87fb2ad120e3787b78b73133e874
  (cherry-picked from ag/13749978)
2021-03-03 20:01:46 +08:00
Yan Yan
ecc13abaa0 Merge "Support new IpSecAlgorithm AUTH_AES_CMAC" am: d3a444609a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1579251

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic9cc8508fb44e10371bc76bb31f20340f8663b18
2021-03-02 21:08:15 +00:00
Treehugger Robot
2f5b7f8155 Merge "[FUI09] Expose NetworkStateSnapshot as system API" am: c061f0053e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1536708

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I8eb6681328ad1f4a85bcc8c6c4b9446c23616b7a
2021-03-02 20:52:02 +00:00
Treehugger Robot
8e8f318c1f Merge "[FUI17] Migrate NetworkStatsService to use NetworkStateSnapshot" am: 1ad27ef2a1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1556553

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I2b19538843007e38e170163120f38477e4b76be8
2021-03-02 20:47:52 +00:00
Remi NGUYEN VAN
8819459e4a Merge "Move UidRange to connectivity" am: 5a81037576
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1612295

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I672615b0804b9a9de4befa1ba5aea2efb9c962df
2021-03-02 20:24:20 +00:00
Yan Yan
d3a444609a Merge "Support new IpSecAlgorithm AUTH_AES_CMAC" 2021-03-02 18:24:27 +00:00
Treehugger Robot
c061f0053e Merge "[FUI09] Expose NetworkStateSnapshot as system API" 2021-03-02 16:08:03 +00:00
junyulai
7c17de401b [FUI09] Expose NetworkStateSnapshot as system API
This is needed by NetworkStatsService and
NetworkPolicyManagerService to utilize the snapshots of
information of networks that grabbed from ConnectivityService.

Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 174123988
Change-Id: I7e974ef7b23ba9ba6ee775eed9899b0c0e2eca55
2021-03-02 23:09:16 +08:00
Treehugger Robot
1ad27ef2a1 Merge "[FUI17] Migrate NetworkStatsService to use NetworkStateSnapshot" 2021-03-02 13:21:32 +00:00
junyulai
125631330d [FUI17] Migrate NetworkStatsService to use NetworkStateSnapshot
This change migrates NetworkStatsService and related code to use
NetworkStateSnapshot which is used for replacing the NetworkState.

This patch also changes some formating which is suggested by
the linter.

Test: FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 174123988
Change-Id: I547da8f411cb45bdadc376ac3cadf3f3c55bb282
2021-03-02 20:08:53 +08:00