Commit graph android_packages_modules_Co.../framework
Message SHA1
Merge "Qualify references to WifiNetworkSuggestions"
Anton Hansson   authored and   Gerrit Code Review   commited 2021-10-21 11:53:06 +00:00
7ea2767864
Merge "Add underlying networks into NetworkAgentInfo if any"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-10-21 08:33:29 +00:00
9c9850b944
Qualify references to WifiNetworkSuggestions
Connectivity's metalava invocation does not depend on framework-wifi,
so these references fail to resolve, and as a result metalava currently
removes the import.

Fully qualify the references instead, to avoid both metalava trying
to resolve the dependency, and having to depend on framework-wifi just
for javadoc.

Bug: 186197911
Test: build the sdk (with connectivity module stubs as input)
Change-Id: I7129821b9a0d08d06f8e977a3c17fa5f5f6f9cee

Anton Hansson   commited 2021-10-20 11:34:48 +01:00
df40109271
Crash bad callers earlier
Instead of crashing when parceling the NetworkInfo object,
crash at the time the bad call is made.

Bug: 145972387
Test: FrameworksNetTests
Change-Id: If8b5fd3d7b800c97211bcd16c9a8c5812708d4ab

Chalard Jean   authored and   paulhu   commited 2021-10-19 16:43:50 +08:00
4b918ab1a4
Add underlying networks into NetworkAgentInfo if any
Now, VPN will set underlying networks into NetworkCapabilities
directly. So the declaredUnderlyingNetworks can also be set
directly when creating a NetworkAgentInfo.

Bug: 191918368
Test: atest FrameworksNetTests:ConnectivityServiceTest
Change-Id: I507072d00ae1eb0c391e5261ab93e359b9c4cb5c

lucaslin   commited 2021-10-19 15:04:56 +08:00
6adf5ac19b
Add new APIs in NetworkCapabilities to set and get underlying networks
Previously, the caller can only know about the transport type of
the underlying network. The information might not be enough if
the device support WiFi STA+STA.
Thus, provide an API for the caller to get the correct underlying
network.

Bug: 191918368
Test: atest FrameworksNetTests:NetworkCapabilitiesTest
Change-Id: I7752b2356770f4572f6ca4cbaecaa45c09d6d72f

lucaslin   commited 2021-10-15 18:07:12 +08:00
8b2dfa7c02
Merge "Add a small usage comment" am: a898f0a039
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1844182

Change-Id: Ibe27d64cd16a2ef44d6a41b94f81a0daa06c523b

Chalard Jean   authored and   Automerger Merge Worker   commited 2021-10-05 11:14:01 +00:00
7f40360e32
Add a small usage comment
Test: comment-only change
Bug: 201972281
Change-Id: Ifbdadbaacfaf364f6770e56ccb816eb3269003d5

Chalard Jean   commited 2021-10-04 18:33:36 +09:00
025f40bc4f
Merge "Remove reference when active listener is unregistered" am: a39b107812
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1833145

Change-Id: I7b05b33c2a0c02c298d42ab4891ce543fe5ab9bd

Chiachang Wang   authored and   Automerger Merge Worker   commited 2021-10-01 00:54:16 +00:00
e129460c46
Merge "Remove reference when active listener is unregistered"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-10-01 00:37:00 +00:00
a39b107812
Remove reference when active listener is unregistered
The registered listeners are added into internal ArrayMap as a
reference but are not removed when the listeners are
unregistered. The actions for registration should be done in
pairs.

Test: atest FrameworksNetTests
Change-Id: Id9e674f5104d1471dd81224b6a271a8a92172e34

Chiachang Wang   commited 2021-09-30 10:30:35 +00:00
2de41686e7
Merge "Small doc improvement" am: a997db7f40
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1838427

Change-Id: Id3afa12d046e1666978840fee0918f4f160a21c9

Chalard Jean   authored and   Automerger Merge Worker   commited 2021-09-30 08:01:44 +00:00
9f61ab08bd
Merge "Small doc improvement"
Chalard Jean   authored and   Gerrit Code Review   commited 2021-09-30 07:48:00 +00:00
a997db7f40
Small doc improvement
Test: comment-only change
Bug: 191744296
Change-Id: I80447783c9fd89f3b6685a4276cc555a7075a70f

Chalard Jean   commited 2021-09-28 15:31:15 +09:00
0d05151b5c
Merge "Add a mode for cell radios unable to time share" am: c80a5d56db
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1827923

