Commit Graph

47196 Commits

Author SHA1 Message Date
Aaron Huang
dac7e4b84a Fix proto invalid write type
While dumpProtoLocked is called, InvalidProtocolBufferException
occurred because types are mismatched between platform side and
module side.

netstats.proto was moved into connectivity module, both the
platform(incident.proto) and the module uses protoc-gen-javastream
to generate the Java classes from it. It should be fine since
platform includes the source of the proto, and jarjar the generated
classess in the module to avoid conflict with platform.

Bug: 218566849
Test: adb shell incident 3001
      adb shell dumpsys netstats --proto
      atest CtsIncidentHostTestCases:IncidentdTest#testIncidentReportDumpAuto
Change-Id: I09cae385050e569b1da98ad7de0e226b13ee6895
Merged-In: I09cae385050e569b1da98ad7de0e226b13ee6895
2022-03-22 15:07:15 +08:00
Chiachang Wang
f7c071b1c4 Merge "Extend timeout to deflake test" 2022-03-22 00:43:36 +00:00
Treehugger Robot
dc1832cd83 Merge "Fix OWNERS issues" 2022-03-21 10:51:57 +00:00
Chiachang Wang
81c2d99a77 Extend timeout to deflake test
CaptivePortalLoginActivity may load the page slowly in lower
performance devices. Test expects the login page to be loaded
within 10s. The flaky happened sometimes since loading page
took 10+ seconds and failed the test.

Extend the timeout from 10s to 20s to deflake the test.

Bug: 225800341
Test: atest CaptivePortalTest
Change-Id: I98ab3dbc78cb95eeee95d1c86ab286600c98390b
2022-03-21 15:50:39 +08:00
Benedict Wong
0e75662808 Merge "Allow sending of Administrator UIDs for *NETWORK_STACK" 2022-03-19 01:33:27 +00:00
Sewook Seo
7a4fcf4ed1 Merge changes from topic "QosCallbackException"
* changes:
  CTS test for QosCallbackException
  Expose constructor of Exceptions.
2022-03-19 00:35:28 +00:00
Benedict Wong
a5604ea50f Allow sending of Administrator UIDs for *NETWORK_STACK
This change allows callers with the NETWORK_STACK or
PERMISSION_NETWORK_STACK to receive administrator UIDs. This will be
used by the VCN to ensure that administrator UIDs are accurately
populated, ensuring that the ConnectivityDiagnostics are triggered for
the VCN.

Bug: 193204385
Test: atest ConnectivityServiceTest
Change-Id: I3ecfbef6847dcc78adac05d0229719c97e3a220c
2022-03-18 21:52:57 +00:00
Martijn Coenen
b643f2a356 Merge "Setup permissions for SDK sandbox UIDs." 2022-03-18 13:35:51 +00:00
Alan Stokes
eae2ff9831 Fix OWNERS issues
Switch to a bug template that assigns the correct group.

Consolidate into one file to make it easier for humans as well as
machines to figure out the ownership.

Remove me from per-file ownership; no longer relevant, causes
confusion.

Bug: 224454753
Test: Presubmit
Change-Id: I84bf472fe56fe3f5927a626bde06cdd8cee8353a
2022-03-18 10:52:02 +00:00
sewookseo
27447c526a CTS test for QosCallbackException
Adding CTS test coverage for Exceptions realted to QosCallback

Bug: 224059548
Test: atest CtsNetTestCases
Change-Id: Iccd1d3259961a6e4a841395175e215724895786e
2022-03-18 10:44:31 +00:00
Lorenzo Colitti
004cbbcdad Merge "Support ignoring validation failures after roam." 2022-03-18 03:15:49 +00:00
Lorenzo Colitti
14c851ccc3 Merge changes from topic "ethernetmanagertest"
* changes:
  Add a CTS test for EthernetManager.InterfaceStateListener.
  Add a method to create a TAP interface without bringing it up.
2022-03-18 02:26:25 +00:00
he_won.hwang
881307a834 Support ignoring validation failures after roam.
In some scenarios, Wi-Fi connectivity is disrupted after roam. If an application reacts to network errors by calling reportNetworkConnectivity(false), validation will immediately fail and the device will switch to cell data.

Add a way to ignore these validation failures for up to 10 seconds after Wi-Fi roams.

Bug: 216567577
Test: new unit tests

