Commit Graph

478 Commits

Author SHA1 Message Date
Junyu Lai
059f1403f6 [MS58] Expose Apis which will be used by data migration utility
This includes:
1. NetworkIdentity
2. NetworkIdentitySet
3. NetworkStatsHistory

NetworkStatsCollection Apis will be exposed in a separate CL.

Test: TH
Bug: 204830222
Change-Id: I47b2d3ac3b86cb4e6879afaae34326ca3c050ffa
2022-01-24 15:44:27 +08:00
Junyu Lai
3869785f9d Merge changes from topics "ms56-historybuilder", "ms65.3" am: 54bc16fc64 am: c12cb4a8d2 am: c8731ab38f am: a949e212c3
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1951478

Change-Id: Ib37133be135675f5735c3ba85987f94e35a305b4
2022-01-24 06:25:34 +00:00
Xiao Ma
ed76c1b8ea Move Ethernet related files to f/b/packages/ConnectivityT.
ethernet-service is going to be moved into Connectivity mainline module.
Notice that below sources are also only used in the ethernet framework
during compiling the filegroup: framework-connectivity-ethernet-sources.
Move them from f/b to f/b/packages/ConnectivityT as well.

Ethernet framework only related files:
    - IInternalNetworkManagementListener.aidl
    - InternalNetworkManagementException.java
    - InternalNetworkManagementException.aidl
    - InternalNetworkUpdateRequest.java
    - InternalNetworkUpdateRequest.aidl

Ethernet service only related files:
    - DelayedDiskWrite.java(IpConfigStore imports this class)

Bug: 210586283
Test: build pass
      atest FrameworksNetTests
      atest EthernetServiceTests
Change-Id: I1ec2d1d182c04f3f2acc9b757d5061ca749a4a3c
2022-01-24 04:15:14 +00:00
Xiao Ma
e3da3eb78b Move Ethernet related files to f/b/packages/ConnectivityT.
ethernet-service is going to be moved into Connectivity mainline module.
Notice that below sources are also only used in the ethernet framework
during compiling the filegroup: framework-connectivity-ethernet-sources.
Move them from f/b to f/b/packages/ConnectivityT as well.

Ethernet framework only related files:
    - IInternalNetworkManagementListener.aidl
    - InternalNetworkManagementException.java
    - InternalNetworkManagementException.aidl
    - InternalNetworkUpdateRequest.java
    - InternalNetworkUpdateRequest.aidl

Ethernet service only related files:
    - DelayedDiskWrite.java(IpConfigStore imports this class)

Bug: 210586283
Test: build pass
      atest FrameworksNetTests
      atest EthernetServiceTests
Change-Id: I1ec2d1d182c04f3f2acc9b757d5061ca749a4a3c
2022-01-24 04:15:14 +00:00
Junyu Lai
c0d66230ea [MS56.1] Add NetworkStatsHistory#Builder
NetworkStatsHistory will need to be exposed and constructed
from the data migration tool in the follow-up changes.
Add a Builder class to prevent from exposing internal array
structures.

Test: atest NetworkStatsHistoryTest#testBuilder
Bug: 204830222
Change-Id: I5f8ea1c825d601de0aac8623034ef896999fc1a0
2022-01-23 16:47:44 +08:00
Junyu Lai
8f1767e17f [MS56.1] Add NetworkStatsHistory#Builder
NetworkStatsHistory will need to be exposed and constructed
from the data migration tool in the follow-up changes.
Add a Builder class to prevent from exposing internal array
structures.

Test: atest NetworkStatsHistoryTest#testBuilder
Bug: 204830222
Change-Id: I5f8ea1c825d601de0aac8623034ef896999fc1a0
2022-01-23 16:47:44 +08:00
Junyu Lai
4489b71b9a [MS65.3] Address comments at aosp/1954383
This change also remove dependencies from
NetworkPolicyManagerService.

Test: atest NetworkIdentityTest#testBuilder \
      NetworkPolicyManagerServiceTest
Bug: 204830222
Change-Id: Ib1ec1968746d88165cbf5421d4ba30a00f4b678f
2022-01-23 16:47:36 +08:00
Junyu Lai
f91e175f96 [MS65.3] Address comments at aosp/1954383
This change also remove dependencies from
NetworkPolicyManagerService.

