Commit Graph

552 Commits

Author SHA1 Message Date
Aaron Huang
6b9248ea6e Add getter for the fields of NetworkStats.Entry
NetworkStats is going to be moved into mainline module and
there're some external callers have dependencies on it.
To replace those hidden APIs with formal APIs, NetworkStats
needs to expose some getter methods to eliminate the dependencies
on hidden API.

Bug: 210073043
Bug: 204830222
CTS-Coverage-Bug: 214881138
Test: FrameworksNetTests
Change-Id: I85bb6b27bd17bad16c9693d95b569d0ec5fbb785
2022-01-17 06:32:21 +00:00
Treehugger Robot
12158e0f85 Merge "Revert "Pivot network statistics to use DataInput/Output."" am: 362c825b3a am: 431f1396f1 am: 0d56d5c957 am: adef9c9bec
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1948916

Change-Id: I9a6119c89249370ca895aae728380153b8aaf6fc
2022-01-15 14:37:54 +00:00
Treehugger Robot
362c825b3a Merge "Revert "Pivot network statistics to use DataInput/Output."" 2022-01-15 13:25:40 +00:00
Treehugger Robot
71b890a440 Merge "Revert "Pivot network statistics to use DataInput/Output."" 2022-01-15 13:25:40 +00:00
Junyu Lai
4161a04033 [MS37] Replace NetworkStatsManagerInternal usages in NPMS
This is done by:
1. Add NetworkStatsManagerInternal APIs directly from
   NetworkStatsManager, these APIs are needed by NPMS.
2. Replace all usages with these APIs.
3. Delete NetworkStatsManagerInternal implementation.

Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 204830222
CTS-Coverage-Bug: 213124616
Change-Id: If51b6676915e3a0a8a9f95221d735306911442fc
2022-01-15 08:34:35 +00:00
Junyu Lai
6e782c7ad3 [MS37] Replace NetworkStatsManagerInternal usages in NPMS
This is done by:
1. Add NetworkStatsManagerInternal APIs directly from
   NetworkStatsManager, these APIs are needed by NPMS.
2. Replace all usages with these APIs.
3. Delete NetworkStatsManagerInternal implementation.

Test: atest FrameworksNetTests NetworkPolicyManagerServiceTest
Bug: 204830222
CTS-Coverage-Bug: 213124616
Change-Id: If51b6676915e3a0a8a9f95221d735306911442fc
2022-01-15 08:34:35 +00:00
Junyu Lai
638f6667e9 [MS35] Remove getNetwork[Total|Uid]Bytes dependencies from NPMS
1. getNetworkTotalBytes was used for querying overall statistics
   that regards of the NetworkPolicy to calculate the remaining
   data warning/limit quota that needs to be send to the lower layer.
2. getNetworkUidBytes was used for querying overall statistics of
   apps to find out the rapid traffic that caused by an abnormal
   app behavior.

This change replaces getNetwork[Total|Uid]Bytes with APIs that are
about to expose, and introduces a dependencies object for better
unit test injection.

Test: atest NetworkPolicyManagerServiceTest
Bug: 204830222

Change-Id: I802d2316fb22886e951456df0941c09176c981f8
2022-01-15 08:34:35 +00:00
Junyu Lai
5e3545fc7f [MS35] Remove getNetwork[Total|Uid]Bytes dependencies from NPMS
1. getNetworkTotalBytes was used for querying overall statistics
   that regards of the NetworkPolicy to calculate the remaining
   data warning/limit quota that needs to be send to the lower layer.
2. getNetworkUidBytes was used for querying overall statistics of
   apps to find out the rapid traffic that caused by an abnormal
   app behavior.

This change replaces getNetwork[Total|Uid]Bytes with APIs that are
about to expose, and introduces a dependencies object for better
unit test injection.

Test: atest NetworkPolicyManagerServiceTest
Bug: 204830222

Change-Id: I802d2316fb22886e951456df0941c09176c981f8
2022-01-15 08:34:35 +00:00
Junyu Lai
4c0b80f6f1 Revert "Pivot network statistics to use DataInput/Output."
This reverts commit 1b4f0a409d.

Reason for revert: FastDataInput/Output is hidden and cannot be used in mainline module.

Test: TH
Bug: 204830222
Change-Id: I8cfa435bb6233818adb9cc99dadeeb06a03443d5
2022-01-15 08:16:25 +00:00
Junyu Lai
d7045d6fa1 Revert "Pivot network statistics to use DataInput/Output."
This reverts commit daa23607be.

Reason for revert: FastDataInput/Output is hidden and cannot be used in mainline module.

Test: TH
Bug: 204830222
Change-Id: I8cfa435bb6233818adb9cc99dadeeb06a03443d5
2022-01-15 08:16:25 +00:00
Aaron Huang
e5a56ace1b Merge "Add PolicyDirection InfDef annotation to IpSecManager" am: 5f70655025 am: 2d9163aaaf am: f7dd2dbb6b am: e17803cee3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1928465