Change-Id: I58de486533bcc7c6e32b23536ae15bccb779e394
2022-03-18 10:30:28 +09:00
sewookseo
e7c481452e Expose constructor of Exceptions.
Exposing constructor of Exceptions for test purpose.

CTS-Coverage-Bug: 224059548
BUG: 215240597
BUG: 216368595
Test: build
Change-Id: I20af104a891e94873715ab46ecabc3e775638c8c
2022-03-17 18:05:56 +00:00
Quentin Perret
2789c017e6 Merge "Revert "Change Ethernet API to use OutcomeReceiver"" 2022-03-17 15:26:19 +00:00
Quentin Perret
41000c6106 Revert "Change Ethernet API to use OutcomeReceiver"
Revert "Change Ethernet API to use OutcomeReceiver"

Revert "Change network management listener to outcome receiver"

Revert submission 2028203-ethernet-outcomereceiver

Reason for revert: BuildMonitor investigating b/225169800
Reverted Changes:
I4c204a848:Change Ethernet API to use OutcomeReceiver
I7c46545a4:Change Ethernet API to use OutcomeReceiver
Id8fadfed9:Change network management listener to outcome rece...

Change-Id: Ibd1d70ac3fb691f9a777e59da4886ab60dc969ac
2022-03-17 15:20:53 +00:00
Patrick Rohr
a8385cc593 Merge "Change Ethernet API to use OutcomeReceiver" 2022-03-17 13:53:18 +00:00
Lorenzo Colitti
9e560d24c2 Add a CTS test for EthernetManager.InterfaceStateListener.
Test: CtsNetTestCases:android.net.cts.EthernetManagerTest
Change-Id: Ic956b5e52575a467b405fecf142c7f25925358d4
2022-03-17 13:42:34 +00:00
Lorenzo Colitti
333d5e52f5 Add a method to create a TAP interface without bringing it up.
In S, the behaviour of createTunInterface and createTapInterface
changed so that they bring up the interface before returning it.
This makes it difficult to test code that brings interfaces up
itself, such as IpClient or EthernetManager, because the tests
cannot predict whether that code will see the interface up
or not. This leads to flaky tests and can even make it impossible
to reliably test some behaviour.

Add a method that allows the caller to specify whether to bring
up the interface or not.

Test: new codepath tested by other CL in topic
Test: existing codepaths already well-covered
Change-Id: I0f7698f4dad132f201db4203e65a78c6af564ab2
2022-03-17 13:42:34 +00:00
Taras Antoshchuk
1c2f79705f Merge "Explicitly check route type in NetworkDiagnostics" 2022-03-17 11:08:50 +00:00
Patrick Rohr
ea7e6d56f4 Change Ethernet API to use OutcomeReceiver
This change addresses API review feedback. In addition, it changes the
returned result from Network to the interface name. The current API
returning a Network object is racy and cannot be implemented correctly.
Users should instead use the ConnectivityManager#requestNetwork() API to
get hold of the Network for a given interface.

Bug: 220017952
Test: TH
Change-Id: I4c204a8489c0be006c00581d833f2bb46ae0e71d
2022-03-17 07:21:33 +01:00
Patrick Rohr
1b13af010a Merge changes from topic "nullable-ipconfig"
* changes:
  Add test for nullable IpConfiguration
  Add Nullable IpConfiguration to ethernet update request
  Replace assertParcelSane with assertParcelingIsLossless
2022-03-17 06:17:02 +00:00
Patrick Rohr
fb82c3f702 Add test for nullable IpConfiguration
Test: atest EthernetNetworkUpdateRequestTest
Change-Id: Ibf565d46cfac0d44976ee6187db7234bb082da41
2022-03-16 20:29:10 +01:00
Patrick Rohr
8a910f4ecd Add Nullable IpConfiguration to ethernet update request
Test: atest EthernetServiceTests
Bug: 220017952
Change-Id: Icb5af11e67e397628484726ab6f69afa5d1fe7f5
2022-03-16 20:29:05 +01:00
Chalard Jean
de665266cd Rename setAccessUids to setAllowedUids
Bug: 217725769
Test: ConnectivityServiceTest CtsNetTestCases
Change-Id: Ic8a3f91553d1462b7f54259c467fb90a950bdd59
Merged-In: I8860fbb353eedf5d01e9dc248e4d765046bd562c
2022-03-16 17:58:20 +00:00
Sooraj Sasindran
2ccbfe9d8f Merge "Use int array for included and excluded uids" 2022-03-16 17:56:08 +00:00
Patrick Rohr
ceae88da2d Replace assertParcelSane with assertParcelingIsLossless
Per review comment on aosp/2012897.

