Commit Graph

28424 Commits

Author SHA1 Message Date
markchien
38efa2f44b Update Tethering development module version numbers to 319999900
Bug: 193059742
Bug: 194013709
Test: build, aapt dump badging generated apex
Ignore-AOSP-First: Change intended for Android S and downstream branches

Change-Id: I93cfd56978583b03f56070112be896812fe737ef
Merged-In: Ib8905a641780bed490a38327facee4a76e7770a3
2021-07-20 08:59:06 +00:00
TreeHugger Robot
f3c6c3e5b4 Merge "Add tests for in-kernel VPN/VCN dataplane" into sc-dev 2021-07-03 02:01:54 +00:00
Maciej Żenczykowski
f416b8a1ff ipv4 tethering offload - decrement ttl during forwarding
Bug: 192635131
Test: atest, TreeHugger, flashed on phone, forwarded ipv4 traffic
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Original-Change: https://android-review.googlesource.com/1755049
Merged-In: I88e5293a54b7867a8e7dd76f6fd8e2a52d31e51a
Change-Id: I88e5293a54b7867a8e7dd76f6fd8e2a52d31e51a
2021-07-02 22:08:34 +00:00
Benedict Wong
6dd0516b56 Add tests for in-kernel VPN/VCN dataplane
This change adds relevant tests for the migrateTun functionality in
NetworkStats.

Bug: 190620024
Test: atest NetworkStatsTest
Original-Change: https://android-review.googlesource.com/1749069
Merged-In: I33f14f2d0f71013a594fd4c8c3914a590d30ea06
Change-Id: I33f14f2d0f71013a594fd4c8c3914a590d30ea06
2021-07-02 19:29:06 +00:00
TreeHugger Robot
0868536de9 Merge "Allow non-VPNs to have underlying networks." into sc-dev 2021-07-02 18:56:30 +00:00
Paul Hu
790d3eb079 Merge "Listen EXTERNAL_APPLICATIONS_AVAILABLE intent" into sc-dev 2021-07-02 14:17:17 +00:00
Treehugger Robot
4703a8c392 Allow non-VPNs to have underlying networks.
Certain network types, like the VCN, have underlying
networks for the purpose of data usage, but do not want to
propagate the underlying network capabilities.

Allow these networks to set underlying networks, but continue
not to propagate the capabilities.

Bug: 190620024
Test: new unit test
Original-Change: https://android-review.googlesource.com/1753619
Merged-In: I53d6080f48707ff3c37fbfbef534284ba77a7432
Change-Id: I53d6080f48707ff3c37fbfbef534284ba77a7432
2021-07-02 13:56:28 +00:00
Paul Hu
29194db12f Merge "Use Netd new added/removed uid range methods" into sc-dev 2021-07-02 12:08:35 +00:00
Paul Hu
77739d37b3 Merge "Force only system uid can set uids allowed on restricted networks" into sc-dev 2021-07-02 10:46:19 +00:00
TreeHugger Robot
f5f8e4e3a5 Merge "Change to REQUEST from LISTEN for mobile data preferred uids feature" into sc-dev 2021-07-02 09:27:38 +00:00
TreeHugger Robot
169f43d117 Merge "Remove workarounds to use core platform API" into sc-dev 2021-07-02 08:53:34 +00:00
TreeHugger Robot
8d75184baf Merge "Test Entitlement when telephony is present" into sc-dev 2021-07-02 08:29:15 +00:00
Remi NGUYEN VAN
21e5140ff4 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
Original-Change: https://android-review.googlesource.com/1753823
Merged-In: I7a7b0169a3a495bb359dc1f72e56937dcdc5b8a8
Change-Id: I7a7b0169a3a495bb359dc1f72e56937dcdc5b8a8
2021-07-02 06:04:35 +00:00
Treehugger Robot
0cc6f3b99d Test Entitlement when telephony is present
bug: 187331752
Test: atest android.tethering.test.TetheringManagerTest
Original-Change: https://android-review.googlesource.com/1735336
Merged-In: I9fbb7141691fbbf8685b46359c050e0385928805
Change-Id: I9fbb7141691fbbf8685b46359c050e0385928805
2021-07-02 05:48:23 +00:00
Lucas Lin
0def47421d Merge "Print the result of command when test is failed" into sc-dev 2021-07-02 05:27:45 +00:00
Remi NGUYEN VAN
298f6aff93 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

