Commit Graph

3459 Commits

Author SHA1 Message Date
Junyu Lai
989b2128db [MS21] Remove DataUnit dependency
DataUnit is a hidden class, remove the references to
it from files that about to be moved into the module.

Test: TH
Bug: 204830222

Change-Id: Ibfb82ab74f283686fb2af6c3a550d541440c890d
2021-12-29 01:43:53 +00:00
Junyu Lai
6c4fca78b0 [MS19.1] Fix several hidden API dependencies
This includes:
1. Use android.util.IndentingPrintWriter instead of the
   deprecated internal one.
2. Replace usages of IntArray with CollectionUtils and ArrayList.
3. Replace usages of ArrayUtils with CollectionUtils.
4. Refactor MathUtils.constrain functions into NetworkStatsUtils.
5. Replace Maps.newHashMap and Lists.newArrayList with public
   class constructors.
6. Replace Slog with Log.

Test: FrameworksNetTests NetworkStaticLibTests
Bug: 204830222
Change-Id: If009194ad5668a6d48dd341ea6d325028ce56d42
2021-12-28 09:16:33 +00:00
Aaron Huang
fe925d8e2d Remove ServiceManager usage from IpSecTransform
Remove ServiceManager hidden API dependency because this class
is going to be moved into mainline module. Thus have IpSecTransform
calls createTransform and deleteTransform through IpSecManager to
remove the ServiceManager usage.

Bug: 204153604
Test: FrameworksNetTests
Change-Id: Iba48da4aecac1080684d5a7e7e7ca2e31219591a
2021-12-28 02:59:26 +08:00
Junyu Lai
366c1d7c4b [MS18] Augment data usage by default
Follow-up from ag/2815797, callers who uses the hidden API
will have their data augmented by default, and the public
API offers a way to opt-into augmentation.

However, since the data usage is going to the module.
All the hidden API usage must be eliminated. Also, from user
perspective, it is better for UI and API to have aligned
behavior.

Thus, enable augment data usage for public API callers.

Test: atest FrameworksNetTests \
      android.app.usage.cts.NetworkUsageStatsTest
Bug: 204830222
Change-Id: Ida254fac8d44c32d388f1886a866f7324a41ce75
2021-12-24 09:55:22 +00:00
Junyu Lai
654c1a61d5 [MS16.1] Prepare APIs for replacing getNetwork[Total|Uid]Bytes
These internal methods are used in MultipathPolicyTracker and
NetworkPolicyManagementService. getNetworkTotalBytes is used
to query total bytes regarding to the specified NetworkPolicy,
to see how much data quota is used. getNetworkUidBytes is used
to find the app to blame for rapid data usage.

These methods needs to be replaced by public APIs in follow-up
patches.

Test: TH
Bug: 204830222
Change-Id: Iec9cc7a07397ec2bbc6c3d2559fc3680b149cb8a
2021-12-24 08:50:29 +00:00
Junyu Lai
c71df46649 Merge "[MS15.1] Remove get/setSubscriberIdMatchRule dependencies" 2021-12-23 01:35:00 +00:00
James Mattis
be91b5831e eth manager updates for network management APIs
Private methods added to EthernetManager for network management to be
made public when ready.

Bug: 210485380
Test: make, flash and boot
Change-Id: I7f484d373e05225c98bf0e6111afdc12be31764f
2021-12-22 11:11:01 -08:00
James Mattis
d03aa846f3 aidl and Parcelable defintions for eth management
aidl and Parcelable definitions neccessary for internal network
management APIs as related to ethernet interfaces.