Test: atest EthernetNetworkUpdateRequestTest
Change-Id: Ie2f21d821709cc82af9294d70826f153506fda4f
2022-03-16 17:20:36 +01:00
Patrick Rohr
6dde8ac532 Merge changes from topic "ethernet_mainline"
* changes:
  Fix the NPE thrown when starting Ethernet service in OS lower than T.
  Remove the stub ethernet service from Connectivity module.
  Update hidden API files for EthernetManager API move.
  Provide a stub ethernet service to build in sc-mainline-prod.
  Build ethernet framework source into framework-connectivity-tiramisu
2022-03-16 16:03:30 +00:00
Frank Li
cd9fe9b220 Merge "[DU04-4]Appropriate changes to the NetworkPolicyManager API" 2022-03-16 12:28:24 +00:00
Aaron Huang
ef716bcb94 Merge "Ensure SpiUnavailableException was thrown because of duplicate SPI" 2022-03-16 08:36:28 +00:00
Tom Hsu
1c12d0790e Merge "Add a carrier config to block tethering." 2022-03-16 07:26:39 +00:00
Sooraj Sasindran
4904176454 Use int array for included and excluded uids
Use int array for included and excluded uids so that uses
same data type as in PreferentialNetworkServiceConfig

Bug: 217365439
Test: ran connectivity service unit tests
Change-Id: I9ac7e6498df2fd20b8397b2c110296e019c7389e
2022-03-16 07:19:11 +00:00
Meng Wang
a84bb2d8ba Add a carrier config to block tethering.
When KEY_CARRIER_SUPPORTS_TETHERING_BOOL=false, it will behave as if
entitlement check failed and a system notifcation shows up if user
tries to turn on tethering from Settings UI.

Bug: 161206517
Test: manual
Change-Id: I78da390ecb0c8f4f68285ef16da80653f136c11e
2022-03-16 12:40:24 +08:00
Frank
9ff8eb1829 [DU04-4]Appropriate changes to the NetworkPolicyManager API
Divide the NetworkPolicyManager API
notifyStatsProviderWarningOrLimitReached into the following two APIs:
1. notifyStatsProviderWarningReached()
2. notifyStatsProviderLimitReached()

Bug: 216474563
Test: atest NetworkStatsServiceTest NetworkPolicyManagerTest
            NetworkPolicyManagerServiceTest OffloadControllerTest
Change-Id: I473b8b677d492a7076e63f445b3a3be24d25e14d
2022-03-16 12:23:34 +08:00
Xiao Ma
799d000c9f Fix the NPE thrown when starting Ethernet service in OS lower than T.
Bug: 210586283
Bug: 223993229
Test: m
Merged-In: I5b61643cf99681e4db56468401e8670f90f9257e
Change-Id: If2c74bd5ed53fc571697145041413cbb85482177
2022-03-16 03:25:25 +00:00
Xiao Ma
1bc5454f41 Remove the stub ethernet service from Connectivity module.
The stub ethernet service lib will be useless after removing all legacy
dependencies on ethernet-service.jar, so delete it from Connectivity
module as well.

Bug: 210586283
Test: m
Merged-In: Ica60df1140bf3f7345e61d642c9e9b706602c50b
Change-Id: Iadd1d6a4046a8960ec35f5d51ae5dc2f42eb3bfb
2022-03-16 02:25:28 +00:00
Xiao Ma
885acf0abc Update hidden API files for EthernetManager API move.
Test: m
Bug: 210586283
Merged-In: I995c81f9bcfdd57c37f679878b6973d3de739803
Change-Id: I5f8c35a225cad94c87b00f7523497d145d335a13
2022-03-16 02:09:25 +00:00
Lorenzo Colitti
8b7896b51a Merge "Rename setUidForeground to noteUidForeground" 2022-03-15 23:33:26 +00:00
Sewook Seo
c8fadc5cde Merge "API review: Additional comment for QosSession." 2022-03-15 10:10:27 +00:00
Martijn Coenen
3f01be0407 Setup permissions for SDK sandbox UIDs.
Applications may have an additional SDK sandbox process that should run
with the same network policy as the app itself. There is a 1:1 mapping
between appId and the SDK sandbox process that belongs to it; use that
mapping to set the same policy for SDK sandbox processes as for the app
that they belong to.

