Commit Graph

478 Commits

Author SHA1 Message Date
Aaron Huang
874d4076a7 Have NetworkStats implements iterable
Make NetworkStats be iterable and expose iterator as system API
which is better than expose size() and getValues().
This API could be used by the caller who needs to get entry
from NetworkStats.

Bug: 210073043
CTS-Coverage-Bug: 215061403
Test: build, TH
Change-Id: I6cb4c8f63d7067133f2722b2be7e16b4098a697d
2022-01-19 15:54:17 +08:00
Junyu Lai
a079336270 Merge changes I16418791,I210f5ddc
* changes:
  [MS37.1] Expose APIs which is used by NPMS
  [MS55] Remove INetworkStats dependency from DataIdleTest
2022-01-19 07:08:15 +00:00
Junyu Lai
54eb405c64 Merge changes I16418791,I210f5ddc
* changes:
  [MS37.1] Expose APIs which is used by NPMS
  [MS55] Remove INetworkStats dependency from DataIdleTest
2022-01-19 07:08:15 +00:00
Junyu Lai
ba8efd5c84 [MS37.1] Expose APIs which is used by NPMS
Test: TH
Bug: 204830222
CTS-Coverage-Bug: 213124616
Change-Id: I16418791246b12fc3da7348ed36b58274e20db54
2022-01-19 07:07:34 +00:00
Junyu Lai
6fbf3ee9f5 [MS37.1] Expose APIs which is used by NPMS
Test: TH
Bug: 204830222
CTS-Coverage-Bug: 213124616
Change-Id: I16418791246b12fc3da7348ed36b58274e20db54
2022-01-19 07:07:34 +00:00
Xiao Ma
bb27ba3b11 Merge "Fix the Preconditions dependency in EthernetNetworkSpecifier." 2022-01-19 03:23:17 +00:00
Xiao Ma
c19bac5292 Merge "Fix the Preconditions dependency in EthernetNetworkSpecifier." 2022-01-19 03:23:17 +00:00
Treehugger Robot
f765d93862 Merge "[MS63.1] Remove TrafficStats.TAG_SYSTEM_DOWNLOAD dependency" am: 3a57e69dfe am: 3deb5c703a am: 4a07134b1f am: fc922e00ea
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1952106

Change-Id: I280b54ef8b105ed5a0fc6107e47a78d60b915514
2022-01-18 14:06:26 +00:00
Treehugger Robot
3a57e69dfe Merge "[MS63.1] Remove TrafficStats.TAG_SYSTEM_DOWNLOAD dependency" 2022-01-18 13:04:35 +00:00
Treehugger Robot
2b10dcdec0 Merge "[MS63.1] Remove TrafficStats.TAG_SYSTEM_DOWNLOAD dependency" 2022-01-18 13:04:35 +00:00
Xiao Ma
55b39355dd Fix the Preconditions dependency in EthernetNetworkSpecifier.
Ethernet service related files are going to be moved into Connectivity
module. Replace the Preconditions class in the EthernetNetworkSpecifier,
either add modules-utils-preconditions static lib dependency to fix it,
however, notice that will result in the duplicate class import when
moving ethernet stuff to p/m/Connectivity.

Bug: 210586283
Test: atest FrameworksNetTests EthernetServiceTests
Change-Id: I6163699be4126ef1b95dfb87ec9a6aba2c01195a
2022-01-18 04:50:41 +00:00
Xiao Ma
abdbab01cc Fix the Preconditions dependency in EthernetNetworkSpecifier.
Ethernet service related files are going to be moved into Connectivity
module. Replace the Preconditions class in the EthernetNetworkSpecifier,
either add modules-utils-preconditions static lib dependency to fix it,
however, notice that will result in the duplicate class import when
moving ethernet stuff to p/m/Connectivity.

Bug: 210586283
Test: atest FrameworksNetTests EthernetServiceTests
Change-Id: I6163699be4126ef1b95dfb87ec9a6aba2c01195a
2022-01-18 04:50:41 +00:00
Junyu Lai
2d34f3e729 [MS63.1] Remove TrafficStats.TAG_SYSTEM_DOWNLOAD dependency
Replace with system Api.