Change-Id: I757c9e684b9d1077573b6b705b151925a342e1cc
2022-01-15 07:13:24 +00:00
Aaron Huang
5f70655025 Merge "Add PolicyDirection InfDef annotation to IpSecManager" 2022-01-15 06:08:32 +00:00
Aaron Huang
17856061fa Merge "Add PolicyDirection InfDef annotation to IpSecManager" 2022-01-15 06:08:32 +00:00
Junyu Lai
6edadb712d Merge "[MS44.1] Add API to query tagged UID summary" am: 0a0c20df11 am: 193c85f48a am: 32cfcbb0c0 am: d66d62778a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1940814

Change-Id: I2c9ea81afa538ce704a0904c28c70ab9c98d0fa7
2022-01-13 12:06:39 +00:00
Junyu Lai
0a0c20df11 Merge "[MS44.1] Add API to query tagged UID summary" 2022-01-13 11:25:15 +00:00
Junyu Lai
6c83653cbb Merge "[MS44.1] Add API to query tagged UID summary" 2022-01-13 11:25:15 +00:00
Aaron Huang
595dc3b96e Add PolicyDirection InfDef annotation to IpSecManager
IpSec is going to be moved into Connectivity module and it needs to
use PolicyDirection annotation. Add PolicyDirection IntDef annotation
so that it can be used in the module.

Bug: 204153604
Test: FrameworksNetTests
Change-Id: Ib411d8c436d67574bfaf7f3aba43e5f31e7487e2
2022-01-13 10:43:54 +08:00
Aaron Huang
ca9c1df504 Add PolicyDirection InfDef annotation to IpSecManager
IpSec is going to be moved into Connectivity module and it needs to
use PolicyDirection annotation. Add PolicyDirection IntDef annotation
so that it can be used in the module.

Bug: 204153604
Test: FrameworksNetTests
Change-Id: Ib411d8c436d67574bfaf7f3aba43e5f31e7487e2
2022-01-13 10:43:54 +08:00
Junyu Lai
7577deee21 [MS44.1] Add API to query tagged UID summary
Query tagged UID summary is currently needed by
StatsPullAtomService to collect tagged traffic statistics.
Add an Api via NetworkStatsManager to support this
functionality.

Test: atest NetworkStatsManagerTest
Bug: 204830222
Change-Id: Iaa54482a8109b56e66e829c5bec5a8a8f466641a
2022-01-13 01:01:46 +00:00
Junyu Lai
f577b2248b [MS44.1] Add API to query tagged UID summary
Query tagged UID summary is currently needed by
StatsPullAtomService to collect tagged traffic statistics.
Add an Api via NetworkStatsManager to support this
functionality.

Test: atest NetworkStatsManagerTest
Bug: 204830222
Change-Id: Iaa54482a8109b56e66e829c5bec5a8a8f466641a
2022-01-13 01:01:46 +00:00
Ashwini Oruganti
c9720f8bfa Merge "Revert "Migrate unsafe parcel APIs in framework-minus-apex"" 2022-01-12 23:07:08 +00:00
Bernardo Rufino
7fe4f60b74 Revert "Migrate unsafe parcel APIs in framework-minus-apex"
This reverts commit e82600c40c.

Reason for revert: b/214053959

Change-Id: Ic271bab1d3eaf677a5989dda9deb944ee2ad6850
2022-01-12 17:44:44 +00:00
Aaron Huang
e17a9d4536 Check iface by TextUtils.equals
In current equals method, if iface is null then it will cause
null object reference when checking iface.
Thus, use TextUtils.equals to check iface so that it can compare
null iface.

Bug: 210073043
Test: FrameworksNetTests, NetworkStaticLibTests
Change-Id: I2bd8127cb030ea54438382ee89961590fffbc31a
2022-01-12 23:30:43 +08:00
Aaron Huang
7742218754 Check iface by TextUtils.equals
In current equals method, if iface is null then it will cause
null object reference when checking iface.
Thus, use TextUtils.equals to check iface so that it can compare
null iface.

Bug: 210073043
Test: FrameworksNetTests, NetworkStaticLibTests
Change-Id: I2bd8127cb030ea54438382ee89961590fffbc31a
2022-01-12 23:30:43 +08:00
lifr
c9dedfbe95 [DU03]Remove INetworkStatsService from BatteryStatsImpl
BatteryStatsImpl is using INetworkStatsService APIs, which
cannot be accessed after moving into the mainline module. So, replace
and remove those hidden API usages.

Bug: 210066922
Test: atest BatteryStatsImplTest WifiPowerCalculatorTest
            MobileRadioPowerCalculatorTest