Bug: 215012578
Test: atest com.android.server.PermissionMonitorTest
Change-Id: Ibd2ada09c94d46e048f5731b90a721d8e85d3289
2022-03-15 10:06:39 +01:00
Lorenzo Colitti
9f6e6c4e27 Merge "Add a NetworkAgent API to indicate that a network will be replaced." 2022-03-15 04:44:16 +00:00
Lorenzo Colitti
1050a077ba Provide a stub ethernet service to build in sc-mainline-prod.
This CL also creates a fake ethernet-service.jar to ensure that
targets that depend on ethernet-service do not break.
Because ethernet-service.jar is on the system server classpath,
these classes cannot be in the com.android.server.ethernet
package, otherwise ConnectivityServiceInitializer will load
them instead of the real classes.

Test: m
Bug: 210586283
Merged-In: I6a4a0dc68233d4229d1cae4e5b196e287ef2ed5b
Change-Id: I591dcaf0fe6303cffa15aa0b869e429c626dc887
2022-03-14 14:06:58 +00:00
Xiao Ma
0a171c006c Build ethernet framework source into framework-connectivity-tiramisu
- move ethernet APIs, build it into framework-connectivity-tiramisu
- start ethernet service from ConnectivityServiceInitializer
- fix EthernetManager dependnecy in Tethering module
- fix EthernetNetworkSpecifier dependency in framework-connectivity
- fix the ethernet related config resource

Bug: 210586283
Test: m
Test: atest FrameworksNetTests EthernetServiceTests
Change-Id: I54857b8517649048a343c72797668394d5225766
Merged-In: I54857b8517649048a343c72797668394d5225766
2022-03-14 14:06:35 +00:00
Lorenzo Colitti
ffa2ed3d1c Add a NetworkAgent API to indicate that a network will be replaced.
This is useful for link layers that disconnect but know they will
reconnect to a similar network soon, and do not want the device
to switch to another network until the reconnect happens. An
example is wifi switching to another network that is on a
different subnet without the device switching to cellular data.

This works by immediately destroying the network, so the link
layer can reuse the same interface name for the new network. It
would be possible to delay destroying the network until the new
network connects, but in practice this does not seem useful,
because the if the link layer reuses the interface, then the
interface will be undergoing reconfiguration, and will likely
not be usable for app traffic.

This CL also moves the call to onNetworkDestroyed into
destroyNativeNetwork. This is needed to ensure that the new
API calls onNetworkDestroyed even though most teardown
operations have not happened. This causes onNetworkDestroyed to
happen before the netId is marked free, but that shouldn't cause
any behavioural changes because netId allocation is an
implementation detail of ConnectivityService and is not
observable by apps or system components.

Bug: 216567577
Test: builds, boots
Test: atest FrameworksNetTests FrameworksNetIntegrationTests
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest
Test: atest CtsNetTestCases:android.net.cts.NetworkAgentTest#testDestroyAndAwaitReplacement
Change-Id: I9f9e022fef66b31a29cce560413321075e992756
2022-03-14 21:52:37 +09:00
Aaron Huang
3c6cc0c4e1 Ensure SpiUnavailableException was thrown because of duplicate SPI
SpiUnavailableException.getSpi() is public API so it should be tested.

Test: CtsNetTestCases:IpSecManagerTest
Change-Id: I68856b80b0ec819b0603dfe0a06ff813be3c5dda
2022-03-14 20:06:59 +08:00
Remi NGUYEN VAN
bcf3b1b58b Merge "Rename "service-nearby" to "service-nearby-pre-jarjar"" 2022-03-14 09:07:43 +00:00
Lucas Lin
ba61dca57c Merge "Rename redactNetworkCapabilitiesForPackage and update its javadoc" 2022-03-14 08:05:08 +00:00
Frank Li
3f5703df80 Merge "[DU09-3]Modify the NetworkStatsCollection Builder API" 2022-03-14 02:36:08 +00:00
Nucca Chen
3938102448 Merge changes I5af6ce96,Ibc1f6813
* changes:
  Refactor make{Tether4Key, Tether4Value ConntrackEvent} helper
  BpfCoordinatorTest: refactor upstream and downstream setup functions
2022-03-11 18:05:14 +00:00
sewookseo
5f703feca1 API review: Additional comment for QosSession.
Additional comment on getSessionId in QosSession.

Bug: 216368595
Test: build
Change-Id: I0575253ef490e3d456e69816d52075c2d10813f0
2022-03-10 22:28:15 +00:00