Commit Graph

3295 Commits

Author SHA1 Message Date
Junyu Lai
c06cfa4623 Merge changes Ib048c18b,Ie7694a63 am: 8b7173315e am: 76ba518dcc
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1777887

Change-Id: I047a95bbf6d70f1a03e35782a36a98f34f51ca9c
2021-07-30 02:45:18 +00:00
Junyu Lai
8b7173315e Merge changes Ib048c18b,Ie7694a63
* changes:
  Add debug log for tracking NPE of mMobileIfaces
  Fix mMobileIfaces is not protected by lock
2021-07-30 02:13:25 +00:00
Junyu Lai
f6f1066532 Add debug log for tracking NPE of mMobileIfaces
Test: TH
Bug: 192758557
Change-Id: Ib048c18b1c64627de5a9d2b04d10e084a014ff64
2021-07-26 09:16:59 +00:00
Junyu Lai
1bdf075964 Fix mMobileIfaces is not protected by lock
Currently, mMobileIfaces is accessed from multiple threads, and
should be protected from concurrent accessing. However, since the
variable could be accessed frequently, holding the mStatsLock
would make this be blocked by network stats I/O operations.
Thus, protect the variable by making it volatile.

Test: Wifi on/off stress test
Bug: 192758557
Change-Id: Ie7694a63f5203ee7c83830ca13d97219b7949fd7
2021-07-26 09:16:35 +00:00
Luke Huang
426fa1ef6b Merge "Keep the native mdns daemon alive for pre-S application" into sc-dev am: 5978eb6eb4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15320524

Change-Id: I18b5ab0a0d332167db75d97b8d35595dedc56567
2021-07-22 03:26:43 +00:00
Luke Huang
b4fd4607d6 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:21:42 +00:00
Luke Huang
716683f958 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
Treehugger Robot
b48a138e4e Merge "Gracefully handle integer overflows." am: bd71f389de am: d4909b9aa9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1714119

Change-Id: I95ef9e71987fc39250e6edd107fe2ec597b1ea17
2021-07-20 08:15:13 +00:00
Treehugger Robot
bd71f389de Merge "Gracefully handle integer overflows." 2021-07-20 07:36:56 +00:00
Remi NGUYEN VAN
ccd68577d0 [automerger skipped] Merge "Rename FIRST_SDK_INT to DEVICE_INITIAL_SDK_INT" am: 0f04dffd2b am: 8565e71426 -s ours
am skip reason: Merged-In I72660959cb4e638a8e80fcf2f4e96ea172969f44 with SHA-1 4e878ad3f3 is already in history

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1686171

Change-Id: I2644d387bb1667ed5c1153646a78946b68c27301
2021-07-19 10:25:48 +00:00
Remi NGUYEN VAN
0f04dffd2b Merge "Rename FIRST_SDK_INT to DEVICE_INITIAL_SDK_INT" 2021-07-19 09:47:21 +00:00
paulhu
7c76978909 Rename FIRST_SDK_INT to DEVICE_INITIAL_SDK_INT
As API review feedback, rename Build#VERSION#FIRST_SDK_INT to
Build#VERSION#DEVICE_INITIAL_SDK_INT. As well as update all usage
in frameworks and tests.

Bug: 184735771
Test: m
Merged-In: I72660959cb4e638a8e80fcf2f4e96ea172969f44
(cherry-pick with minor conflicts)

Change-Id: I72660959cb4e638a8e80fcf2f4e96ea172969f44
2021-07-05 14:10:16 +09:00
TreeHugger Robot
ab995133b5 [automerger skipped] Merge "Add support for app data accounting for in-kernel dataplanes" into sc-dev am: 836927f24b -s ours
am skip reason: Merged-In I768907cd3dd2028c7040cddd81fc71a5ce69bbdb with SHA-1 788a981922 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15191630

Change-Id: I91d095347ced6a4d16af91371ebefdf68577b724
2021-07-03 02:12:25 +00:00
Benedict Wong
9f97237115 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
Original-Change: https://android-review.googlesource.com/1749070
Merged-In: I768907cd3dd2028c7040cddd81fc71a5ce69bbdb
Change-Id: I768907cd3dd2028c7040cddd81fc71a5ce69bbdb
2021-07-02 19:28:45 +00:00
Benedict Wong
9f61539d84 Merge "Add support for app data accounting for in-kernel dataplanes" am: b07a5e1413 am: cdb9503af4
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1749070