Original-Change: https://android-review.googlesource.com/1754889
Merged-In: Id448be03b679f832edb24f1b77f471227faf5268
Change-Id: Id448be03b679f832edb24f1b77f471227faf5268
2021-07-02 04:54:29 +00:00
Paul Hu
07950df234 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>
Original-Change: https://android-review.googlesource.com/1751023
Merged-In: Ie9d6b3e39ef16813c4be3979900d226c8f3d656d
Change-Id: Ie9d6b3e39ef16813c4be3979900d226c8f3d656d
2021-07-02 03:03:07 +00:00
Orion Hodson
5e5c287d6b Remove dependency on stable.core.platform.api.stubs
Bug: 183097033
Test: m droid
Original-Change: https://android-review.googlesource.com/1751523
Merged-In: I06cbc7e06e112d61575fad6ad0783348c94e3df2
Change-Id: I06cbc7e06e112d61575fad6ad0783348c94e3df2
2021-07-02 00:42:52 +00:00
Sudheer Shanka
0a224da8d3 Merge "Skip NetworkPolicyManagerTest on unsupported devices." into sc-dev 2021-07-01 23:28:45 +00:00
Sudheer Shanka
fe89aaad47 Skip NetworkPolicyManagerTest on unsupported devices.
Fixes: 192473577
Test: atest CtsHostsideNetworkTests:HostsideNetworkPolicyManagerTests
Change-Id: Ib90f0045cb574ada792c5d43fcc359c22d20f3a4
Merged-In: Ib90f0045cb574ada792c5d43fcc359c22d20f3a4
2021-07-01 17:10:02 +00:00
TreeHugger Robot
2a512b4a16 Merge "Make notification icons and autocancel overlayable" into sc-dev 2021-07-01 15:24:43 +00:00
paulhu
03635b3ad5 Force only system uid can set uids allowed on restricted networks
- Check whether calling UID/PID is system_server.
- For CTS test, enforce NETWORK_SETTINGS permission otherwise if
  it's a debug build.

