Commit graph android_packages_modules_Co.../framework/src/android/net/ConnectivityManager.java
Message SHA1
Merge changes I036b7f23,I53c58e7b
* changes:
  Improve the JavaDoc for FIREWALL_CHAIN_OEM_DENY_x.
  Allow tests to set the NetworkAgent's callbacks when creating it.

Treehugger Robot   authored and   Gerrit Code Review   commited 2022-08-04 09:50:53 +00:00
bdedaacd88
Improve the JavaDoc for FIREWALL_CHAIN_OEM_DENY_x.
State that the chains are equivalent and independent.

As requested by API council.

Fix: 235973271
Test: documentation-only change
Change-Id: I036b7f23a40d038920f308c81daf7532afbae242

Lorenzo Colitti   commited 2022-08-03 09:24:28 +00:00
f683c40939
Opportunistic comment fix
Test: comment only
Change-Id: Icdf8980ebb64e42afe9c7ebc86ea605f897e47ba

Chalard Jean   commited 2022-08-03 14:46:09 +09:00
0c7ebe9e44
Use java BpfMap in BpfNetMaps#replaceUidChain
Bug: 217624062
Test: atest BpfNetMapsTest
Change-Id: Ib2a2c2646834110a3eeeb786a4ea7a3f85718be8

Motomu Utsumi   commited 2022-07-27 06:01:47 +00:00
9be2ea0080
Correct javadoc usage
"{@see" aren't rendered properly. Replace them with "See {@link"
or @see depending on the usage.

Bug: 238753273
Test: make doc-comment-check-docs ; Check the doc result
Change-Id: I70cb2f36e7c5fa8102b5949054df5184d755202c

chiachangwang   commited 2022-07-15 03:44:46 +00:00
9473c59980
Correct javadoc for ConnectivityManager#requestNetwork
Fix: 238753273
Test: make doc-comment-check-docs ; Check the doc result
Change-Id: I41c35b9cb31dcf3a372a61ad84f19295b0bc0ceb

chiachangwang   commited 2022-07-14 02:43:03 +00:00
e9c44ce718
Refactor BpfNetMaps and getChainEnabled
Address comments from aosp/2117045 and aosp/2131752
Rename USE_NETD to PRE_T
Rename getChainEnabled to isChainEnabled
Remove unnecessary parentheses
Fix comment

Bug: 217624062
Test: atest BpfNetMapsTest
Change-Id: Iaff8c9fc5f74de3fe41a7fb010355b1742fbce90

Motomu Utsumi   commited 2022-06-27 14:33:28 +00:00
25cf86fc95
Use java BpfMap in BpfNetMaps#setChildChain
Bug: 217624062
Test: atest BpfNetMapsTest android.net.cts.ConnectivityManagerTest#testFirewallBlocking

Change-Id: I13e96911eccd7d1d0545a156ddc2859bcaac09eb

Motomu Utsumi   commited 2022-06-24 09:11:58 +00:00
18b287d285
Add API to get current firewall chain status
This commit adds ConnectivityManager#getFirewallChainEnabled to read the
current firewall chain status

Bug: 208371987
Test: m
Change-Id: I1eadb69f953af5d031cd8dabde3e1f098cf0f4df

Motomu Utsumi   commited 2022-06-24 09:11:53 +00:00
be3ff1e923
Merge changes Ic6ff7a3d,Iff9b9792
* changes:
  Refactor code and improve tests for VPN filtering
  Remove LOCKDOWN from FirewallChain IntDef

Motomu Utsumi   authored and   Gerrit Code Review   commited 2022-06-16 01:32:20 +00:00
5d787feef0
Make FIREWALL_CHAIN_OEM_DENY API
Bug: 208371987
Test: m
Change-Id: Ie0c2ad862c02f9fd4561869cf5a1adc44f1be11b

Motomu Utsumi   commited 2022-06-12 11:37:19 +00:00
62385c884f
Remove LOCKDOWN from FirewallChain IntDef
LOCKDOWN_VPN was in the FirewallChain IntDef but this was not a right
place because LOCKDOWN_VPN was not a valid value for Connectivity APIs
that take an argument annotated with @FirewallChain(setUidFirewallRule,
setFirewallChainEnabled, replaceFirewallChain).