Bug: 210485380
Test: make, flash and boot
Change-Id: I5908d21564014c56282dad001da441f5b900b523
2021-12-22 11:10:58 -08:00
Frank Li
00827ef1db Merge "[DU02]Remove DevicePolicyManagerInternal from NetworkStatsAccess" 2021-12-22 14:13:55 +00:00
Treehugger Robot
2e22d3c35a Merge "Replace Preconditions.checkNotNull with Objects.requireNonNull" 2021-12-22 11:37:42 +00:00
Junyu Lai
4451b45f70 [MS15.1] Remove get/setSubscriberIdMatchRule dependencies
Subscriber Id Match Rule won't be exposed as system Api.
Callers should use Builder#setSubscriberIds or
NetworkTemplate#getSubscriberIds to set/get the Subscriber
Ids filter. An empty set in the paremter or return value
represents the intention of matching any Subscriber Ids.

Test: atest NetworkPolicyManagerServiceTest \
      FrameworksNetTests
Bug: 204830222

Change-Id: I12c54280b44c71e4737e82859dfe869794cc9c29
2021-12-22 09:50:44 +00:00
Aaron Huang
eb50ef2da7 Replace Preconditions.checkNotNull with Objects.requireNonNull
IpSec service is going to be moved into Connectivity module. Replace
Preconditions.checkNotNull with Objects.requireNonNull to remove
hidden API usages.

Bug: 204153604
Test: FrameworksNetTests
Change-Id: Iff7f76844d4126b0e17b62b4ce821449b5b6ce44
2021-12-22 16:35:13 +08:00
Treehugger Robot
b6d02f2cc0 Merge "[MS14] Move isPersistable to NetworkPolicy" 2021-12-21 16:09:25 +00:00
Treehugger Robot
6609167efe Merge "[MS12.1] Support NetworkTemplate builder" 2021-12-21 15:09:43 +00:00
Aaron Huang
d793de23f0 Merge "Make IpSecManager.DIRECTION_FWD @SystemApi" 2021-12-21 12:49:49 +00:00
Junyu Lai
682bebbf60 [MS14] Move isPersistable to NetworkPolicy
Since the NetworkTemplate serialization is done in the platform
code. To decide whether the template is persistable should be
also inside the platform along with the serialization logic.

Test: atest NetworkPolicyTest
Bug: 204830222
Change-Id: I15d17dda77e6a3e1ae11275915e3d2f6e2888639
2021-12-21 10:05:47 +00:00
Junyu Lai
2c94410620 [MS12.1] Support NetworkTemplate builder
In current design, NeworkTemplate has a lot of buildTemplate*
functions to create various type of templates. These functions
do not have any flexibility to add any dimension. Thus, if
there is a need to add a dimension, the typical ways are:
  1. Add one parameter to the buildTemplate* function and change
     all callers.
  2. Use the NetworkTemplate constructors directly. And add one
     more parameter if it doesn't fulfill the needs.

These codes are painful to maintain in the future if they are
exposed as system api since they are lack of flexibility. Thus,
introduce a builder class to NetworkTemplate to address this
problem.

Test: atest NetworkTemplateTest
Bug: 204830222
Change-Id: I49fab236bac392563b1290d69573ad1415fda734
2021-12-21 10:05:36 +00:00
lifr
155cb5cced [DU02]Remove DevicePolicyManagerInternal from NetworkStatsAccess
NetworkStatsAccess is using DevicePolicyManagerInternal APIs, which
cannot be accessed after moving into the mainline module. So, replace
and remove those hidden API usages.

Bug: 207100745
Test: atest NetworkStatsAccessTest
Change-Id: I0802148050869d92e1f09d1d657034380029f236
2021-12-21 11:31:44 +08:00
Junyu Lai
9105163c65 Merge "[MS10.1] Move multiplySafeByRational to NetworkStatsUtils" 2021-12-21 01:22:14 +00:00
Junyu Lai
06bba324a8 Merge "[MS05] Fix NetworkTemplate lint errors" 2021-12-20 11:54:10 +00:00
Junyu Lai
46429b7ded [MS10.1] Move multiplySafeByRational to NetworkStatsUtils
Since NetworkStats related code will be moved to the module.
multiplySafeByRational in the NetworkUtilsInternal cannot be
accessed after that. Thus, create another utils class that
will be moved with NetworkStats code and put the function
into it.