Bug: 175199465
Test: atest FrameworksNetTests
Test: atest ConnectivityManagerTest#testUidsAllowedOnRestrictedNetworks
Ignore-AOSP-First: Need cherry-pick
Change-Id: I175a831671d3e52460d28203b09f6c0dda56b61c
2021-07-01 23:01:41 +08:00
TreeHugger Robot
a575bce0ed Merge "Dump the protocol of IPv4 offload rule" into sc-dev 2021-07-01 10:54:44 +00:00
TreeHugger Robot
86a118c060 Merge "Fix testGetAllNetworkStateSnapshots for non-cellular" into sc-dev 2021-07-01 10:53:27 +00:00
Treehugger Robot
8ef6bfe5ae 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
Original-Change: https://android-review.googlesource.com/1753822
Merged-In: Ibbb765a5e828b8b870cbfb81e89df2dbd2828be7
Change-Id: Ibbb765a5e828b8b870cbfb81e89df2dbd2828be7
2021-07-01 10:44:09 +00:00
Lucas Lin
a10f2a5f25 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
Original-Change: https://android-review.googlesource.com/1749262
Merged-In: I63cd4b043e7c70775156aa5244d25ee2268f9f32
Change-Id: I63cd4b043e7c70775156aa5244d25ee2268f9f32
2021-07-01 10:11:13 +00:00
Luke Huang
bf9cb4dd18 Merge "Fix the comments from aosp/1719018" into sc-dev 2021-07-01 09:49:46 +00:00
Lucas Lin
b851d80de2 Merge "Simplify the return condition in stop()" into sc-dev 2021-07-01 09:09:39 +00:00
Junyu Lai
8ba13e99e8 Merge "Fix network callback with the same PendingIntent does not release" into sc-dev 2021-07-01 09:08:40 +00:00
Treehugger Robot
21ec633e39 Fix testGetAllNetworkStateSnapshots for non-cellular
bug: 192115694
Test: atest ConnectivityManagerTest#testGetAllNetworkStateSnapshots
Original-Change: https://android-review.googlesource.com/1749483
Merged-In: Ie7f637248302f3e6b61be69ef4c6a7a906e69275
Change-Id: Ie7f637248302f3e6b61be69ef4c6a7a906e69275
2021-07-01 08:47:03 +00:00
Nucca Chen
a4a7825e13 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
Original-Change: https://android-review.googlesource.com/1753608
Merged-In: Idae1042cfb454cc97b9b103587f11bc0700e0787
Change-Id: Idae1042cfb454cc97b9b103587f11bc0700e0787
2021-07-01 08:31:23 +00:00
TreeHugger Robot
424ef2043c Merge "Fix and test usb function configuration change" into sc-dev 2021-07-01 07:04:48 +00:00
TreeHugger Robot
2e0cdad198 Merge "Remove wigig support from S tethering" into sc-dev 2021-07-01 07:02:38 +00:00
Lucas Lin
5ca769ef4a 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
Original-Change: https://android-review.googlesource.com/1729690
Merged-In: I2454c1c080d8954dd3785d4ac6e96fc4131fdb47
Change-Id: I2454c1c080d8954dd3785d4ac6e96fc4131fdb47
2021-07-01 06:57:53 +00:00
Hungming Chen
59f422694a 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] -

Bug: 190783768
Test: dumpsys tethering
Original-Change: https://android-review.googlesource.com/1751022
Merged-In: Ie771becd2f72518cf02a86e5ae228315785752a5
Change-Id: Ie771becd2f72518cf02a86e5ae228315785752a5
2021-07-01 03:23:01 +00:00
paulhu
de2a23958d 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
Ignore-AOSP-First: Need cherry-pick
Change-Id: I08bbdbcb8450b08e6208fa730137348550f9e3d2
2021-07-01 03:10:45 +00:00
Treehugger Robot
282f743a8c 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
Original-Change: https://android-review.googlesource.com/1727470
Merged-In: I38bdea3a026a78a6dc34b5200d43a75b3cd1ac0c
Change-Id: I38bdea3a026a78a6dc34b5200d43a75b3cd1ac0c
2021-07-01 01:44:56 +00:00
Chiachang Wang
6339ec22ad 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
Original-Change: https://android-review.googlesource.com/1751588
Merged-In: Ie0f777d0030b66dd306332496192c74f6c183284
Change-Id: Ie0f777d0030b66dd306332496192c74f6c183284
2021-07-01 00:32:08 +00:00
Paul Hu
eefacbcb5c Merge "Use appId instead of uid" into sc-dev 2021-06-30 09:38:26 +00:00
paulhu
4ac225baed Listen EXTERNAL_APPLICATIONS_AVAILABLE intent
- Some applications are installed on external storage and they
  are unavailable until exernal storage installed them
  completely. And their permission need update after becoming
  available. Thus, listen EXTERNAL_APPLICATIONS_AVAILABLE intent
  and update those package whose is listed in chaged package
  list.
- Remove user argument on buildPackageInfo() because the uid on
  ApplicationInfo is based uid.

Bug: 145234989
Test: atest FrameworksNetTests
Ignore-AOSP-First: Need cherry-pick
Change-Id: Ia11ca4a7ba6fc1b87c27c0c40e36c91d9cdb322a
2021-06-30 17:07:47 +08:00
TreeHugger Robot
4fd9dfef2d Merge "Fix null PendingIntent in network listens" into sc-dev 2021-06-29 13:36:15 +00:00
Mark Chien
66fa6f24f9 Fix and test usb function configuration change
Allow stop TETHERING_NCM no matter ncm is used for TETHERING_USB or
TETHERING_NCM.

