Commit Graph

2903 Commits

Author SHA1 Message Date
Luke Huang
7a1fbd7463 Keep the native mdns daemon alive for pre-S application
Roll back the behavior changes by checking the target SDK to ensure that
there are no compatibility issues with the pre-S application.
If the target SDK of the application <S, NsdManager will actively send a
cmd to start the native daemon, and NsdService will keep the daemon
until the last client with the target SDK <S disconnects.

Test: atest NsdManagerTest NsdServiceTest
Bug: 191844585
Change-Id: Ie93d5d585e126fe220ae865bbc7274f21a925984
2021-07-21 06:08:35 +00:00
Benedict Wong
75669e5311 Merge "Add support for app data accounting for in-kernel dataplanes" 2021-07-02 18:42:15 +00:00
Benedict Wong
f5eca660c5 Add support for app data accounting for in-kernel dataplanes
This change ensures that app data accounting works correctly within the
confines of in-kernel dataplanes, as used by platform VPNs and the VCN.

Notably, the VCN MUST NOT specify the IMSI, as that would lead to double
counting of the interface statistics.

Bug: 175853498
Bug: 190620024
Test: atest NetworkStatsTest FrameworksVcnTests
Change-Id: I768907cd3dd2028c7040cddd81fc71a5ce69bbdb
2021-07-01 19:49:50 -07:00
Luke Huang
5955bb19cb Merge "Fix the comments from aosp/1717479." 2021-06-23 03:36:02 +00:00
Xin Li
1ce52a9c5e DO NOT MERGE - Merge ab/7272582
Bug: 190855093
Merged-In: I81c036a8484d14683db9450b55bd379c7a728d73
Change-Id: I71fe9744d88740a8d95235ddb4c8ab91881473ce
2021-06-14 22:01:46 -07:00
Les Lee
96cefee75d Merge "Fix: query TYPE_WIFI usage with empty string" am: b701ce8b68
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1727620

Change-Id: If4a883d96290adadc228526ec5e2518c8e566cf0
2021-06-14 16:43:52 +00:00
Les Lee
b701ce8b68 Merge "Fix: query TYPE_WIFI usage with empty string" 2021-06-14 16:30:12 +00:00
Luke Huang
e152366b08 Merge "Make NsdService only start the native daemon when needed and automatically clean it up." am: 05081aa3b0
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1717479

Change-Id: I6caa9933f307118414039b9dd2391939aeb15c0f
2021-06-13 16:09:49 +00:00
Les Lee
402b9a83e1 Fix: query TYPE_WIFI usage with empty string
Starting with API level 31, the subscriberId is applicable
for the wifi network. Considering applications may use
null or an empty string as subscriberId (for instance, cts),
frameworks create MATCH_WIFI_WILDCARD NetworkTemplate when querying
wifi network with null or an empty string which is the behavior before
API level 31.

Bug: 188915450
Test: atest -c NetworkStatsManagerTest

Change-Id: I084b69903f8ba7a6225b312560752e8508938714
2021-06-11 18:14:50 +08:00
Luke Huang
9fd7f864f4 Fix the comments from aosp/1717479.
1. Increase the cleanup delay from 3s to 10s.
2. Fix the comments from aosp/1717479.

Bug: 181810560
Test: atest NsdManagerTest NsdServiceTest
Change-Id: I71ebdd011574bd96de16a4248b0e15636418e87c
2021-06-08 10:09:30 +08:00
Luke Huang
9b56f2e0ec Make NsdService only start the native daemon when needed and automatically clean it up.
Currently, NsdService starts the native mdnsresponder daemon if any
NsdManager connect to it, which results in that when any constant
service holds the NsdManager connection, the device would always be
in the mdns multicast group whatever the connection is not used or not.
This is because mdnsresponder will join the multicast group when it
starts.

To solve this problem, start the native daemon only when needed, and
clean it up after the given idle timeout.

1. Start the native daemon when a new request come.
2. If there is no pending request, clean up the daemon after 3 seconds
of idle time.

Bug: 181810560
Test: atest NsdManagerTest NsdServiceTest
Change-Id: I3eb04552f6cf6c0c68c07abffe751bb4d0669215
2021-06-08 10:09:30 +08:00
Les Lee
6435752c70 Merge "carrier data usage: Use carrier template as default policy" am: 568f75a883
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1563312

Change-Id: Ie10a2dfe6c959a591cda641863af873eea409a37
2021-06-03 08:18:16 +00:00
Les Lee
568f75a883 Merge "carrier data usage: Use carrier template as default policy" 2021-06-01 10:42:08 +00:00
Treehugger Robot
38a2af81f5 Merge "Improve documentation of IpSecTunnelInterface#setUnderlyingNetwork" am: 5c20637731
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1590415

Change-Id: I38c900b277fa668fe66d6ac6f6a5230ad2c50920
2021-05-20 20:53:07 +00:00
Treehugger Robot
5c20637731 Merge "Improve documentation of IpSecTunnelInterface#setUnderlyingNetwork" 2021-05-20 20:33:41 +00:00
lesl
5c437e94ec carrier data usage: Use carrier template as default policy
The carrier network means any network which linked with sepcific
subscriberId (for instances: merged Wifi or mobile).
Update default policy to use carrier network template to replace mobile
template.

No impact for current AOSP user because no any wifi network is merged
wifi. (Because the merged wifi network requires to support from the wifi module).

Also this change convert all of the old policies which template is
TYEP_MOBILE to TYPE_CARRIER to match the default policy.