Test: atest NetworkIdentityTest#testBuilder \
      NetworkPolicyManagerServiceTest
Bug: 204830222
Change-Id: Ib1ec1968746d88165cbf5421d4ba30a00f4b678f
2022-01-23 16:47:36 +08:00
Les Lee
525e7b96c7 Merge "wifi data usage: Update calling API name" 2022-01-22 16:06:58 +00:00
Les Lee
103f53789d wifi data usage: Update calling API name
Bug: 213387087
Test: atest -c FrameworksWifiApiTests
Test: atest -c NetworkPolicyManagerServiceTest
Merged-In: I02d7f57de1acfd7b03be0a3e1c957ec1e1c5b4d4
Change-Id: I02d7f57de1acfd7b03be0a3e1c957ec1e1c5b4d4
2022-01-23 00:06:00 +08:00
Les Lee
a30280568d wifi data usage: Update calling API name
Bug: 213387087
Test: atest -c FrameworksWifiApiTests
Test: atest -c NetworkPolicyManagerServiceTest
Merged-In: I02d7f57de1acfd7b03be0a3e1c957ec1e1c5b4d4
Change-Id: I02d7f57de1acfd7b03be0a3e1c957ec1e1c5b4d4
2022-01-23 00:06:00 +08:00
Junyu Lai
8efe3482f3 [MS61] Remove NetworkManagementSocketTagger#install dependency
Expose TrafficStats#attachSocketTagger and use it instead.

Test: atest TrafficStatsTest
Bug: 204830222
CTS-Coverage-Bug: 214979748
Change-Id: I1748d349b499053ad08bd62202325fa759ad8da5
2022-01-22 13:51:55 +08:00
Junyu Lai
8e58c82591 [MS61] Remove NetworkManagementSocketTagger#install dependency
Expose TrafficStats#attachSocketTagger and use it instead.

Test: atest TrafficStatsTest
Bug: 204830222
CTS-Coverage-Bug: 214979748
Change-Id: I1748d349b499053ad08bd62202325fa759ad8da5
2022-01-22 13:51:55 +08:00
Junyu Lai
485be2ee5b Merge "[MS66] Initialize TrafficStats with context" am: a411d32226 am: c77ec27366 am: 69eba2b797 am: 1685e52be5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1956077

Change-Id: I5c1588157302b236ffa03329cde4f63277026bbf
2022-01-22 01:15:07 +00:00
Junyu Lai
6f39e805a1 [MS66] Initialize TrafficStats with context
TrafficStats has static methods created in API level 8 that need
access to NetworkStatsManager but doesn't take a context.
Previously this was achieved by using ServiceManager, but
with TrafficStats moving to the connectivity module, this
is no longer possible.

Instead, make sure TrafficStats has an appropriate context by
the time any client code can call the relevant methods.
• In app code, this achieved by passing the application
  context from ActivityThread#handleBindApplication, before any
  app code can run.
• In the system server, this is achieved by passing the context
  right after creating service.

Test: atest TrafficStatsTest CtsWebkitTestCases
Bug: 204830222

Change-Id: I251bb8a4431ad12ff61929879ef1363cf06b9244
2022-01-22 01:01:49 +08:00
Junyu Lai
92d5b4cbc2 [MS66] Initialize TrafficStats with context
TrafficStats has static methods created in API level 8 that need
access to NetworkStatsManager but doesn't take a context.
Previously this was achieved by using ServiceManager, but
with TrafficStats moving to the connectivity module, this
is no longer possible.

Instead, make sure TrafficStats has an appropriate context by
the time any client code can call the relevant methods.
• In app code, this achieved by passing the application
  context from ActivityThread#handleBindApplication, before any
  app code can run.
• In the system server, this is achieved by passing the context
  right after creating service.

Test: atest TrafficStatsTest CtsWebkitTestCases
Bug: 204830222

Change-Id: I251bb8a4431ad12ff61929879ef1363cf06b9244
2022-01-22 01:01:49 +08:00
Les Lee
909741d0c2 wifi data usage: Update calling API name
Bug: 213387087
Test: atest -c FrameworksWifiApiTests
Test: atest -c NetworkPolicyManagerServiceTest
Change-Id: I02d7f57de1acfd7b03be0a3e1c957ec1e1c5b4d4
Ignore-AOSP-First: Related API conflict in wifi module, need master first.
2022-01-21 22:38:02 +08:00
Junyu Lai
0a9f7cd59c Merge changes from topic "ms65-identity" am: 6dcaf9dee4 am: d027e6cd1c am: 7e7eb05e08 am: 7ed0072f07
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1954383