Change-Id: I5ded48c8498c32977adcfe2363599d6cfa246e1b

Chalard Jean   authored and   Automerger Merge Worker   commited 2021-09-18 12:50:52 +00:00
d4ec13a400
Add a mode for cell radios unable to time share
Upon changing the default SIM card, the radio will create a
new connection to the new subscription. If that subscription
works correctly, the stack will prefer it to the old one as
the new subscription will be marked with a Primary policy
flag it its score.

Normally, at this point the old network lingers to give apps
an opportunity to gracefully migrate their connections. But
with some radios, this may have a dramatic effect on the
performance of the new connection.

This patch introduces a flag so that devices with such radios
can be marked. In this case the stack will move to a degraded
mode and eschew the grace delay for apps and give them a hard
break instead, so that the new network can reach a good
performance immediately. Apps with existing connections will
suffer a worse experience.

If there is a request that can only be served by the old
connection, still keep it, as arguably the user still
expects their MMS be sent on the old connection, even if the
new connection doesn't work well until it's done.

Test: new test in this patch, and add relevant tests in both modes
      also manually change the value of the flag and run
      FrameworksNetTests and CtsNetTestCasesLatestSdk
Bug: 200226979
Change-Id: I4ace82f90e873bf06298cc689bb1d794ed5124bd

Chalard Jean   commited 2021-09-18 04:03:13 +00:00
0702f98edc
Merge "Correct the calling method in removeDefaultNetworkActiveListener" am: a6e3069c27
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1827914

Change-Id: I69a199d8253aca744a43b04e89a88da65f6bd8b9

Chiachang Wang   authored and   Automerger Merge Worker   commited 2021-09-16 06:39:32 +00:00
7c04a51a95
Correct the calling method in removeDefaultNetworkActiveListener
The removeDefaultNetworkActiveListener should do the
unregisteration but it's incorrectly calling
registerNetworkActivityListener into the ConnectivityService.

Bug: 199753782
Test: atest FrameworksNetTests CtsNetTestCases
Change-Id: I65a2ddc82989d736316d51f5058e707f5b261a82

Chiachang Wang   commited 2021-09-16 02:25:48 +00:00
e54c8199aa
Merge "Separate test into reasonable multiple tests" am: 26a7e61417
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1793478

Change-Id: I9193477c6744c6f9a1f7e7e14e0c98e4348b262d

Chiachang Wang   authored and   Automerger Merge Worker   commited 2021-09-07 03:01:39 +00:00
33076dddff
Merge "Merge sc-dev-plus-aosp-without-vendor@7634622" into stage-aosp-master
Xin Li   authored and   Android (Google) Code Review   commited 2021-08-17 18:15:09 +00:00
e534ce4c55
Separate test into reasonable multiple tests
The test actually verifies multiple behaviors and mutates the
networkCapabilities. Thus, refactor the method to keep the
tests easier to follow up.

Bug: 191918212
Test: atest android.net.NetworkCapabilitiesTest
Change-Id: Ibad1a0569d26d92f94153bee323cef5a1c30d8d4

Chiachang Wang   commited 2021-08-17 16:02:09 +08:00
d525a64ead
Fix NetworkCapabilities MTS on S, CTS on S+module
restrictCapabilitiesForTestNetwork was renamed after S release to be
included in a mainline release, but this causes the MTS test to fail on
S if the Connectivity module is not updated, and CTS to fail if the
connectivity module is updated.

Mark the test as @ConnectivityModuleTest so it can be skipped on
non-connectivity module MTS tests (such as NetworkStack tests), and add
back the previous method name to keep CTS passing.

Bug: 196755836
Test: atest NetworkCapabilitiesTest
Change-Id: Ibd6c2e62e5949ec6d93e9f6e4fc05129c29b94f8

Remi NGUYEN VAN   commited 2021-08-16 18:03:37 +09:00
5b8e2e9935
Merge sc-dev-plus-aosp-without-vendor@7634622
Merged-In: I5a33f959c8ae5a34584f57508f392038e44062e7
Change-Id: Ib4e5e75ee8bbe19806bdc2f69590d164fb75774b

Xin Li   commited 2021-08-14 06:31:05 +00:00
3ec4468fb7
The net cap value should be bit shifted before &ing
The check intends to do the bit & operation. The net cap value
should be shifted against the original capabilities.

Also fix the typo in the method name.

