Commit Graph

51702 Commits

Author SHA1 Message Date
Patrick Rohr
fd87fb65fb Use completeExceptionally instead of second future
The onError callback can use the same future as the onResult callback by
calling completeExceptionally.
This change is also removing the test for a specific exception message.
Testing for a specific exception message would mean that tests break if we
ever were to update them. If we decide that there is value to
distinguish between different types of
EthernetNetworkManagementException we should probably subclass it
internally.

Test: atest EthernetNetworkFactoryTest
Change-Id: Ib6f8cf79fc26e0f856c880cbe505b101f12aa187
2022-04-04 14:59:42 +02:00
Patrick Rohr
50c470e308 Address EthernetManager javadoc review comments
Test: TH
Change-Id: Iafa8979d8e96ea4d078b017e56ee61334d33b5f5
2022-04-04 14:59:42 +02:00
Patrick Rohr
0f2cbe92f1 Update javadoc to match expectation for UnsupportedOperationException
Test: builds
Change-Id: I44eac15972ed099fc12599a78a71557a7b16d593
2022-04-04 14:59:42 +02:00
Patrick Rohr
ddc2622ec7 Fix linter errors
Test: TH
Change-Id: I27ad329811a4794050b25976e79909ce8c57d7a3
2022-04-04 14:59:31 +02:00
Remi NGUYEN VAN
82ef475266 Merge "Merge EthernetServiceTests into FrameworksNetTests" 2022-04-04 08:02:04 +00:00
Lorenzo Colitti
6de87582c1 Merge changes from topic "block_port"
* changes:
  Add connectivity_native_test to Presubmit
  Vendor AIDL interface for port blocking via eBPF
2022-04-01 21:46:37 +00:00
Remi NGUYEN VAN
40da62da48 Merge EthernetServiceTests into FrameworksNetTests
As per the TODO, merge EthernetServiceTests into the larger
FrameworksNetTests suite.

Similarly to NetworkStats, NSD or IpSec tests, the tests are also marked
as "non-connectivity-module-test", where "module" actually refers to
modules being built for release (from an S-based branch) today. This is
necessary as the tests and associated code cannot build without T APIs.

Also add FrameworksNetTests to presubmit as non-connectivity-module
tests are not run in presubmit without this.

Test: TH
Merged-In: Id533cdb4ac184b963f570af299dea04754ba88e9
Change-Id: I9950fcb49fdc2217134a59e993941cbe5da0b556
2022-04-01 15:12:18 +09:00
Wayne Ma
075dd6f8ff Merge "Adding Tethering proto" 2022-03-31 16:24:16 +00:00
Remi NGUYEN VAN
86bbfe9271 Remove connectivity-tiramisu-updatable-sources
The filegroup is now unnecessary as files are all in the service-t/src
directory.