LOCKDOWN_VPN was in the FirewallChain IntDef because
BpfNetMaps#setUidRule was used to add/remove LOCKDOWN_VPN entries.
This commit adds BpfNetMaps#updateUidLockdownRule and uses this to
add/remove LOCKDOWN_VPN entries instead of BpfNetMaps#setUidRule and
removes LOCKDOWN from FirewallChain.

Bug: 206482423
Test: atest TrafficControllerTest ConnectivityServiceTest
PermissionMonitorTest HostsideVpnTests#testBlockIncomingPacket

Change-Id: Iff9b9792fc0f208f153e10e396c6d5034b412d7c

Motomu Utsumi   commited 2022-06-10 02:49:25 +00:00
8b42e6d431
Add 3rd deny firewall chain for OEM
Bug: 208371987
Test: atest
CtsNetTestCases:android.net.cts.ConnectivityManagerTest#testFirewallBlocking
ConnectivityServiceTest

Change-Id: Ib521fa02f6a19270cb88a3d85321bda822516c78

Motomu Utsumi   commited 2022-06-06 07:47:35 +00:00
1d9054ba5f
Add deny firewall chain for OEM
Bug: 207773349
Bug: 208371987
Test: atest
CtsNetTestCases:android.net.cts.ConnectivityManagerTest#testFirewallBlocking
--iterations 50 && atest ConnectivityServiceTest --iterations 10

Change-Id: I60d5540821abcced03356f366775f16ee369d7f9

Motomu Utsumi   commited 2022-06-03 09:10:57 +00:00
d980149817
Block incoming packets in VPN Lockdown mode.
Currently, even when VPN Lockdown mode is enabled, incoming packets are
not dropped if VPN is not connected.

This commit fixed this issue.
After this commit, If VPN Lockdown mode is enabled, incoming packets
are dropped regardless of the VPN connectivity.

Bug: 206482423
Test: atest TrafficControllerTest ConnectivityServiceTest PermissionMonitorTest
Change-Id: If52ece613c8aac1073355e43b6fb9cb3fcc87d1d

Motomu Utsumi   commited 2022-05-16 10:40:59 +00:00
b08654ca04
Fix ConnectivityManager memory leak
ConnectivityManager have a self reference static instance. This
causes a leak if context is refernce from a static variable. Using
the applicationContext, which will never be freed for the life of the
application, for the sInstance static instance.

Bug: 202978965
Test: atest ConnectivityManagerTest
Change-Id: I87206e1bfbb1f877b5a10f5fdbc25e2f9f11bef4

markchien   authored and   Mark Chien   commited 2022-04-29 08:01:23 +00:00
d201566169
Improve JavaDoc for FirewallRule constants
Bug: 226946569
Test: TH
Change-Id: I8366bd58194e24da7ea74bf398aae196482d0151

markchien   commited 2022-03-29 12:28:25 +08:00
011a7f51c1
Api review: change updateFirewallRule to setUidFirewallRule
Bug: 218494748
Test: TH

Change-Id: I52a02ebe109b687359f579c16fded4af3c9cd242
Merged-In: I52a02ebe109b687359f579c16fded4af3c9cd242

markchien   commited 2022-03-25 18:49:08 +08:00
3c04e66da0
Merge "Rename redactNetworkCapabilitiesForPackage and update its javadoc"
Lucas Lin   authored and   Gerrit Code Review   commited 2022-03-14 08:05:08 +00:00
ba61dca57c
Merge "Split updateMeteredNetwork{Allow, Deny}List into add and remove"
Mark Chien   authored and   Gerrit Code Review   commited 2022-03-09 05:00:58 +00:00
cc29690fc1
Split updateMeteredNetwork{Allow, Deny}List into add and remove
Split the updateXXX methods into an addXXX and removeXXX instead of using
a boolean parameter to indicate whether the uid should be added or removed

Bug: 218494748
Test: atest FrameworksNetTests
Change-Id: I868cf35c8f51b25d8719e618c6c48a5cd642da7f