Test: atest NetworkStaticLibTests:com.android.net.moduletests.util.NetworkStatsUtilsTest
Bug: 204830222
Change-Id: I96f3ac02e57b7325ed53988285770f478dee529e
2021-12-20 09:12:13 +00:00
Junyu Lai
051de2cd49 [MS05] Fix NetworkTemplate lint errors
This change also defines some IntDef annotations that will
be used in the follow-up CLs.

Test: TH
Bug: 204830222
Change-Id: Iba5e714a1304fdfd154379415dcc5d0f9b7b1b29
2021-12-20 15:17:16 +08:00
Aaron Huang
30a2b03042 Make IpSecManager.DIRECTION_FWD @SystemApi
IpSecManager.DIRECTION_FWD is used by VcnGatewayConnection and
it will be not visible to platform after IpSec was moved into
Connectivity mainline module. Therefore, make DIRECTION_FWD
@SystemApi so that it can be used by VcnGatewayConnection.

Bug: 204153604
Test: FrameworksNetTests
Change-Id: I80dc2a5b4940504820cee0d8e2d2e59ef3fcca18
2021-12-19 02:44:24 +08:00
Treehugger Robot
c6b33a78bf Merge "Remove unused import in IpSecAlgorithm" 2021-12-16 20:45:17 +00:00
Aaron Huang
a2a6b960a3 Remove unused import in IpSecAlgorithm
HexDump is an internal class which cannot be visible to mainline
module. Remove it since this is unused.

Bug: 204153604
Test: FrameworksNetTests
Change-Id: Ie65e7eff8464487719c3124005a097a500ba21c6
2021-12-16 17:36:10 +00:00
Treehugger Robot
ed3a5226ed Merge "Remove isUnsafeBuild() from IpSecAlgorithm" 2021-12-16 14:16:50 +00:00
Xiao Ma
84f212ded1 Merge "Move Ethernet related files to f/b/packages/ConnectivityT." 2021-12-16 14:12:39 +00:00
Aaron Huang
3cc56c37be Merge "Remove NetdService usage from IpSecService" 2021-12-16 12:32:41 +00:00
Junyu Lai
a9f47b7aaa Merge "[MS03] Remove ServiceNotFoundException hidden API usage" 2021-12-16 10:42:15 +00:00
Xiao Ma
d3d8f41f2b Move Ethernet related files to f/b/packages/ConnectivityT.
ethernet-service is going to be moved into Connectivity mainline module.
Move all ethernet related files in f/b/ to f/b/packages/ConnectivityT so
that it's easier to migrate these files to Connectivity module finally
after clearing the hidden API usages. Below files to be moved:

Ethernet framework related files:
    - EthernetManager.java
    - EthernetNetworkSpecifier.java
    - IEthernetManager.aidl
    - IEthernetServiceListener.aidl
    - ITetheredInterfaceCallback.aidl

Ethernet service related files:
    - IpConfigStore.java(EthernetConfigStore has dependency on the class)

For the ethernet-service related files, keep it as-is temproraliy and
fix the hiden API dependencies in f/opt/net/ethernet/. After this work
is done, then migrating the whole of ethernet folder to Connectivity
module completely.

This CL also fixes some minor errors of code style format to pass the
code style check.

Bug: 210586283
Test: build pass
      atest FrameworksNetTests
      atest EthernetServiceTests
Change-Id: Ib359d29d5221105f648bc4194c6d6dbe4cc6e3e5
2021-12-16 06:59:08 +00:00
Aaron Huang
e6ab4493c6 Remove isUnsafeBuild() from IpSecAlgorithm
IpSec is going to move to Connectivity mainline module so
hidden API usage should be removed. There's no formal API
could be an alternative for Build.IS_ENG. Considering
isUnsafeBuild() is not a really helpful method because it
only prints the log in eng build. Therefore, remove it.