CTS-Coverage-Bug: 213437796

  (cherry-picked from ag/16548638)

Change-Id: I584897ff8ba303c717a9df3756c9f6778c1cfb10
Merged-In: I584897ff8ba303c717a9df3756c9f6778c1cfb10
2022-01-12 07:28:55 +00:00
lifr
d686e2dd2d [DU03]Remove INetworkStatsService from BatteryStatsImpl
BatteryStatsImpl is using INetworkStatsService APIs, which
cannot be accessed after moving into the mainline module. So, replace
and remove those hidden API usages.

Bug: 210066922
Test: atest BatteryStatsImplTest WifiPowerCalculatorTest
            MobileRadioPowerCalculatorTest
CTS-Coverage-Bug: 213437796

  (cherry-picked from ag/16548638)

Change-Id: I584897ff8ba303c717a9df3756c9f6778c1cfb10
Merged-In: I584897ff8ba303c717a9df3756c9f6778c1cfb10
2022-01-12 07:28:55 +00:00
Frank Li
ffe234fa26 Merge "[DU03]Remove INetworkStatsService from BatteryStatsImpl" 2022-01-12 00:03:28 +00:00
lifr
711b873ba7 [DU03]Remove INetworkStatsService from BatteryStatsImpl
BatteryStatsImpl is using INetworkStatsService APIs, which
cannot be accessed after moving into the mainline module. So, replace
and remove those hidden API usages.

Bug: 210066922
Test: atest BatteryStatsImplTest WifiPowerCalculatorTest
            MobileRadioPowerCalculatorTest
CTS-Coverage-Bug: 213437796
Change-Id: I584897ff8ba303c717a9df3756c9f6778c1cfb10
2022-01-12 00:39:39 +08:00
Aaron Huang
d21a780372 Merge "Use public resouce in android.R package" 2022-01-07 13:44:02 +00:00
Junyu Lai
ab33fb7a4d Merge changes from topics "ms34-tm", "ms40-clock" am: a3c2578644 am: 89d0880264 am: d2a878424d am: 6a04aee460
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1914533

Change-Id: I7db7bdf217c982ef6011a948b68d238c54e2a47e
2022-01-06 14:39:44 +00:00
Junyu Lai
e7c835b3ad [MS09] Expose NetworkTemplate APIs which are needed by NetworkPolicy
This change also remove getWifiNetworkKey which should not be exposed
as system API.

Test: atest NetworkTemplateTest
Bug: 204830222
Change-Id: I924f62025a8672167f778ff790cd208c74eed878
2022-01-06 09:22:52 +00:00
Junyu Lai
6ba0487c91 [MS09] Expose NetworkTemplate APIs which are needed by NetworkPolicy
This change also remove getWifiNetworkKey which should not be exposed
as system API.

Test: atest NetworkTemplateTest
Bug: 204830222
Change-Id: I924f62025a8672167f778ff790cd208c74eed878
2022-01-06 09:22:52 +00:00
Treehugger Robot
f240c71785 Merge changes from topics "ms25-appops", "ms28-service-fix" am: bbb36e91ee am: 113ca82dd5 am: c6b372ce58 am: 4ad2cf568c
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1934458

Change-Id: I1575b5e2e5a98ead3abed9b6d87c580fd4d490bb
2022-01-03 23:37:25 +00:00
Treehugger Robot
bbb36e91ee Merge changes from topics "ms25-appops", "ms28-service-fix"
* changes:
  [MS25.1] Remove AppOpsManager.OP_GET_USAGE_STATS dependency
  [MS28.1] Fix several hidden API dependencies
2022-01-03 22:41:07 +00:00
Treehugger Robot
e10a94f740 Merge changes from topics "ms25-appops", "ms28-service-fix"
* changes:
  [MS25.1] Remove AppOpsManager.OP_GET_USAGE_STATS dependency
  [MS28.1] Fix several hidden API dependencies
2022-01-03 22:41:07 +00:00
Les Lee
790cfd37e7 Merge "wifi data usage: replaced Wi-Fi SSID with a Wi-Fi network key" am: a0f6ce8fab am: a60a23aea9 am: b5257d3f2a am: 977efb07cb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1916817

Change-Id: I9e3bc289ac8c3da842e03acd6b7a205371375ab5
2022-01-03 13:12:06 +00:00
Les Lee
a0f6ce8fab Merge "wifi data usage: replaced Wi-Fi SSID with a Wi-Fi network key" 2022-01-03 12:36:49 +00:00
Les Lee
b0493845c3 Merge "wifi data usage: replaced Wi-Fi SSID with a Wi-Fi network key" 2022-01-03 12:36:49 +00:00
Aaron Huang
6acd545fe1 Use public resouce in android.R package
Use public resource since IpSec is planed to be moved into
Connectivity mainline module.