markchien   commited 2022-03-09 11:17:27 +08:00
e46042b833
Remove ConnectivityManager swapActiveStatsMap API
swapActiveStatsMap is temporary added for the NetworkStatsFactory to
call BpfNetMaps#swapActiveStatsMap in tethering mainline module. Now
NetworkStatsFactory already be mainlined, calling BpfNetMaps#swapActiveStatsMap
directly.

Bug: 218494448
Test: atest ConnectivityCoverageTests
      atest FrameworksNetTests
Change-Id: I3358e4ac5fb7ed0964273afdbccd1b4128ca7645

markchien   commited 2022-03-07 12:25:47 +08:00
49e944cc1c
Rename redactNetworkCapabilitiesForPackage and update its javadoc
The API won't modify the passed NetworkCapabilities and
LinkProperties, but redactNetworkCapabilitiesForPackage and
redactLinkPropertiesForPackage sound like they will. To reduce
the confusion, rename the API with prefix "getRedacted".
Also modify the javadoc to describe more about what the API will
do if the given UID doesn't have location permission.

Bug: 220367512
Test: atest CtsNetTestCases
Change-Id: I964f1062da1ae96df9b369b911486da1379b8a19

lucaslin   commited 2022-03-02 10:56:57 +08:00
d2b0613814
Add new methods to redact NetworkCapabilities & LinkProperties
Some system components like VPN need to know how to redact
NetworkCapabilities & LinkProperties that they received from
the system but need to send to third-party applications with
less privilege than themselves. To make sure the redaction is
consistent, expose system API methods to do it that are wired
to the same redaction code used by ConnectivityService.

Bug: 191413541
Test: atest CtsNetTestCases, which includes new CTS for these
Change-Id: Ia3ae4755b5192884c147d6828f96cedac000a25b

lucaslin   authored and   Chalard Jean   commited 2022-02-12 15:21:13 +09:00
c582d50b8e
Add Low Power Standby support to TrafficController
Bug: 190822356
Test: atest TrafficControllerTest
Change-Id: I84a95081ab6e6a86543fe2cddf0efdab16c90d72

Robert Horvath   commited 2022-02-02 22:54:21 +01:00
d945bf0b4f
Define BLOCKED_REASON_LOW_POWER_STANDBY
Bug: 190822356
Test: atest NetworkPolicyManagerServiceTest
Change-Id: I72c81ba1c3791e40a2d311cc3a06bf3b5d3727d1

Robert Horvath   commited 2022-02-01 16:04:35 +01:00
2dac94841a
Define FIREWALL_CHAIN_LOW_POWER_STANDBY
Bug: 190822356
Test: atest NetworkManagementServiceTest
Change-Id: I970eea0e1952f8074cc5c998bbd2ee1ff5a3dc92

Robert Horvath   commited 2022-02-01 16:04:35 +01:00
34cba14425
Add support for Multiple enterprise slice
Bug: 194332512
Test: unit test
CTS-Coverage-Bug: 211133973
Change-Id: Ie8be08a7cfa9155168d1da146d02fd1643248bdc

Sooraj Sasindran   commited 2022-01-22 14:39:40 -08:00
f4a58dcd45
Merge "Fix some typos in comments"
Mark Chien   authored and   Gerrit Code Review   commited 2022-01-20 10:17:27 +00:00
0730625a31
Fix some typos in comments
This is CL just fix comments without changing behavior.

Bug: 209935649
Test: m
Change-Id: Iac40477bd2a3c48ba2a3f75a9cdf1174bcc89c3c

markchien   commited 2022-01-14 13:47:13 +08:00
68cfadc523
Merge "Add swapActiveStatsMap API for NetworkStatsFactory"
Mark Chien   authored and   Gerrit Code Review   commited 2022-01-14 05:35:25 +00:00
21f0d58294
Merge "Add replaceFirewallChain API"
Mark Chien   authored and   Gerrit Code Review   commited 2022-01-14 05:33:58 +00:00
094de6b7c4
Merge "Add setFirewallChainEnabled API"
Mark Chien   authored and   Gerrit Code Review   commited 2022-01-14 05:33:38 +00:00
9bba8e8c78
Merge "Add updateFirewallRule API"
Mark Chien   authored and   Gerrit Code Review   commited 2022-01-14 05:33:22 +00:00
c65ecacd6f
Add swapActiveStatsMap API for NetworkStatsFactory
This CL should be reverted before T sdk finalized.
This API is temporary added for the NetworkStatsFactory which is platform
code but will be moved into connectivity (tethering) mainline module.