Change-Id: I583a872bcb18f1b749f4ab0b49cbc9323920f048
2021-07-02 19:12:24 +00:00
Benedict Wong
b07a5e1413 Merge "Add support for app data accounting for in-kernel dataplanes" 2021-07-02 18:42:15 +00:00
Benedict Wong
788a981922 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
2ebd947446 [automerger skipped] Merge "Fix the comments from aosp/1717479." into sc-dev am: e39eddcafb -s ours
am skip reason: Merged-In I71ebdd011574bd96de16a4248b0e15636418e87c with SHA-1 74438ecd5e is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15073697

Change-Id: Id83bb07c1fb58995581d335968c7fb39abf7ffcb
2021-07-01 10:27:02 +00:00
Luke Huang
ac4f1912cf 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
Original-Change: https://android-review.googlesource.com/1730170
Merged-In: I71ebdd011574bd96de16a4248b0e15636418e87c
Change-Id: I71ebdd011574bd96de16a4248b0e15636418e87c
2021-06-23 09:54:50 +00:00
Luke Huang
fe4e715fc9 Merge "Fix the comments from aosp/1717479." am: 2dc868db1c am: 2d1ccbfd91
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1730170

Change-Id: I5c8869f627eb8f65ab7193991da0796dd682e8d4
2021-06-23 06:29:30 +00:00
Luke Huang
2dc868db1c Merge "Fix the comments from aosp/1717479." 2021-06-23 03:36:02 +00:00
TreeHugger Robot
fa87a19c1e [automerger skipped] Merge "DO NOT MERGE - Merge ab/7272582" into stage-aosp-master am: 58175ace73 -s ours
am skip reason: Merged-In I81c036a8484d14683db9450b55bd379c7a728d73 with SHA-1 56f7a93793 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14974256

Change-Id: I86d96f38851361be3083c8a7fdf2e74dbbc35267
2021-06-18 00:51:57 +00:00
Xin Li
e69ef5fd70 DO NOT MERGE - Merge ab/7272582
Bug: 190855093
Merged-In: I81c036a8484d14683db9450b55bd379c7a728d73
Change-Id: I71fe9744d88740a8d95235ddb4c8ab91881473ce
2021-06-14 22:01:46 -07:00
Luke Huang
75d10cada4 [automerger skipped] Merge "Make NsdService only start the native daemon when needed and automatically clean it up." into sc-dev am: c6a5826df7 -s ours
am skip reason: Merged-In I3eb04552f6cf6c0c68c07abffe751bb4d0669215 with SHA-1 17df73a1b8 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14962980

Change-Id: Iaedb188175d289751741e93378c27534591e2bf1
2021-06-15 04:59:23 +00:00
TreeHugger Robot
8defefe500 [automerger skipped] Merge "Fix: query TYPE_WIFI usage with empty string" into sc-dev am: 750ed6aa97 -s ours
am skip reason: Merged-In I084b69903f8ba7a6225b312560752e8508938714 with SHA-1 c873a96dcc is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14972850

Change-Id: I9da6e8a753a9e3f99f01a3054e09434c5217267e
2021-06-15 04:58:52 +00:00
Luke Huang
c6a5826df7 Merge "Make NsdService only start the native daemon when needed and automatically clean it up." into sc-dev 2021-06-15 04:52:43 +00:00
Les Lee
6e1e9ef222 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
Test: atest -c NetworkUsageStatsTest
Merged-In: I084b69903f8ba7a6225b312560752e8508938714
Change-Id: I084b69903f8ba7a6225b312560752e8508938714
2021-06-15 10:52:49 +08:00
Les Lee
1f6d2d313f Merge "Fix: query TYPE_WIFI usage with empty string" am: 3bfd63e425 am: 6f52c7de10
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1727620

Change-Id: Ia869e47edec33397ccac5ec97fddf633fc9b8ab7
2021-06-14 16:59:57 +00:00
Les Lee
6f52c7de10 Merge "Fix: query TYPE_WIFI usage with empty string" am: 3bfd63e425
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
3bfd63e425 Merge "Fix: query TYPE_WIFI usage with empty string" 2021-06-14 16:30:12 +00:00
Luke Huang
e022ea5d80 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
Original-Change: https://android-review.googlesource.com/1717479
Merged-In: I3eb04552f6cf6c0c68c07abffe751bb4d0669215
Change-Id: I3eb04552f6cf6c0c68c07abffe751bb4d0669215
2021-06-14 06:54:52 +00:00
Luke Huang
333c4c91dc Merge "Make NsdService only start the native daemon when needed and automatically clean it up." am: 05081aa3b0 am: 27450253e2
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1717479

