Commit graph

36,782 commits

Message SHA1
Use Netd new added/removed uid range methods
Replace network[Add|Remove]UidRanges to
network[Add|Remove]UidRangesParcel. The new methods are passing
NativeUidRangeConfig which contains priority value for each uid
range rules.

Bug: 171872461
Test: atest FrameworksNetTests
Test: atest HostsideVpnTests
(cherry-pick from ag/14911836)
Merged-In: I08bbdbcb8450b08e6208fa730137348550f9e3d2

Change-Id: I08bbdbcb8450b08e6208fa730137348550f9e3d2

paulhu   authored and   Paul Hu   commited 2021-07-07 03:06:32 +00:00
0e79d95332
Merge changes from topic "conn-diags-skipped"
* changes:
  Update ConnDiags CTS test to expect validation result SKIPPED.
  Report result SKIPPED in ConnDiags if the network is not validated.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2021-07-02 06:26:57 +00:00
05752a5316
Merge "Remove workarounds to use core platform API"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-07-02 04:37:23 +00:00
78dcc73e4c
Merge "Test Entitlement when telephony is present"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-07-02 04:28:18 +00:00
93773f0aa0
Merge "Fix CtsNetTestCases in instant mode"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-07-02 04:07:05 +00:00
81be2bd036
Merge "Change to REQUEST from LISTEN for mobile data preferred uids feature"
Paul Hu   authored and   Gerrit Code Review   commited 2021-07-02 01:10:56 +00:00
7079b72fa6
Remove workarounds to use core platform API
Core platform API stubs are now correctly included in module_current and
system_server_current, so workarounds used to use such APIs can be
removed.

OsCompat and InetAddressCompat were only necessary because manually
adding the stubs did not resolve the problem for classes that had
public API stubs, which shadowed the module API stubs.

The manual stubs dependency was already removed in another change. Also
remove the service jar dependency on android_system_server_stubs_current
as it is already included in sdk_version system_server_current.

Bug: 183097033
Test: atest CtsNetTestCases

Change-Id: Id448be03b679f832edb24f1b77f471227faf5268

Remi NGUYEN VAN   commited 2021-07-02 10:05:07 +09:00
b2e919f9da
Update ConnDiags CTS test to expect validation result SKIPPED.
This CL updates ConnectivityDiagnosticsManagerTest to expect
NETWORK_VALIDATION_RESULT_SKIPPED for its TestNetworks. The tests also
expect a ConnectivityReport to be sent for all calls to
ConnectivityManager#reportNetworkConnectivity.

Bug: 162407730
Test: atest ConnectivityDiagnosticsManagerTest
Change-Id: I525ea22a38c54a6b5b969a70301852e7af12849c

Cody Kesting   commited 2021-07-01 17:38:17 -07:00
69ec69341e
Report result SKIPPED in ConnDiags if the network is not validated.
This CL updates ConnectivityDiagnostics to report
NETWORK_VALIDATION_RESULT_SKIPPED when the platform does not validate
the reported Network. This CL also updates the behavior for
ConnectivityManager#reportNetworkConnectivity, such that it will always
generate a ConnectivityReport on the reported network. If the reported
connectivity does not match the known connectivity of this network, the
network is revalidated and a report is generated. Otherwise,
revalidation is not performed and the cached ConnectivityReport is sent
instead.

This CL also updates ConnDiags behavior for calls to
ConnectivityManager#reportNetworkConnectivity. Specifically, ConnDiags
callbacks are only notified for these calls if:
  a) the call causes the Network to be re-validated, or
  b) the callback registrant was the caller of
     #reportNetworkConnectivity().
For b), the caller is always guaranteed to receive a ConnectivityReport
(a fresh report if the Network is re-validated, else the cached report).

Bug: 162407730
Test: atest FrameworksNetTests ConnectivityDiagnosticsManagerTest
Change-Id: I78b78919d5b0f09348dfdd5fdb37418b8c7f861f

Cody Kesting   commited 2021-07-01 17:38:16 -07:00
f1120be78b
Merge "Remove dependency on stable.core.platform.api.stubs"
Orion Hodson   authored and   Gerrit Code Review   commited 2021-07-01 18:53:17 +00:00
f15f2769b4
Merge "Skip tests on unsupported devices."
Sudheer Shanka   authored and   Gerrit Code Review   commited 2021-07-01 16:59:46 +00:00
0dc6206752
Merge "Make notification icons and autocancel overlayable"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-07-01 09:49:37 +00:00
2c7e0714c6
Fix CtsNetTestCases in instant mode
Skip tests that cannot run in instant mode, as WifiManager is not
available, and the test cannot bind to sockets in instant mode.