Bug: 204153604
Test: build
Change-Id: I0aafef6b9b08307c3aebce597a2dd24925c6b09a
2022-01-03 17:07:20 +08:00
Les Lee
c70871f60a wifi data usage: replaced Wi-Fi SSID with a Wi-Fi network key
1. Used SSID to be a wifi network identity can't separate wifi
data usage when there are two different network with same SSID.
Use a new usage key from WifiInfo to replace wifi SSID to solve
this issue.

2. To support to query wifi usage per configured Wifi network.
Adding matchWifiNetworkKeys in NetworkTemplate to support querying
multi networkKeys wifi data usage since each configured Wifi
network configuration might be used to connect different Wifi
network. (Replace mNetworkId with mMatchWifiNetworkKeys)

3. Updated callers who were using NetworkTemplate constructor.

4. Fixed SortedSet null order case. The null subscriberId is a
valid input for matchSubscriberIds.

5. Replaced ArrayUtils with CollectionUtils.

Bug: 197520752
Bug: 126299427
Test: atest -c NetworkTemplateTest
Test: atest -c NetworkStatsServiceTest
Test: atest -c NetworkPolicyManagerServiceTest
Test: atest -c NetworkPolicyTest
Change-Id: Ie20e7fb56597817901be4ce1d2a7afcbc9ded0c6
2022-01-03 15:13:00 +08:00
Les Lee
03bc782031 wifi data usage: replaced Wi-Fi SSID with a Wi-Fi network key
1. Used SSID to be a wifi network identity can't separate wifi
data usage when there are two different network with same SSID.
Use a new usage key from WifiInfo to replace wifi SSID to solve
this issue.

2. To support to query wifi usage per configured Wifi network.
Adding matchWifiNetworkKeys in NetworkTemplate to support querying
multi networkKeys wifi data usage since each configured Wifi
network configuration might be used to connect different Wifi
network. (Replace mNetworkId with mMatchWifiNetworkKeys)

3. Updated callers who were using NetworkTemplate constructor.

4. Fixed SortedSet null order case. The null subscriberId is a
valid input for matchSubscriberIds.

5. Replaced ArrayUtils with CollectionUtils.

Bug: 197520752
Bug: 126299427
Test: atest -c NetworkTemplateTest
Test: atest -c NetworkStatsServiceTest
Test: atest -c NetworkPolicyManagerServiceTest
Test: atest -c NetworkPolicyTest
Change-Id: Ie20e7fb56597817901be4ce1d2a7afcbc9ded0c6
2022-01-03 15:13:00 +08:00
Treehugger Robot
39b87c59a1 Merge "[MS23] Remove UserHandle.getUserId dependencies" am: b68d04b7bb am: fa435f5c40 am: 966a53292b am: 09b87000e3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1933096

Change-Id: I251415d32bbe3544f48337b4804fda41ef942f21
2021-12-30 16:17:34 +00:00
Treehugger Robot
b68d04b7bb Merge "[MS23] Remove UserHandle.getUserId dependencies" 2021-12-30 15:45:03 +00:00
Treehugger Robot
400e4dff51 Merge "[MS23] Remove UserHandle.getUserId dependencies" 2021-12-30 15:45:03 +00:00
Treehugger Robot
ac7fee3630 Merge "[MS26.1] Remove Process.NETWORK_STACK_UID dependency" am: 6b86e4a59f am: 4ae80d07ee am: 7ea166d48a am: a60797ba00
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1933093

Change-Id: Ie9c40a0858c74b2e7f121411516ddb1f17291098
2021-12-30 13:07:03 +00:00
Treehugger Robot
6b86e4a59f Merge "[MS26.1] Remove Process.NETWORK_STACK_UID dependency" 2021-12-30 12:43:39 +00:00
Treehugger Robot
08af91950f Merge "[MS26.1] Remove Process.NETWORK_STACK_UID dependency" 2021-12-30 12:43:39 +00:00
Junyu Lai
67b95e049e [MS25.1] Remove AppOpsManager.OP_GET_USAGE_STATS dependency
Replaced by public interface.

Test: TH
Bug: 204830222
Change-Id: If7d17879b0ffdb6300373bc581cb07252fccfc7a
2021-12-30 10:00:19 +00:00
Junyu Lai
7a6dbd4394 [MS25.1] Remove AppOpsManager.OP_GET_USAGE_STATS dependency
Replaced by public interface.

Test: TH
Bug: 204830222
Change-Id: If7d17879b0ffdb6300373bc581cb07252fccfc7a
2021-12-30 10:00:19 +00:00
Junyu Lai
978ef03a6c [MS23] Remove UserHandle.getUserId dependencies
Replaced with SystemApi.

Test: TH
Bug: 204830222
Change-Id: Ibc834489428c2036cd4ccd3284ba06c4c9e792b7
2021-12-30 10:00:19 +00:00