Change-Id: Idb9e8dcd7c38ee09e21a3e0af3e643c44f9aa357
2021-06-13 16:52:05 +00:00
Luke Huang
27450253e2 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
c873a96dcc 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
74438ecd5e 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
17df73a1b8 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
44c302a5d8 Merge "carrier data usage: Use carrier template as default policy" am: acbea9a48e am: 03c6e3190c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1563312

Change-Id: I28386f42011e5b65cc1219b947eff2057d1f0848
2021-06-03 09:14:20 +00:00
Les Lee
03c6e3190c Merge "carrier data usage: Use carrier template as default policy" am: acbea9a48e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1563312

Change-Id: Ie10a2dfe6c959a591cda641863af873eea409a37
2021-06-03 08:18:16 +00:00
lesl
0d14803a32 carrier data usage: Use carrier template as default policy am: 35a6e5507e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14782679

Change-Id: I8bdde6aaeea04c4c70a37d5a71ad31a5590323a9
2021-06-02 04:01:14 +00:00
Les Lee
acbea9a48e Merge "carrier data usage: Use carrier template as default policy" 2021-06-01 10:42:08 +00:00
lesl
35a6e5507e 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.

Merged-In: I33c10f7549e713c52ce9afd5b8c4cce2abbda616
Change-Id: I33c10f7549e713c52ce9afd5b8c4cce2abbda616
2021-06-01 18:12:56 +08:00
Pavan Kumar M
1c5ecec86d Gracefully handle integer overflows.
Avoid recording negative data by doing integer-based
math as much as possible, but switch to double-based
math if we detect that we'd end up causing an overflow.

Test :
    - Builds, Boots
    - High data throughput scenarios
    - NetworkStatsHistoryTest, NetworkStatsCollectionTest,
      NetworkStatsTest

Bug: 119527458
Change-Id: I355fc9bd127da83c1dc70ab3b1261346d4fa5de0
2021-05-26 08:09:31 +00:00
TreeHugger Robot
e2288b75b5 [automerger skipped] Merge "Improve documentation of IpSecTunnelInterface#setUnderlyingNetwork" into sc-dev am: 7e982787e1 -s ours
am skip reason: Merged-In I2e3c4fe735b3374b2ff6d23850970e36c0aafda5 with SHA-1 6b1f3eaf12 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14667143

Change-Id: Id39a25cc0292dcbdfc91df1347433f278f5954bd
2021-05-21 09:21:19 +00:00
Treehugger Robot
4ccd2e2d87 Improve documentation of IpSecTunnelInterface#setUnderlyingNetwork
Clarify the consequence of adding IpSecTunnelInterface to the
underlying network.

Bug: 169855650
Test: builds
Change-Id: I2e3c4fe735b3374b2ff6d23850970e36c0aafda5
Merged-In: I2e3c4fe735b3374b2ff6d23850970e36c0aafda5
2021-05-20 21:56:26 +00:00
Treehugger Robot
17304a67fd Merge "Improve documentation of IpSecTunnelInterface#setUnderlyingNetwork" am: 9625c2df35 am: de7add3201
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1590415

Change-Id: I02207954757c9135fbf6674720dd8e623fc9e435
2021-05-20 21:22:32 +00:00
Treehugger Robot
de7add3201 Merge "Improve documentation of IpSecTunnelInterface#setUnderlyingNetwork" am: 9625c2df35
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
9625c2df35 Merge "Improve documentation of IpSecTunnelInterface#setUnderlyingNetwork" 2021-05-20 20:33:41 +00:00
lesl
41e74f4334 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
Les Lee
e5f759ef7e [automerger skipped] Merge "Support to query TYPE_WIFI usage with subscriberId" into sc-dev am: aca6568d23 -s ours
am skip reason: Merged-In Ia033521a24e2bb56182d74a41bb2b39710571782 with SHA-1 dfc7237743 is already in history

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14622496

Change-Id: If1a3eeb5077d7b078a3be260e01c4cf3f6790437
2021-05-20 09:06:38 +00:00
Les Lee
aca6568d23 Merge "Support to query TYPE_WIFI usage with subscriberId" into sc-dev 2021-05-20 08:55:59 +00:00