Bug: 191918212
Test: atest FrameworksNetTests
Change-Id: I98396b2538f36fe8b29d27a544a2dfb3060bc9c5

Chiachang Wang   commited 2021-08-11 14:55:00 +08:00
c07315aa08
Merge "Correct log" am: 913dba8be3 am: 3f6e40dbd7
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/1772285

Change-Id: I295f07a5621e20ad4cf1bfeafd8a4f57f00d96dd

Treehugger Robot   authored and   Automerger Merge Worker   commited 2021-07-20 08:45:41 +00:00
855d6cdf05
Merge "Correct log"
Treehugger Robot   authored and   Gerrit Code Review   commited 2021-07-20 08:20:37 +00:00
913dba8be3
Correct log
Log should print the taken parameter instead of the value of
current variable

Test: m
Bug: 192149168
Change-Id: Ia3b9e607fe8b661a7faea3b46b9697fa85016440

Chiachang Wang   commited 2021-07-20 13:16:57 +08:00
525b07d28a
Cleanup the public API getActiveNetworkForUid on AOSP
In order to make ConnectivityService the mainline module in ANDROID 12,
The earliest ConnectivityService API getActiveNetworkForUid was exposed.

But after that public api getActiveNetworkForUid and all callers
(Outside the module) has been deleted or replaced in android 12
version. So we should delete the public API in AOSP to keep the APIs
of Android 12 & AOSP consistent and also avoid using it again in AOSP.
The commit is equivalent to ag/14029494, but done in a different repo.

Bug: 183465229
Test: atest ConnectivityControllerTest
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: I50a39d6391c88bbb914a63fdb17bae6851591c01

lifr   commited 2021-07-14 21:13:45 +08:00
538f079d20
Add new network capabilities to support automotive head unit via USB
- Add a new transport type for USB and a new network capability
to support automotive head unit.
- In order to pass DnsManagerTest#testTransportTypesEqual, Android.bp
needs to link to dnsresolver_aidl_interface-V8-java. That test checks
whether the TRANSPORT types defined in NetworkCapabilities are the
same as IDnsResolver.aidl.

(clean cherry-pick of change in downstream branch history, original
change ID before project move:
Iec2df09a776d779108f95098e01b7ffdf6f8867a)

Bug: 181742019
Test: atest FrameworksNetTests

Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Change-Id: Ie438ec68577ebdaaf990795fa27f1169b0105411

lucaslin   authored and   Remi NGUYEN VAN   commited 2021-07-08 09:44:39 +09:00
6f77442d76
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
Merged-In: I175a831671d3e52460d28203b09f6c0dda56b61c

Change-Id: I175a831671d3e52460d28203b09f6c0dda56b61c

paulhu   commited 2021-07-02 20:04:50 +08:00
92f128c51c
Merge "Force only system uid can set uids allowed on restricted networks" into sc-dev
Paul Hu   authored and   Android (Google) Code Review   commited 2021-07-02 10:46:19 +00:00
77739d37b3
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

Remi NGUYEN VAN   commited 2021-07-02 04:54:29 +00:00
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

Change-Id: Id448be03b679f832edb24f1b77f471227faf5268

Remi NGUYEN VAN   commited 2021-07-02 10:05:07 +09:00
b2e919f9da
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

Orion Hodson   authored and   Remi NGUYEN VAN   commited 2021-07-02 00:42:52 +00:00
5e5c287d6b
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
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

paulhu   commited 2021-07-01 23:01:41 +08:00
03635b3ad5
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

Chiachang Wang   commited 2021-07-01 00:32:08 +00:00
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
Change-Id: Ie0f777d0030b66dd306332496192c74f6c183284

Chiachang Wang   commited 2021-06-30 16:41:59 +08:00
f1e09ef031
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
Merge "Add ConnectivitySettingsManagerTest" into sc-dev
Paul Hu   authored and   Android (Google) Code Review   commited 2021-06-23 16:29:20 +00:00
a244f13f21
Add ConnectivitySettingsManagerTest
- Add tests for ConnectivitySettingsManager.
- Also address leftover javadoc comments.

Bug: 182538166
Test: atest FrameworksNetTests
Test: atest CtsNetTestCases
Original-Change: https://android-review.googlesource.com/1738353
Merged-In: I8161c1bca84b41964578d59ee5d6ab07b2380707
Change-Id: I8161c1bca84b41964578d59ee5d6ab07b2380707