Bug: 204153604
Test: FrameworksNetTests
Change-Id: Ic354e12423629b0d72e8087843893953a0c8c465
2021-12-15 19:33:03 +08:00
Aaron Huang
f318d55576 Remove NetdService usage from IpSecService
IpSecService is going to be moved into ConnectivityService
module. So, NetdService won't be visible to IpSecService
since it is a hidden class.

NetdService.get(timeout) is a method that blocks for specified time
until INetd instance is available. In SystemServer IpSecService is
created after NetworkManagementService and NMS uses NetdService.get()
to get INetd instance which is a method that blocks until an INetd
instance is available. Thus, connectNativeNetdService can be removed
because NMS already waits for INetd instance is available so IpSecService
should be able to get INetd instance immediately.

Bug: 204153604
Test: FrameworksNetTest
Change-Id: I007cb28de63783d60084f93dddb4de78faa0e868
2021-12-15 19:29:00 +08:00
Aaron Huang
ba1ec3f6b4 Merge "Refactor IpSecServiceConfiguration to Dependencies" 2021-12-15 07:53:23 +00:00
Treehugger Robot
f715998454 Merge "Fix style errors for IpSec associated files" 2021-12-15 06:28:14 +00:00
Xin Li
78129f3c2e Merge "Merge Android 12 QPR1" 2021-12-14 20:25:23 +00:00
Xin Li
c911bc05a4 Merge Android 12 QPR1
Bug: 210511427
Merged-In: Ibcfed4617dcaea3b81e5d3a3eb68e6494488c7f7
Change-Id: I43f94bca1c8db649bec91e0de1bd41c89ba8f1f7
2021-12-14 08:39:06 -08:00
Treehugger Robot
1bb6b56c6b Merge "Move IpSec associated files to f/b/packages/ConnectivityT" 2021-12-14 08:28:46 +00:00
Aaron Huang
92b7afc777 Refactor IpSecServiceConfiguration to Dependencies
IpSecService is going to be moved into ConnectivityService module,
so the hidden API usage should be removed.

NetdService.getNetdInstance is a hidden API, therefore the alternative
is to get the instance by Context.getSystemService.

Bug: 204153604
Test: FrameworksNetTests

Change-Id: I1bd8efc03c37654d12a8eadd3e78ed45e10b5691
2021-12-14 14:39:42 +08:00
Aaron Huang
b24f3da2b9 Fix style errors for IpSec associated files
Bug: 204153604
Test: build pass.
Change-Id: I940de8bef7f693dcce8808148a975bea1f36712c
2021-12-14 14:36:59 +08:00
Aaron Huang
8f4e23616c Move IpSec associated files to f/b/packages/ConnectivityT
IpSecService is going to be moved into Connectivity mainline module.
Move all ipsec associated files to packages/ConnectivityT so that
it can be easily migrate these files to connectivity module after
clearing the hidden API usages.

Bug: 204153604
Test: build pass
      FrameworksNetTests
      CtsNetTestCases
Change-Id: I562b47f18e345988a2638cf886f86818f9144b91
2021-12-14 14:06:44 +08:00
Paul Hu
442f296638 Merge "Remove Preconditions, Protocol @hide usage" 2021-12-14 02:52:11 +00:00
Treehugger Robot
a5b408dfa1 Merge "Register NSD service from ConnectivityFrameworkInitializerTiramisu" am: 78bed54352
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1899035

Change-Id: I658096512da1c4eaa6b60691f6f226b86adb44fe
2021-12-13 15:29:43 +00:00
Treehugger Robot
78bed54352 Merge "Register NSD service from ConnectivityFrameworkInitializerTiramisu" 2021-12-13 15:04:23 +00:00
Remi NGUYEN VAN
5393e070ed Remove Preconditions, Protocol @hide usage
Remove hidden API usage of the Preconditions and Protocol classes in
NsdManager.