Add a test:
1. NCM is started for TETHERING_NCM
2. The config changes to use NCM for TETHERING_USB.
3. Then the config changes to use RNDIS for TETHERING_USB.

Also let some logs not only print in dumpsys, but also in logcat to
easiler debug unit test.

Bug: 185649441
Test: atest TetheringTests
Original-Change: https://android-review.googlesource.com/1740778
Merged-In: Ia8d76a29646f36941cbb16cd68ae6887100ec8ec
Change-Id: Ia8d76a29646f36941cbb16cd68ae6887100ec8ec
2021-06-29 10:46:51 +00:00
Treehugger Robot
cc77000d9a Remove wigig support from S tethering
Bug: 176520801
Test: atest TetheringTests
Original-Change: https://android-review.googlesource.com/1744652
Merged-In: Id0bf02c01419e0c69a1d0b6a41789826538444d3
Change-Id: Id0bf02c01419e0c69a1d0b6a41789826538444d3
2021-06-29 10:46:16 +00:00
Victor Chang
e4132c8ca0 Merge "Partial cherry-pick to remove IoUtils#deleteContents usage in FrameworksNetTests" into sc-dev 2021-06-29 08:12:04 +00:00
Paul Hu
dca7230c1d Use appId instead of uid
Multiple user's ares of mApps are not initialized in startMonitoring(),
so mApps.get(uid) of multi-user's app returns null in onPackageAdded().
As the result, permission of system uid is updated to "Network" and
any system application cannot use dedicated apn like IMS.
Using appId avoids this problem.

Bug: 168932048
Test: atest FrameworksNetTests

Signed-off-by: Sangcheol Lee <goodsc.lee@samsung.com>
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1733212
Merged-In: Ib8ea2185d8056bddb2ca5a8006f83afb3cffc9f4

Change-Id: Ib8ea2185d8056bddb2ca5a8006f83afb3cffc9f4
2021-06-29 16:07:54 +08:00
Remi NGUYEN VAN
4cb6189802 Fix null PendingIntent in network listens
In S ConnectivityService was changed to use getActiveRequest() to fill
EXTRA_NETWORK_REQUEST, but there is no active request in the case of
listens.

When getActiveRequest() is missing, use the first mRequest instead. This
should match previous behavior.

Bug: 191713869
Test: atest android.net.cts.ConnectivityManagerTest
Original-Change: https://android-review.googlesource.com/1748153
Merged-In: Id7343a4cc020aba16b7979b16334721c56b2839c
Change-Id: Id7343a4cc020aba16b7979b16334721c56b2839c
2021-06-29 07:07:28 +00:00
Remi NGUYEN VAN
64168015f1 Merge "Fix flakes in tests running after testIsPrivateDnsBroken" into sc-dev 2021-06-29 06:51:25 +00:00
Paul Duffin
4c94d16ced Merge "Enable tethering to perform its own hidden API processing" into sc-dev 2021-06-29 06:43:40 +00:00
Treehugger Robot
b91d44a64a 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.

Original-Change: https://android-review.googlesource.com/1749560
Merged-In: Id9beba94e0fed85bd26c0509ad61369be794f3c3
Change-Id: Id9beba94e0fed85bd26c0509ad61369be794f3c3
Test: atest android.net.cts.ConnectivityManagerTest
Bug: 182296835
2021-06-29 04:04:07 +00:00
Paul Duffin
b28cb44e4b 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.
* Moving hidden API flag file entries related to tethering from the
  flag files in frameworks/base/boot/hiddenapi directory into the
  tethering directory with an appropriate OWNERS file to allow them to
  be managed by the Soong and compat team.
* Addition of a PREUPLOAD.cfg hook script to ensure that the flag files
  are sorted.

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.
Change-Id: I4d9621325c7fcea5043cbca4c577ba2ac6125c0c
Ignore-AOSP-First: merge conflicts
2021-06-28 23:41:38 +01:00