Bug: 176396812
Test: atest -c NetworkPolicyManagerServiceTest
Test: atest -c CtsHostsideNetworkTests
Test: Manual Test with test code (Force wifi to merged wifi).
      The data will limit when using merged wifi.
      And mobile policy also work normally.

Change-Id: I33c10f7549e713c52ce9afd5b8c4cce2abbda616
2021-05-20 23:46:39 +08:00
Chris Weir
267e033bc7 Merge "Print human-readable OEM managed states" am: a4587ab45f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1636561

Change-Id: I38380b1f6a80fdfbbcc21124470929530131fcdd
2021-05-18 17:03:21 +00:00
Chris Weir
a4587ab45f Merge "Print human-readable OEM managed states" 2021-05-18 16:29:26 +00:00
Les Lee
72baf5dab7 Merge "Support to query TYPE_WIFI usage with subscriberId" am: d8a067cd9e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1608057

Change-Id: I753603201bd935af055cf25135e4f8faf436bf2a
2021-05-18 13:35:08 +00:00
Les Lee
937568499f Merge "Add metered filter for API: buildTemplateCarrier" am: 7486607f4b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1699687

Change-Id: Iac42f02079de5c0507209741e648b13da667fb94
2021-05-18 13:26:24 +00:00
Les Lee
d8a067cd9e Merge "Support to query TYPE_WIFI usage with subscriberId" 2021-05-18 13:02:07 +00:00
Les Lee
7486607f4b Merge "Add metered filter for API: buildTemplateCarrier" 2021-05-18 13:01:38 +00:00
lesl
9528b8b452 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
2710ae1348 Merge changes I3ba50cbd,I970ee365 am: 37f2408143
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1620859

Change-Id: I2cf4ea0abb1ff7bc74302cce16cbe8041b08d321
2021-05-15 16:53:30 +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
5ff38f7c0d Merge "Rename *Iface* APIs to *Interface*" am: f281058618
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1693585

Change-Id: I62fa0403c8b2d78e7e7a90be8ac804576ec27456
2021-05-14 09:36:36 +00: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
df1dcf78f2 Merge "Add clarifying comments on for IPsec forward policies" am: 1a88665f3c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1702525

Change-Id: I7267d331065ceadb830a14170920810f053eacb8
2021-05-11 17:17:53 +00:00
Benedict Wong
fc14eeaf35 Merge changes from topic "vcn-fwd" am: d7d2d2a15b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1682047

Change-Id: I7f02785727c73c27ac498ad4663f25252242c6e0
2021-05-11 05:26:46 +00: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
Chris Weir
fb5b7f9c31 Print human-readable OEM managed states
For NetworkTemplate and NetworkIdentity, print human-readable
representations of the OEM managed state in the classes' respective
toString() functions.

Bug: 180557699
Test: Manual - run atest NetworkTemplateTest NetworkIdentityTest
and verify that the logcat output shows the String representation of the
OEM managed state correctly.

Change-Id: Ia180b911f91f41937ac713e6b3691d82f682e146
2021-05-07 10:26:31 -07:00
Treehugger Robot
df180e412e Merge "Add getters to NetworkStateSnapshot" am: 3bcc77078c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1684649

Change-Id: I3263514a5d75141c81e5f9d7389603ed369e95df
2021-04-29 09:39:19 +00:00
Treehugger Robot
3bcc77078c Merge "Add getters to NetworkStateSnapshot" 2021-04-29 09:20:34 +00:00
Treehugger Robot
b560e885f7 Merge "Add getters to UnderlyingNetworkInfo" am: 05d884470a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1684651

Change-Id: I97222bb04bdea78178741245016658cad7f082dc
2021-04-29 08:16:36 +00:00
Treehugger Robot
05d884470a Merge "Add getters to UnderlyingNetworkInfo" 2021-04-29 07:29:08 +00:00
Les Lee
e0f1f83446 Merge "wifi data usage: support to get carrier merged wifi network." am: bef2f5be94
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1538743

Change-Id: I01b6790de48a514256f51ebb85226e56c6e2f59b
2021-04-27 03:26:31 +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
Treehugger Robot
d74319d883 Merge "Add documentation on EthernetNetworkSpecifier API" am: 682a98d823 am: f00ac501f4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1669186

Change-Id: I8c8cd85bed535a868a55ec82721b35738efa4ae1
2021-04-09 02:29:15 +00:00
Treehugger Robot
f00ac501f4 Merge "Add documentation on EthernetNetworkSpecifier API" am: 682a98d823
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1669186

Change-Id: I3ce2800bf2719b22c16c227dc3ded9a7db8f62c7
2021-04-09 02:03:01 +00: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
0a8439db0b Merge changes I5ed1bc8b,Ie9e6af0e am: 834026197f am: 5a4bd548f1
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1645290

Change-Id: Ia0f9ad67aaf675e8190d52e5814dbe855021a8b3
2021-04-06 14:41:28 +00:00
Aaron Huang
83f11c333c Migrate hidden API in IpConfigStore to formal API am: ace9a3d468 am: 0994e5b8c4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1577123

Change-Id: I7ef352c7213864ee2ff99c5a2517fb1b9e68d1d2
2021-04-06 14:41:24 +00:00
Aaron Huang
5a4bd548f1 Merge changes I5ed1bc8b,Ie9e6af0e am: 834026197f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1645290

Change-Id: I9fe40b60f31f0897f8cb62a39787536cd5524157
2021-04-06 14:06:51 +00:00
Aaron Huang
0994e5b8c4 Migrate hidden API in IpConfigStore to formal API am: ace9a3d468
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1577123

Change-Id: I218559824dc81cc1b57f17ef43f3fb29ec0fc4f5
2021-04-06 14:03:54 +00: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