Test: TH
Bug: 204830222
CTS-Coverage-Bug: 215043101
Change-Id: Ic14b26d2862f6fe8bee18fe0c9eaf183052452ee
2022-01-18 02:54:27 +00:00
Junyu Lai
ab2c35e440 [MS63.1] Remove TrafficStats.TAG_SYSTEM_DOWNLOAD dependency
Replace with system Api.

Test: TH
Bug: 204830222
CTS-Coverage-Bug: 215043101
Change-Id: Ic14b26d2862f6fe8bee18fe0c9eaf183052452ee
2022-01-18 02:54:27 +00:00
Treehugger Robot
d38e468d6d Merge "[MS30] Remove ServiceManager#getService dependency" am: 703b9219a6 am: e17b853055 am: ca7b150b68 am: dad60e46f5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1934470

Change-Id: I34ea5f44978e6fd4640dc9036af891315794103c
2022-01-17 16:24:12 +00:00
Treehugger Robot
703b9219a6 Merge "[MS30] Remove ServiceManager#getService dependency" 2022-01-17 15:28:46 +00:00
Treehugger Robot
dfb7be30d1 Merge "[MS30] Remove ServiceManager#getService dependency" 2022-01-17 15:28:46 +00:00
Junyu Lai
d3cb2bae4f [MS30] Remove ServiceManager#getService dependency
Since TrafficStats is moving into the mainline module,
ServiceManager#getService can no longer be accessed.

This change use reflection to access getService, since
there is no offical way to get the service binder,
and TrafficStats is a static utility that doesn't have
the context to invoke Context#getSystemService.

This change also fixes minor lint errors.

Test: atest CtsNetTestCases:TrafficStatsTest
Bug: 204830222
Change-Id: I5caec42a71431b39f747fc791b8511d92e5cf7cc
2022-01-17 13:54:06 +00:00
Junyu Lai
3f7bb338bd [MS30] Remove ServiceManager#getService dependency
Since TrafficStats is moving into the mainline module,
ServiceManager#getService can no longer be accessed.

This change use reflection to access getService, since
there is no offical way to get the service binder,
and TrafficStats is a static utility that doesn't have
the context to invoke Context#getSystemService.

This change also fixes minor lint errors.

Test: atest CtsNetTestCases:TrafficStatsTest
Bug: 204830222
Change-Id: I5caec42a71431b39f747fc791b8511d92e5cf7cc
2022-01-17 13:54:06 +00:00
Aaron Huang
f2aa2b59d9 Merge "Add getter for the fields of NetworkStats.Entry" am: b939b68df8 am: bb659eb6c9 am: 2136f0ee89 am: eee8bb4792
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1944966

Change-Id: I3baa96f559e1f97c04a3d92abf37506ef1de1f0b
2022-01-17 10:24:13 +00:00
Aaron Huang
b939b68df8 Merge "Add getter for the fields of NetworkStats.Entry" 2022-01-17 09:31:55 +00:00
Aaron Huang
8843680f9a Merge "Add getter for the fields of NetworkStats.Entry" 2022-01-17 09:31:55 +00:00
Junyu Lai
0698de83ed Merge changes If51b6676,Ia6863a70,I802d2316 am: ada2a7fb3a am: 5c31d240c8 am: 27fa4c4894 am: 9a35bd9f9a
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1936181

Change-Id: I20b1ce8c3b7a5aebcfd0327703a62a38cb78c74f
2022-01-17 09:17:21 +00:00
Junyu Lai
ada2a7fb3a Merge changes If51b6676,Ia6863a70,I802d2316
* changes:
  [MS37] Replace NetworkStatsManagerInternal usages in NPMS
  [MS36] Remove unused getNetwork[Total|Uid]Bytes
  [MS35] Remove getNetwork[Total|Uid]Bytes dependencies from NPMS
2022-01-17 08:15:14 +00:00
Junyu Lai
dbc0da139c Merge changes If51b6676,Ia6863a70,I802d2316
* changes:
  [MS37] Replace NetworkStatsManagerInternal usages in NPMS
  [MS36] Remove unused getNetwork[Total|Uid]Bytes
  [MS35] Remove getNetwork[Total|Uid]Bytes dependencies from NPMS
2022-01-17 08:15:14 +00:00
Aaron Huang
3b5180d80e 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
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