Bug: 192284219
Test: atest CtsNetTestCases -- --enable-parameterized-modules \
        --abi arm64-v8a --module-parameter instant_app
Change-Id: I7a7b0169a3a495bb359dc1f72e56937dcdc5b8a8

Remi NGUYEN VAN   commited 2021-07-01 18:48:27 +09:00
f9d8719d64
Skip tests on unsupported devices.
Fixes: 192473577
Test: atest CtsHostsideNetworkTests:HostsideNetworkPolicyManagerTests
Change-Id: Ib90f0045cb574ada792c5d43fcc359c22d20f3a4

Sudheer Shanka   commited 2021-07-01 08:08:30 +00:00
f90750e26a
Merge "Print the result of command when test is failed"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-07-01 07:49:03 +00:00
c28bb26888
Merge "Fix testGetAllNetworkStateSnapshots for non-cellular"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-07-01 07:44:50 +00:00
ddf3660af8
Merge "Dump the protocol of IPv4 offload rule"
Nucca Chen   authored and   Gerrit Code Review   commited 2021-07-01 07:27:20 +00:00
3746fdd293
Make notification icons and autocancel overlayable
Allow overlays to change the connectivity notification icons, and
whether the notifications are auto-cancelled.

This does not change default behavior, but is necessary to allow vendors
to adapt the notifications to their standards.

Bug: 173171709
Bug: 172048052
Test: atest NetworkNotificationManagerTest
      Added test overlay, verified icon replaced
Change-Id: Ibbb765a5e828b8b870cbfb81e89df2dbd2828be7

Remi NGUYEN VAN   commited 2021-07-01 16:04:09 +09:00
3a8198c3ba
Dump the protocol of IPv4 offload rule
Print the protocol {tcp, udp} of v4 rules in dumpsys.

Format:
proto [inDstMac] iif(iface) src -> nat -> dst [outDstMac] age
  udp [00:00:00:00:00:00] 14(rmnet0) 74.125.10.156:443
  -> 30(30) 10.254.92.123:60262 -> 192.168.128.240:60262
  [0a:bd:b5:e0:41:53] 96067ms

Bug: 190783768
Test: dumpsys tethering
Change-Id: Idae1042cfb454cc97b9b103587f11bc0700e0787

Hungming Chen   commited 2021-07-01 11:52:12 +08:00
3004f0d8d9
Merge "Simplify the return condition in stop()"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-07-01 01:46:59 +00:00
584ab08627
Merge "Apply jarjar rules on coverage tests"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-06-30 23:53:57 +00:00
d590b30f72
Merge "Fix network callback with the same PendingIntent does not release"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-06-30 21:43:15 +00:00
6d908a513a
Simplify the return condition in stop()
Previously, the return condition in stop() will check if the state
is STOPPING and the reason is ERROR_INVALID_NETWORK. The condition
is too restricted so that if another event is happened after binder
died, the exception will be thrown and crash the system.
Since calling stop() twice doesn't make sense, so relax the condition
of return when the state is STOPPING.

Bug: 182586681
Test: atest FrameworksNetTests
Change-Id: I2454c1c080d8954dd3785d4ac6e96fc4131fdb47

lucaslin   commited 2021-07-01 02:29:53 +08:00
40d931c474
Change to REQUEST from LISTEN for mobile data preferred uids feature
- If Mobile data always on is OFF, mobile data preferred uids
  feature does not work.
- We need to request mobile data when MDO list is not empty.

Bug: 171872461
Test: atest FrameworksNetTests
Test: atest CtsNetTestCases

Signed-off-by: Ansik <ansik.shin@samsung.com>
Change-Id: Ie9d6b3e39ef16813c4be3979900d226c8f3d656d

Ansik   authored and   paulhu   commited 2021-06-30 14:22:34 +00:00
605e77055c
Merge "Trigger the network score update after setting test allow bad wifi"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-06-30 14:14:03 +00:00
4bb141787b
Fix network callback with the same PendingIntent does not release
Currently, ConnectivityService uses EVENT_REGISTER_NETWORK_LISTENER
to dispatch registering network callback with pending intent, this
is wrong since the code flow will not check if the pending intent
is duplicated. Thus, the registration will be duplicated if the
caller uses the same pending intent and register multiple times.

This change fixes the logic by using
EVENT_REGISTER_NETWORK_LISTENER_WITH_INTENT instead of
EVENT_REGISTER_NETWORK_LISTENER when dispatching register network
callback with pending intent.

Test: atest android.net.cts.ConnectivityManagerTest#testRegisterNetworkRequest_identicalPendingIntents
Test: atest android.net.cts.ConnectivityManagerTest#testRegisterNetworkCallback_identicalPendingIntents
Test: atest ConnectivityServiceTest#testNetworkCallbackMaximum
Test: 1. Use test app to file callback with same PendingIntent
       2. Check dumpsys output