Bug: 209935649
Test: atest CtsHostsideNetworkTests
Change-Id: I5894450f3089b2ea105722a18ddf8f1eed1c28a0

markchien   commited 2022-01-14 10:23:26 +08:00
9c8061134c
Add replaceFirewallChain API
To deprecated firewallReplaceUidChain netd binder and move the
functionality to tethering (connectivity) mainline module, expose
replaceFirewallChain to support the caller outside the module.
Currently the API are still call to netd. Will replace with the
implementation inside tethering (connectivity) module.

Bug: 209935649
Test: atest CtsHostsideNetworkTests
Change-Id: If7a87548b0a3acda00a1455da4e4ff24a630ddc7

markchien   commited 2022-01-14 10:23:21 +08:00
00a0bed534
Add setFirewallChainEnabled API
To deprecated firewallEnableChildChain netd binder and move the
functionality to tethering (connectivity) mainline module, expose
setFirewallChainEnabled to support the caller outside the module.
Currently the API are still call to netd. Will replace with the
implementation inside tethering (connectivity) module.

Bug: 209935649
Test: atest CtsHostsideNetworkTests
Change-Id: I9b64c9d12260521489a87fbeae5afbee2a8ea8f6

markchien   commited 2022-01-14 10:23:15 +08:00
98a6f95d0f
Add updateFirewallRule API
To deprecated firewallSetUidRule netd binder and move the functionality to
tethering (connectivity) mainline module, expose updateFirewallRule to
support the caller outside the module. Currently the API are still call
to netd. Will replace with the implementation inside tethering
(connectivity) module.

Bug: 209935649
Test: atest CtsHostsideNetworkTests
Change-Id: I0b53c999e06c2378afec0eb491815ec398c91b0b

markchien   commited 2022-01-14 10:19:51 +08:00
e1561fa800
Merge "Ability for DPM to specify fallback mechanism"
Sooraj Sasindran   authored and   Gerrit Code Review   commited 2022-01-13 17:24:07 +00:00
226131ab48
Merge "Add updateMeteredNetwork{Allow, Deny}List APIs"
Mark Chien   authored and   Gerrit Code Review   commited 2022-01-13 08:21:03 +00:00
136f2d2d91
Ability for DPM to specify fallback mechanism
Bug: 194332512
Test: unit test
Change-Id: Id4d85da8f64e7559326c4657b8833dac3ce5ce3d

Sooraj Sasindran   commited 2022-01-13 06:07:36 +00:00
06baf4cfa1
Add a method to apply a set of network preferences to a user profile
Add a method to apply a set of network preferences to a user profile

Bug: 194332512
CTS-Coverage-Bug: 211133973
Test: CTS
Change-Id: I97730ea14e7c96922236fd77a591e5acadd875ba

Sooraj Sasindran   commited 2022-01-11 21:07:23 -08:00
e7aee2736e
Add updateMeteredNetwork{Allow, Deny}List APIs
To deprecated below netd binder interfaces and move the functionality to
tethering(connectivity) mainline module:
  bandwidthAddNaughtyApp
  bandwidthRemoveNaughtyApp
  bandwidthAddNiceApp
  bandwidthRemoveNiceApp
Expose updateMeteredNetwork{Allow, Deny}List APIs to support the caller
outside the module. Currently the two APIs are still call to INetd
binders. Once functionality is moved to mainline module, will switch to
use them.

Bug: 209935649
Test: m
Change-Id: I8df720935748c2587f91a7b760cfd5a93a0fa852

markchien   commited 2022-01-07 10:16:13 +08:00
738ad911c7
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
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