Change-Id: Ib449635e1b121fde7c97f0d668b6f9ce92d8c3eb
2022-01-21 10:34:13 +00:00
Junyu Lai
6dcaf9dee4 Merge changes from topic "ms65-identity"
* changes:
  [MS65.1] Add NetworkIdentity#Builder
  [MS46] Remove INetworkStatsSession usage from NetworkCycleDataLoader
2022-01-21 09:36:08 +00:00
Junyu Lai
8ab6b706c0 Merge changes from topic "ms65-identity"
* changes:
  [MS65.1] Add NetworkIdentity#Builder
  [MS46] Remove INetworkStatsSession usage from NetworkCycleDataLoader
2022-01-21 09:36:08 +00:00
Frank Li
7602118dd9 Merge "[DU03-1]Remove INetworkStatsService from BatteryStatsImpl" am: acd0aef603 am: 18bf9f8d10 am: df8a07ce41 am: 85d620386f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1948496

Change-Id: Ie58903de1d88367bced48dd4e79c51cfd49701b8
2022-01-21 09:12:55 +00:00
lifr
02eb422cb4 [DU03-1]Remove INetworkStatsService from BatteryStatsImpl
Expose systemapi NetworkStats.getDetailedUidStats for use by
BatteryStats.

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 NetworkStatsServiceTest
CTS-Coverage-Bug: 213437796
Change-Id: I40d713923278f4654d67bb4d12155cea85c10447
2022-01-21 13:52:41 +08:00
lifr
2b7135e794 [DU03-1]Remove INetworkStatsService from BatteryStatsImpl
Expose systemapi NetworkStats.getDetailedUidStats for use by
BatteryStats.

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 NetworkStatsServiceTest
CTS-Coverage-Bug: 213437796
Change-Id: I40d713923278f4654d67bb4d12155cea85c10447
2022-01-21 13:52:41 +08:00
Junyu Lai
9421920ef0 Merge changes from topic "ms57-migrationapi" am: 717c22831a am: 7b8b30b556 am: d2e67b90c6 am: c649f6854b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1951477

Change-Id: I4d3e51cc7c2c9ab4ae85a5e03839219b73df2525
2022-01-21 05:39:15 +00:00
Junyu Lai
294c24e2e9 [MS45] Expose SystemApis to query summary and history with template am: 84316eb4b6 am: 0ac2f83852 am: 7805221bdc am: 3cee4edd39
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1940846

Change-Id: I934147935aeca34518e09ab9a2771efd0da18cb2
2022-01-21 05:39:02 +00:00
Junyu Lai
91a7775370 Merge "[MS41.1] Prepare for APIs for querying usage with template" am: 22c1481659 am: 39f1142822 am: b8e7864780 am: 3474702f29
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1937268

Change-Id: Ib7f1fab00d0e626d90748a3246e6cdce487d1e79
2022-01-21 01:37:52 +00:00
Junyu Lai
86377eba46 [MS65.1] Add NetworkIdentity#Builder
Test: atest NetworkIdentityTest#testBuilder
Bug: 204830222

Change-Id: Ifdb6482a54fb1e6999c82647d2710cb833c78d02
2022-01-20 17:12:14 +00:00
Junyu Lai
838e533772 [MS65.1] Add NetworkIdentity#Builder
Test: atest NetworkIdentityTest#testBuilder
Bug: 204830222

Change-Id: Ifdb6482a54fb1e6999c82647d2710cb833c78d02
2022-01-20 17:12:14 +00:00
Junyu Lai
a8dc50de05 [MS57.1] Prepare APIs for data migration utility
This includes:
1. Move PREFIX_* constants to NetworkStatsManager to expose
   in later changes.
2. Rename networkId to wifiNetworkKey.
3. Rename subType to ratType.
4. Replace SUBTYPE_COMBINED with NETWORK_TYPE_ALL
5. Fix lint errors when exposing system api.