Bug: 189868426
Change-Id: I38bdea3a026a78a6dc34b5200d43a75b3cd1ac0c

WeiZhang   authored and   Junyu Lai   commited 2021-06-30 12:05:43 +00:00
1cc3f17413
Trigger the network score update after setting test allow bad wifi
Avoid bad wifi design has to apply in both wifi and cellular
networks. Cellular network should contain POLICY_YIELD_TO_BAD_WIFI
policy, then system default network could stay in the wifi after
wifi becomes unvalidated.

The testing API only update the value but not trigger the avoid
bad wifi callback to update the score in the existing cellular
network. Thus, if the cellular network is connected before
setting the overridden value, the yield to bad wifi policy will
not updated to cellular network. The system default network will
still switch from unvalidated wifi network to cellular network
even wifi network is connected with the avoid bad wifi policy.

Update to trigger a reevaluation to update the score in each
NetworkAgent in the ConnectivityService.

Bug: 192149168
Test: atest CtsNetTestCases:android.net.cts.ConnectivityManagerTest\
      #testSetAvoidUnvalidated --rerun-until-failure 100
Change-Id: Ie0f777d0030b66dd306332496192c74f6c183284

Chiachang Wang   commited 2021-06-30 16:41:59 +08:00
f1e09ef031
Merge "Enable tethering to perform its own hidden API processing"
Paul Duffin   authored and   Gerrit Code Review   commited 2021-06-30 08:19:02 +00:00
d8a8041ffc
Merge "Re-skip connectivity unit tests before S"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-06-30 07:43:08 +00:00
a9230c1bf7
Apply jarjar rules on coverage tests
Apply their respective jarjar rules on tethering and general
connectivity tests, then merge both into the coverage tests suite.
This is necessary to ensure that classes covered by tests have names
matching classes used in code.

Also fix IpConnectivityLogTest to use the module utility instead of the
hidden BitUtils, as the test would fail after internal utils are
jarjared.

Bug: 187935317
Test: atest ConnectivityCoverageTests TetheringCoverageTests
Change-Id: Ib95b58dab93f7adebc445b662a6d15db1ce0e7c2

Remi NGUYEN VAN   commited 2021-06-30 16:00:26 +09:00
8ea5ee6d33
Merge "Add option to make sign-in notification ongoing"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-06-30 05:12:09 +00:00
ea395bf6a0
Re-skip connectivity unit tests before S
The tests are packaged together with other tests in a common coverage
suite, so need to be individually annotated so that they are skipped
before S.

They do not need to pass on platforms older than S, because such
platforms will not updated with the code that is tested.

This applies a previous change, this time using DevSdkIgnoreRunner,
as SdkSuppress does not work as expected in branches that have a
codename 2 versions above the SDK version, as is the case in AOSP.

Bug: 187935317
Test: atest ConnectivityCoverageTests on R
      atest FrameworksNetTests on S
Change-Id: I5808d34459a4c19238baf8873afa7cf942828460

Remi NGUYEN VAN   commited 2021-06-30 12:00:28 +09:00
154cf1da20
Add option to make sign-in notification ongoing
Add an overlay boolean that allows setting the SIGN_IN notification as
an ongoing notification.

This can be useful to make sure users can always easily find the
notification to sign in to a captive portal, as studies have found that
some users have a tendency to dismiss notifications before reading them.
At the same time the notification shade is generally too crowded, which
is what causes such behaviors in the first place, so this option is not
enabled by default and should generally not be enabled without proper
user studies or metrics.

Bug: 173171709
Test: atest NetworkNotificationManagerTest
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ic187d2a2b7e49ad152ea2aa35bb784864b97473c

Remi NGUYEN VAN   commited 2021-06-30 11:59:11 +09:00
57c0380135
Enable tethering to perform its own hidden API processing
Previously, the hidden API encoding of the tethering boot dex jars,
i.e. those dex jars that tethering contributes to the bootclasspath
were done as part of the monolithic hidden API processing. This change
causes the encoding to be done by the tethering's
bootclasspath_fragment.

This change involves the following:
* Addition of the fragments property to the tethering's
  bootclasspath_fragment module to list all the other
  bootclasspath_fragment modules on which this depends.
* Addition of the additional_stubs property to add stubs for APIs that
  are not provided by another bootclasspath_fragment.

The build automatically checks that the hidden API flags which are
computed by tethering and encoded into its boot dex jars match those
that are generated by the monolithic processing so this is guaranteed
to be safe.