NsdManager does not share its handler with other components, so it does
not need to use specific message IDs from Protocol.
Preconditions can also be easily replaced with stable API alternatives.

Bug: 190249673
Test: atest FrameworksNetTests CtsNetTestCases:NsdManagerTest
Change-Id: Ia173f99b82c90df702291c3690f4a7b047e90daa
2021-12-13 17:37:02 +08:00
paulhu
51ce7c1fa0 Register NSD service from ConnectivityFrameworkInitializerTiramisu
INsdManager is going to move into connectivity mainline module
and it will be not visible to SystemServiceRegistry after
migration done. Thus, use ConnectivityFrameworkInitializerTiramisu
to register NSD service instead.

ConnectivityFrameworkInitializerTiramisu will be implemented in
the framework-connectivity-tiramisu bootclasspath JAR, which need
to be separated from the S+ framework-connectivity bootclasspath
JAR to be only loaded by the module on T+. So its methods cannot
be in the same class as ConnectivityFrameworkInitializer.

Bug: 206702844
Test: atest FrameworksNetTests CtsNetTestCases
Merged-In: Ibf89ab9a35e35dac4978ba70c7ab306b6155a4a3
Change-Id: Ibf89ab9a35e35dac4978ba70c7ab306b6155a4a3
2021-12-13 15:33:03 +08:00
Junyu Lai
2c62aabec6 [MS03] Remove ServiceNotFoundException hidden API usage
Since ServiceNotFoundException is not a system API. Remove
the unsupported interface which uses this exception.
This is safe since the method annotated with maxTargetSdk = R
and from dashboard it is not using by anybody.

Test: TH
Bug: 204830222
Change-Id: Ib8c0ce7b165732d24929851792d35371b90a5dfc
2021-12-13 06:26:07 +00:00
Junyu Lai
7fc51e8a95 Merge "[MS01] Move NetworkTemplate cloud backup functions to NetworkPolicy" am: 40eb40302d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1878037

Change-Id: I86a23381b25fba2512c2ad1d3ffeb60d12947202
2021-12-10 22:30:19 +00:00
Treehugger Robot
cbc9da2aa2 Merge changes from topic "ms07-movestats" am: 942c713c9d
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1895044

Change-Id: I85d704b09dac07e91b8400a2bbd15867e2b80d6d
2021-12-10 18:57:08 +00:00
Junyu Lai
24138d07ed [MS01] Move NetworkTemplate cloud backup functions to NetworkPolicy
Since NetworkTemplate will be moved into the mainline module.
It is necessary to remove hidden BackupUtil usage from
NetworkTemplate. Also, it is also a hazard to maintain
compatibility for byte buffer interfaces.

Thus, move out these cloud backup functions to NetworkPolicy
to address these concerns.

Test: atest NetworkPolicyTest NetworkPolicyManagerServiceTest
Bug: 204830222
Change-Id: I3ec55f7e419ea13db535acff2457d8e7aaebdce8
2021-12-10 16:11:09 +00:00
Junyu Lai
4b2fa5914a [MS07.1] Move NetworkStatsCollection/IdentitySet into frameworks
These files are needed for the data migration util system Api
interfaces to allow OEMs to construct NetworkStats* objects.
Thus, they need to be moved into android.net package, and some
of them will be exposed as @SystemApi in T.

Eventually these classes will be moved into the Connectivity
module, but in the mean time they will be temporarily moved to
f/b/package/ConnectivityT for the preparation stage.
However, the tests are already in the module. Therefore for
the S-derived branch, the test cannot see the renamed classes
since any framework CLs will not be auto-merged into this branch.
Thus, the tests need to stay disabled on the S-derived branch,
and will be re-enabled after all files are moved into the module.

Test: TH
Bug: 197717846

Change-Id: I95278a99cf2437ada28001161ceea17a1d32f2a4
2021-12-10 16:11:08 +00:00