Test: TH
Bug: 204830222
Change-Id: I2b7c34958bc59c3225c96f12abba008b83101585
2022-01-20 13:10:36 +00:00
Junyu Lai
62febc13a3 [MS57.1] Prepare APIs for data migration utility
This includes:
1. Move PREFIX_* constants to NetworkStatsManager to expose
   in later changes.
2. Rename networkId to wifiNetworkKey.
3. Rename subType to ratType.
4. Replace SUBTYPE_COMBINED with NETWORK_TYPE_ALL
5. Fix lint errors when exposing system api.

Test: TH
Bug: 204830222
Change-Id: I2b7c34958bc59c3225c96f12abba008b83101585
2022-01-20 13:10:36 +00:00
Junyu Lai
84316eb4b6 [MS45] Expose SystemApis to query summary and history with template
This includes:
1. queryDetailsForDevice: get history of network stats that
   matches the given template.
2. querySummaryForDevice: similar to the above one, but the
   result is aggregated over time.
3. queryDetailsForUidTagState: get history of uid stats that
   matches the given template, uid, tag and other conditions.
4. querySummary: similar to the above one, but the
   result is aggregated over time.
5. queryTaggedSummary: similar to the above one, but only
   return tagged data.

Test: TH
Bug: 204830222
Change-Id: Ic18010822a33e340b954e9c53dc515f3b6224d6d
2022-01-20 13:03:39 +00:00
Junyu Lai
51aee69b4e [MS45] Expose SystemApis to query summary and history with template
This includes:
1. queryDetailsForDevice: get history of network stats that
   matches the given template.
2. querySummaryForDevice: similar to the above one, but the
   result is aggregated over time.
3. queryDetailsForUidTagState: get history of uid stats that
   matches the given template, uid, tag and other conditions.
4. querySummary: similar to the above one, but the
   result is aggregated over time.
5. queryTaggedSummary: similar to the above one, but only
   return tagged data.

Test: TH
Bug: 204830222
Change-Id: Ic18010822a33e340b954e9c53dc515f3b6224d6d
2022-01-20 13:03:39 +00:00
Junyu Lai
bb459aeaba [MS41.1] Prepare for APIs for querying usage with template
This CL includes:
1. Prepare for queryDetailsForDevice which allows callers
   to query history of networks that matches the given template.
2. Prepare for queryDetailsForUidTagState, which allows
   callers to query history uid stats with the given template,
   uid and other conditions.
3. Enforce fine location permission if the caller is querying
   data usage with a template which contains wifi network keys.

Test: atest NetworkStatsServiceTest NetworkStatsManagerTest
Bug: 204830222
Bug: 200768422
Change-Id: I6783d6bfd6e075e0b3ec8a3c91836377f1d71c7a
2022-01-20 13:03:35 +00:00
Junyu Lai
30308aacd8 [MS41.1] Prepare for APIs for querying usage with template
This CL includes:
1. Prepare for queryDetailsForDevice which allows callers
   to query history of networks that matches the given template.
2. Prepare for queryDetailsForUidTagState, which allows
   callers to query history uid stats with the given template,
   uid and other conditions.
3. Enforce fine location permission if the caller is querying
   data usage with a template which contains wifi network keys.

Test: atest NetworkStatsServiceTest NetworkStatsManagerTest
Bug: 204830222
Bug: 200768422
Change-Id: I6783d6bfd6e075e0b3ec8a3c91836377f1d71c7a
2022-01-20 13:03:35 +00:00
TreeHugger Robot
27c23a42fa Merge "Revert "Revert "Migrate unsafe parcel APIs in framework-minus-apex""" 2022-01-20 11:33:39 +00:00
Aaron Huang
b029b152b7 Merge "Have NetworkStats implements iterable" am: 589a43475c am: 3ffbc208c2 am: 2dd2269846 am: 599ead3973
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1952101

Change-Id: I1e7296fc9d4a54d55e913e7b7c152a8ea826f931
2022-01-20 06:11:44 +00:00
Treehugger Robot
45e5c761b6 Merge "[MS64] Remove subscriberId and NetworkId in proto" am: 57c4d95609 am: e6a6334c3c am: 4fc736f508 am: 42cf9f806b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1954021

Change-Id: Ie7dcf065cd794284dc2c49b5073e6e3012aeec2a
2022-01-20 06:09:54 +00:00
Treehugger Robot
3a00b5bd7c Merge "Remove ServiceManager usage from IpSecTransform" am: 714ef48d78 am: 26a42971ac am: f255dfd19f am: 925f1d7f65
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1933095