Bug: 179354495
Test: m com.android.tethering
      - ensure that the generated APEX is byte-for-byte identical
        before and after these changes.
      m out/soong/hiddenapi/hiddenapi-flags.csv
      - make sure that they are not changed by this.
(cherry picked from b28cb44e4b)

Merged-In: I4d9621325c7fcea5043cbca4c577ba2ac6125c0c
Change-Id: I4d9621325c7fcea5043cbca4c577ba2ac6125c0c

Paul Duffin   commited 2021-06-30 00:00:41 +01:00
f9a0c868c4
Remove dependency on stable.core.platform.api.stubs
Bug: 183097033
Test: m droid
Change-Id: I06cbc7e06e112d61575fad6ad0783348c94e3df2

Victor Chang   commited 2021-06-29 22:31:05 +01:00
c3815ee358
Dump the unused IPv4 BPF rule age correctly
Print a dash for the unused "lastUsed" of the rule.

The age should not equal the bootime if the rule has never been
updated the "lastUsed" field.

Format:
[inDstMac] iif(iface) src -> nat -> dst [outDstMac] age
[00:00:00:00:00:00] 14(rmnet0) 140.112.8.116:443
-> 30(30) 10.170.56.233:43720
-> 192.168.45.236:43720 [be:34:40:28:33:5f] -

Test: dumpsys tethering
Change-Id: Ie771becd2f72518cf02a86e5ae228315785752a5

Hungming Chen   commited 2021-06-29 16:21:49 +08:00
e7dff2f955
Merge "Revert "Skip connectivity unit tests before S""
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-06-29 08:14:26 +00:00
b0c9e64d33
Merge "Fix OffloadControllerTest on R"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-06-29 05:02:47 +00:00
767b2180e9
Revert "Skip connectivity unit tests before S"
This reverts commit 05dd1ba540.

Reason for revert: Skips more tests than it should in AOSP
Bug: 192302892

Change-Id: I7c5638d8c1cc626354d240a06af758e1cdd92e94

Remi NGUYEN VAN   commited 2021-06-29 01:08:00 +00:00
284b3c028c
Fix testGetAllNetworkStateSnapshots for non-cellular
bug: 192115694
Test: atest ConnectivityManagerTest#testGetAllNetworkStateSnapshots
Change-Id: Ie7f637248302f3e6b61be69ef4c6a7a906e69275

Gaurav Sarode   commited 2021-06-28 14:24:08 -07:00
4f0546ccbe
Merge "Move ConnectivityCoverageTests to general-tests"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-06-28 13:17:25 +00:00
9330953258
Merge "Fix flakes in tests running after testIsPrivateDnsBroken"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-06-28 10:26:24 +00:00
de7eb04d71
Merge "Make "dumpsys tethering" print the number of registered callbacks."
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-06-28 09:50:04 +00:00
1e50b3ea24
Move ConnectivityCoverageTests to general-tests
The test suite is not signed with any particular key so
can be in general-tests. This is also required for TEST_MAPPING.

Bug: 187935317
Change-Id: I9dbf98eaa28172a172e707091ea75ffdddd4971b
Test: TH for test mapping

Remi NGUYEN VAN   commited 2021-06-28 09:29:51 +00:00
507d094373
Print the result of command when test is failed
When ConnectivityManagerTest#testGetMultipathPreference() is
failed, it only prints "Unexpected format from cmd netpolicy" and
it's not helpful.
Print the result of command can help people to know what's the
difference between expected result and actual result.

Bug: 187921745
Test: atest CtsNetTestCases:ConnectivityManagerTest#testGetMultipathPreference
Change-Id: I63cd4b043e7c70775156aa5244d25ee2268f9f32

lucaslin   commited 2021-06-28 16:50:38 +08:00
5fe3926a11
Merge "Remove wigig support from S tethering"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-06-28 07:51:07 +00:00
0b44491744
Merge "Fix ConnectivityManagerTest initialization on Q"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-06-28 07:24:49 +00:00
72f59b3019
Merge "Fix null PendingIntent in network listens"
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2021-06-28 07:11:31 +00:00
27a942cb32
Fix flakes in tests running after testIsPrivateDnsBroken
The test would not reconnect wifi after restoring the private DNS setting,
so validation would not be triggered, and it would remain identified as
having broken private DNS.

Reconnect wifi after the test to avoid affecting subsequent tests.

Change-Id: Id9beba94e0fed85bd26c0509ad61369be794f3c3
Test: atest android.net.cts.ConnectivityManagerTest
Bug: 182296835

Remi NGUYEN VAN   commited 2021-06-28 06:58:51 +00:00
582770ce68
Merge "Move test_mainline_modules to AndroidTest.xml"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-06-28 06:27:42 +00:00
abbee98e86