This change allows building all sources including ethernet by
referencing src/**. This is done by using a general filegroup
service-connectivity-tiramisu-sources, so that branches that cannot
build the T+ code can change its contents without introducing merge
conflicts in the rest of the build rules.

Also change visibility rules to allow building the moved ethernet code,
and add a filegroup to allow building its tests.

Bug: 222234190
Test: TH
Merged-In: I770bf8db3f4c18467934eb2184f5dc2408fc28ec
Merged-In: I3e5df1bd44defbb9dd0c382c625a21e176368f2a
Change-Id: I8f23a45800b1086cc5a765fd24d734ca82c339a8
2022-03-31 15:14:39 +09:00
Remi NGUYEN VAN
e99dcfd4dd Merge history of opt/net/ethernet
Renamed files/directories:
java/ --> service-t/src/
tests/ --> tests/ethernet/
Android.bp --> (removed)
OWNERS --> (removed)
.gitignore --> (removed)

BUG: 222234190
TEST: TH
Merged-In: I770bf8db3f4c18467934eb2184f5dc2408fc28ec
Merged-In: I3e5df1bd44defbb9dd0c382c625a21e176368f2a
Change-Id: Ifc02784499d114e12d8ad64ba011dd23b97fb78b
2022-03-31 15:14:28 +09:00
Michael Groover
3e712761a4 Merge "Revert "Use RECEIVER_NOT_EXPORTED in CarrierPrivilegeAuthenticator."" 2022-03-31 01:39:28 +00:00
Sewook Seo
2304205a58 Merge "Support QosCallback with UDP socket" 2022-03-30 20:01:45 +00:00
Hungming Chen
dad664748a Add test for tetherOffloadClient{Add, Remove, Clear}
also remove the redundant constructor definition in
test key/value class builder.

Test: atest TetheringCoverageTests
Change-Id: Icf93d4f196846c82c3a1c2b2b8697f4a5156ea92
2022-03-30 16:28:11 +08:00
Hungming Chen
fa3942c7e7 Add test for tetherOffloadRule4Clear
Test that clear IPv4 offload rules once tethering stopped

Test: atest TetheringCoverageTests
Change-Id: I107b15bef2a15f7c85236f2801c43288fe7d0f4d
2022-03-30 16:28:11 +08:00
Lucas Lin
fda6032eae Merge "Add @AppModeFull for those tests which will bind socket" 2022-03-29 15:35:30 +00:00
Lucas Lin
41ed965e68 Merge "Add @RequiresPermission for setUnderlyingNetworks" 2022-03-29 15:34:17 +00:00
lucaslin
0451366cd5 Add @AppModeFull for those tests which will bind socket
In instant mode, the test doesn't have permission to bind socket.
Add @AppModeFull to stop them running in the instant mode.

Bug: 225937472
Test: atest --instant CtsNetTestCases:NetworkAgentTest
Change-Id: Iccd3f3b1c8e8173eead12e4d0c6e3a9189d3746a
2022-03-29 12:15:28 +00:00
Lorenzo Colitti
644fe232cd Merge "Don't throw in FullScore#policyNameOf." 2022-03-29 08:38:21 +00:00
Lorenzo Colitti
1727d9f1f2 Don't throw in FullScore#policyNameOf.
This code is correct on userdebug builds, but it is dangerous on
user builds because proguard might strip out the POLICY_*
constants and that would lead to crashes.

For now just log a wtf if an invalid policy name is found. A
better solution would be to make MessageUtils robust to this
problem, e.g., by having it store the SparseArray internally and
providing getters that do not throw, instead of the current
behaviour that returns the SparseArray. That is left to a future
CL.

Fix: 227161413
Test: atest FullScoreTest
Change-Id: I68b69ee9dd84773018e62c9a8f43e754ae04c486
2022-03-29 08:38:06 +00:00
markchien
011a7f51c1 Improve JavaDoc for FirewallRule constants
Bug: 226946569
Test: TH
Change-Id: I8366bd58194e24da7ea74bf398aae196482d0151
2022-03-29 12:28:25 +08:00
Treehugger Robot
3d4de57752 Merge "Api review: change updateFirewallRule to setUidFirewallRule" 2022-03-29 03:41:02 +00:00
sewookseo
82657d70d7 Support QosCallback with UDP socket
Add a constructor for QosSocketInfo using DatagramSocket.

Bug: 203146631
Test: atest & verified on LTE test equipment
Change-Id: I85c091a65610a96d721e4f0b07631867cda4db8a
2022-03-29 02:38:05 +00:00
Chiachang Wang
59e6e2b730 Merge "Add tests for VPN validation in NetworkMonitor" 2022-03-28 13:51:34 +00:00
Bill Yi
7ff8ccd448 Import translations. DO NOT MERGE ANYWHERE
Auto-generated-cl: translation import
Change-Id: I8b155f84bfc9616b6b3943b7785eb143884f9790
2022-03-27 02:24:22 +00:00
Tyler Wear
b4ab4c3a20 Add connectivity_native_test to Presubmit
Test connectivity_native_test during presubmit.

Bug: 179733303
Change-Id: Iac8e024605b8fe7470925c3606f1eb79fe1421b5
2022-03-25 16:17:30 +00:00
Tyler Wear
b37f551287 Vendor AIDL interface for port blocking via eBPF
New Connectivity Service exposed to vendor for
restricting certain ports for use only in vendor.

Bug: 179733303

Change-Id: Iad9aff6924498ede5a08cfa5482082f094c0a90b
2022-03-25 09:14:48 -07:00
Remi NGUYEN VAN
0395b70000 Use Sources.bp for building
Reference Sources.bp from Android.bp, so that they are used as build
files.

Sources.bp is separate from Android.bp as it was migrated from the
Android.bp files in the old code location. They can be merged into the
main Android.bp file (or removed by removing the filegroups) after the
migration is done.

Also remove references to the AIDL filegroups, as files are now merged
into the common framework/aidl-export directory which is used as include
directory for aidl source generation already, so they do not need to be
referenced separately. framework/aidl-export can contain AIDLs for S-
API classes that became updatable API in T (the contents of
framework-t), as they are the same as any other API class for the
purposes of AIDL code generation: it's OK for any S+ code to reference
S+ API classes.

Finally, fix reference to mByteStream in IpConfigStoreTest. It was
already wrong but did not break the build because the test was not being
built in the old location.

Bug: 222234190
Test: TH
Merged-In: I81893df9f327abb84f1561b2b33027a2d23a4d65
Merged-In: I67c703e3f7aa9d5787f032a79ed62e45412baf4f
Change-Id: I9093f9ae2f9d76e597f20de48680e459891755b4
2022-03-25 14:58:43 +00:00
Remi NGUYEN VAN
700ffc994f Merge history of ConnectivityT
Renamed files/directories:
ConnectivityT/service/Android.bp --> service-t/Sources.bp
ConnectivityT/framework-t/Android.bp --> framework-t/Sources.bp
ConnectivityT/framework-t/aidl-export --> framework/aidl-export
ConnectivityT/service --> service-t
ConnectivityT/framework-t --> framework-t
ConnectivityT/tests --> tests
ConnectivityT/OWNERS --> (removed)

BUG: 222234190
TEST: TH
Ignore-AOSP-First: Move with history done per-branch
Merged-In: I81893df9f327abb84f1561b2b33027a2d23a4d65
Merged-In: I67c703e3f7aa9d5787f032a79ed62e45412baf4f
Change-Id: I27a91f1a94f9d807f92762436f533c4b0d0114d5
2022-03-25 11:02:45 +00:00
markchien
3c04e66da0 Api review: change updateFirewallRule to setUidFirewallRule
Bug: 218494748
Test: TH

Change-Id: I52a02ebe109b687359f579c16fded4af3c9cd242
Merged-In: I52a02ebe109b687359f579c16fded4af3c9cd242
2022-03-25 18:49:08 +08:00
Lorenzo Colitti
697c18376b Merge "Move the DscpPolicy status constants and IntDef to NetworkAgent." 2022-03-25 08:03:38 +00:00
Lorenzo Colitti
fbe1576139 Move the DscpPolicy status constants and IntDef to NetworkAgent.
As requested by API council.

Also fix lint errors in the test.

Fix: 217366078
Test: existing tests modified in this CL
Change-Id: I8f7cd0e78bf29aeb52ec6a08a5d635d25fa2205d
2022-03-25 01:06:46 +09:00
Lorenzo Colitti
544226f701 Merge "Rename destroyAndAwaitReplacement to unregisterAfterReplacement." 2022-03-24 14:45:09 +00:00
Patrick Rohr
3ed2059b2d Merge "Fixing multithreading issues in Ethernet Factory" 2022-03-24 14:06:39 +00:00
Xiao Ma
23fa999824 Merge "Add cts for EthernetManager#getInterfaceList api." 2022-03-24 11:36:16 +00:00
Wayne Ma
71d66396d2 Adding Tethering proto
Bug: 153942334
Test: m, flash and boot
Change-Id: I853d3a4dd914dd0c65a6c9e1749d8898da68540e
2022-03-24 17:40:31 +08:00
Patrick Rohr
e38626a4a2 Merge "Add getInterfaceList module-lib API in EthernetManager." 2022-03-24 06:15:43 +00:00
Patrick Rohr
f7c4dcaaf4 Merge "Update the module-lib API txt with getInterfaceList api." 2022-03-24 06:15:43 +00:00
Patrick Rohr
95738f7c18 Merge "Fix ethernet enable / disable API" 2022-03-24 06:09:28 +00:00
Patrick Rohr
04f9843d32 Merge "Fix ethernet enable / disable API" 2022-03-24 06:09:28 +00:00
Treehugger Robot
b3edbd35b6 Merge "Update the module-lib API txt with setEthernetEnable API" 2022-03-23 19:40:19 +00:00
Lorenzo Colitti
a63e2341d6 Rename destroyAndAwaitReplacement to unregisterAfterReplacement.
Rename requested by API council.

Fix: 224764301
Test: existing CTS tests updated
Change-Id: Ibab9c9cd64bf0dde1e22705e81cff11d356fc719
2022-03-24 01:12:26 +09:00
Xiao Ma
846bbc9167 Add getInterfaceList API implementation in Ethernet service.
Bug: 171872016
Test: m
Merged-In: I8eeb2cd211c6a2ec6bc997c5e18995b585c6118a
Change-Id: Ic36d26be7dae5fd3f72abce3cea1ee845813a6e5
2022-03-23 15:20:58 +00:00
Xiao Ma
715c8dba6e Add cts for EthernetManager#getInterfaceList api.
Bug: 171872016
Test: atest android.net.cts.EthernetManagerTest --iterations
Merged-In: I95a21777689fd100ccf94982d3398418036b674f
Change-Id: I46a2b26ca1a5846523aed94bc9744e11daa39859
2022-03-23 15:18:54 +00:00
Xiao Ma
bdfed34bbc Update the module-lib API txt with getInterfaceList api.
Bug: 171872016
Test: m
Merged-In: I16c69aa0d236036a600bdae9fb8326ff70fd4fda
Change-Id: I1ee2ad76b4950906516fae7328785b8c583f7adb
2022-03-23 15:18:24 +00:00
markchien
c0939b76f0 Add global change ethernet state API
Provide a new API to enable or disable ethernet. Also have a listener
for call to check whether enable state is sucessful.

Bug: 171872016
Test: atest EthernetServiceTests

Change-Id: Iee4b48511ff668a2a7df90fd9bfe563d7ff23940
Merged-In: Iee4b48511ff668a2a7df90fd9bfe563d7ff23940
2022-03-23 13:43:38 +00:00
Chalard Jean
2f23fa51d8 Add tests for VPN validation in NetworkMonitor
Test: New tests in this patch
      also FrameworksNetTests
Test: atest CtsNetTestCases CtsNetTestCasesLatestSdk
Change-Id: I68aa5201ad94531e5a40999816844faef5531525
2022-03-23 11:19:44 +00:00
Remi NGUYEN VAN
cc49988549 Merge "Use separate catch for getTcpKeepalivePacket" 2022-03-23 09:24:32 +00:00
markchien
e1cde2694f Update the module-lib API txt with setEthernetEnable API
Bug: 171872016
Test: atest EthernetServiceTests
Change-Id: I61c5209f50ab62327b75813804bde1aa1a014054
Merged-In: I61c5209f50ab62327b75813804bde1aa1a014054
2022-03-23 17:02:14 +08:00
Michael Groover
eef36c8917 Revert "Use RECEIVER_NOT_EXPORTED in CarrierPrivilegeAuthenticator."
This reverts commit 7569d51446.

Reason for revert: ag/17318348 moved the declaration of the protected-broadcasts from the telephony package to the platform's manifest, so a flag is no longer required when registering for these. In addition, ag/17307852 is syncing the behavior of unexported runtime receivers with that of manifest receivers by limiting the UIDs that can broadcast to these receivers to the root and system UIDs; with the RECEIVER_NOT_EXPORTED flag from this commit, these receivers would no longer be able to receive these broadcasts when sent from the telephony UID.

Bug: 225999840
Change-Id: Ifb15506434edabdfacf84c302881d0cf97d3add8
2022-03-23 02:04:57 +00:00
Remi NGUYEN VAN
2c1a10c4b2 Use separate catch for getTcpKeepalivePacket
Having a combined catch block causes the code to be "optimized" by R8 to
just throw a NullPointerException, with smali code:

  const/4 p0, 0x0
  throw p0

Workaround the issue by having separate catch blocks instead.

Bug: 217391956
Bug: 226127213
Test: atest ConnectivityManagerTest
Change-Id: Ib51fc66c44e1c2baa1f7ba4d1b0c2d1c94c3591d
2022-03-22 15:36:47 +00:00