Change-Id: I12987871fd14f21368ca50d67a23bb084019fde0
2022-01-20 06:06:04 +00:00
Junyu Lai
7f32f4afd7 Merge changes I16418791,I210f5ddc am: a079336270 am: 6310f20de1 am: 84230bed95 am: f0ebe80298
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1948617

Change-Id: Ia8feea64f0459864c8e956f9f5a309c5f085cea3
2022-01-20 06:05:27 +00:00
Xiao Ma
b2b3a5dfc9 Merge "Fix the Preconditions dependency in EthernetNetworkSpecifier." am: bb27ba3b11 am: d86eb8579e am: 920a25595e am: 214a33b5d6
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1952108

Change-Id: Iba502daec9ce72ff9f0075af010e789963d06b94
2022-01-20 06:03:29 +00:00
Aaron Huang
589a43475c Merge "Have NetworkStats implements iterable" 2022-01-20 04:09:00 +00:00
Aaron Huang
d99dc72c93 Merge "Have NetworkStats implements iterable" 2022-01-20 04:09:00 +00:00
Treehugger Robot
57c4d95609 Merge "[MS64] Remove subscriberId and NetworkId in proto" 2022-01-20 02:32:59 +00:00
Treehugger Robot
bfcf6325ee Merge "[MS64] Remove subscriberId and NetworkId in proto" 2022-01-20 02:32:59 +00:00
Junyu Lai
504e9b3587 [MS64] Remove subscriberId and NetworkId in proto
netstats.proto is about to move into mainline module.
And it can no longer see privacy.proto definition.
Thus, this change remove PII data that is not very useful
when debugging and any reference to privacy.proto.

Test: adb bugreport and check output at transponder
Bug: 204830222
Change-Id: I755530f356d2c16b336d62785c4c17c557f792db
2022-01-19 16:08:40 +00:00
Junyu Lai
11169e3da7 [MS64] Remove subscriberId and NetworkId in proto
netstats.proto is about to move into mainline module.
And it can no longer see privacy.proto definition.
Thus, this change remove PII data that is not very useful
when debugging and any reference to privacy.proto.

Test: adb bugreport and check output at transponder
Bug: 204830222
Change-Id: I755530f356d2c16b336d62785c4c17c557f792db
2022-01-19 16:08:40 +00:00
Bernardo Rufino
2ace102c5e Revert "Revert "Migrate unsafe parcel APIs in framework-minus-apex""
This reverts commit 7fe4f60b74.

Reintroducing ag/16366278 since it seems unrelated to b/214053959 (more details on b/214053959#comment55).

Original commit message:

Migrate unsafe parcel APIs in framework-minus-apex

Migrate the following unsafe parcel APIs in framework-minus-apex:
* Parcel.readSerializable()
* Parcel.readArrayList()
* Parcel.readList()
* Parcel.readParcelable()
* Parcel.readParcelableList()
* Parcel.readSparseArray()

This CL was generated by applying lint fixes that infer the expected
type from the caller code and provide that as the type parameter
(ag/16365240).

A few observations:
* In some classes we couldn't migrate because the class also belonged to
another build module whose min SDK wasn't current (as is the case for
framework-minus-apex), hence I suppressed the lint check
(since I'll eventually submit the lint check to the tree).
* In some cases, I needed to do the cast in
https://stackoverflow.com/a/1080525/5765705 to make the compiler happy
since there isn't another way of providing a class of type
Class<MyClassWithGenerics<T>>.
* In the readSerializable() case, the new API also requires the class
loader, that was inferred to by InferredClass.class.getClassLoader().
* Note that automatic formatting and import rely on running hooked up
to the IDE, which wasn't the case here.

Bug: 195622897
Change-Id: I272432e6e082a973f7a50492ec35d79c2b577c93
Test: TH passes
2022-01-19 11:13:18 +00:00
Treehugger Robot
714ef48d78 Merge "Remove ServiceManager usage from IpSecTransform" 2022-01-19 07:59:56 +00:00
Treehugger Robot
41fe9f7e31 Merge "Remove ServiceManager usage from IpSecTransform" 2022-01-19 07:59:56 +00:00
Aaron Huang
1cad2ea651 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