paulhu   commited 2021-06-23 20:02:27 +08:00
0903f73e1f
Provide a way to override the avoid bad wifi configuration
ConnectivityManager.setAvoidUnvalidated only works if the
config_networkAvoidBadWifi configuration is set to 0 and the
NETWORK_AVOID_BAD_WIFI setting is unset. There is no easy way
for a testing app to temporary set a test value to verify the
behavior of the API. Thus, add a mechanism to allow test app
to set a period of time to temporary unstrict the resource
configuration, i.e. Temporary simulate config_networkAvoidBadWifi
configured to 0.

Bug: 186061922
Test: atest CtsNetTestCases FrameworksNetTests
Original-Change: https://android-review.googlesource.com/1733788
Merged-In: If772078c61a9b12926f104d5dfc9c9071e844732
Change-Id: If772078c61a9b12926f104d5dfc9c9071e844732

Chiachang Wang   commited 2021-06-23 08:42:47 +00:00
fad30e3d84
Merge "Initialize TetheringManager lazily" into sc-dev
Remi NGUYEN VAN   authored and   Android (Google) Code Review   commited 2021-06-23 02:17:34 +00:00
7579035ac9
Merge "Add ConnectivitySettingsManagerTest"
Paul Hu   authored and   Gerrit Code Review   commited 2021-06-23 01:36:16 +00:00
6160d60b2e
Merge "Provide a way to override the avoid bad wifi configuration"
Chiachang Wang   authored and   Gerrit Code Review   commited 2021-06-23 00:48:17 +00:00
38e8c2c94b
Call ConnectivitySettingsUtils to set/get private DNS related settings
ConnectivitySettingsManager and CtsNetUtils are doing the same
thing to set/get private DNS related settings.
To prevent making the duplication code in two places, move the
body to frameworks/libs/net and call it.

Bug: 185311744
Test: atest CtsNetTestCases CtsNetTestCasesLatestSdk
Original-Change: https://android-review.googlesource.com/1719017
Merged-In: I3272c825b86ec30c3d0bf4097088c653e668461b
Change-Id: I3272c825b86ec30c3d0bf4097088c653e668461b

Lucas Lin   authored and   Remi NGUYEN VAN   commited 2021-06-22 09:24:37 +00:00
611bc021e6
Provide a way to override the avoid bad wifi configuration
ConnectivityManager.setAvoidUnvalidated only works if the
config_networkAvoidBadWifi configuration is set to 0 and the
NETWORK_AVOID_BAD_WIFI setting is unset. There is no easy way
for a testing app to temporary set a test value to verify the
behavior of the API. Thus, add a mechanism to allow test app
to set a period of time to temporary unstrict the resource
configuration, i.e. Temporary simulate config_networkAvoidBadWifi
configured to 0.

Bug: 186061922
Test: atest CtsNetTestCases FrameworksNetTests
Change-Id: If772078c61a9b12926f104d5dfc9c9071e844732

Chiachang Wang   commited 2021-06-22 14:54:02 +08:00
6eac9fb787
Add ConnectivitySettingsManagerTest
- Add tests for ConnectivitySettingsManager.
- Also address leftover javadoc comments.

Bug: 182538166
Test: atest FrameworksNetTests
Test: atest CtsNetTestCases
Change-Id: I8161c1bca84b41964578d59ee5d6ab07b2380707

paulhu   commited 2021-06-22 03:00:51 +00:00
236a992cd0
Merge "Call ConnectivitySettingsUtils to set/get private DNS related settings"
Lucas Lin   authored and   Gerrit Code Review   commited 2021-06-21 19:12:33 +00:00
c12550b9f4
Initialize TetheringManager lazily
Many applications use ConnectivityManager without needing
TetheringManager (or without calling legacy ConnectivityManager methods
that delegate to TetheringManager), so initializing TetheringManager
when ConnectivityManager is created wastes resources.

This is especially true considering that TetheringManager is not trivial
to initialize (worst case scenario it starts a thread and does multiple
Binder requests), and ConnectivityManager is created in ActivityThread
when setting up the app proxy on startup.

Bug: 190556328
Test: atest FrameworksNetTests CtsNetTestCases TetheringTests
Original-Change: https://android-review.googlesource.com/1736505
Merged-In: I2ba7b8f2b9e1c934cfb082776b8d643f2f2c17e5
Change-Id: I2ba7b8f2b9e1c934cfb082776b8d643f2f2c17e5

Remi NGUYEN VAN   commited 2021-06-21 10:23:52 +00:00
77ea93bbfb