Commit graph android_packages_modules_Co.../service/src/com/android
Message SHA1
Merge changes from topic "vpn-type-oem-enterprise" into main
* changes:
  Treat new OEM VPN types like the corresponding non-OEM types.
  Add more NativeVpnType AIDL constants for OEM-specific VPNs.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2025-03-18 00:50:13 -07:00
944a1d2855
Treat new OEM VPN types like the corresponding non-OEM types.
Bug: 389829981
Test: new CTS tests
Change-Id: I9455a1e00db6fdca3706e83e26daa60db6c73d09

Lorenzo Colitti   commited 2025-03-18 14:34:18 +09:00
fd89cf529a
Merge changes from topic "revert-3535182-EBVRAQTHFS" into main
* changes:
  Revert "Return the registry in registerNetworkAgent."
  Revert "Unify registration and NM assignment in NAI"
  Revert "Add a queue system server-side for NetworkAgent"

Pechetty Sravani (xWF)   authored and   Gerrit Code Review   commited 2025-03-17 02:23:26 -07:00
67cc745550
Revert "Return the registry in registerNetworkAgent."
Revert submission 3535182

Reason for revert: <Droidmonitor created revert due to b/404070202.Will be verified through ABTD for standard investigation.>

Reverted changes: /q/submissionid:3535182

Change-Id: I2febd2ee7227d487d9cd69dcabd9c04f888fd2de

Pechetty Sravani (xWF)   commited 2025-03-17 00:48:05 -07:00
653d5f1ef4
Revert "Unify registration and NM assignment in NAI"
Revert submission 3535182

Reason for revert: <Droidmonitor created revert due to b/404070202.Will be verified through ABTD for standard investigation.>

Reverted changes: /q/submissionid:3535182

Change-Id: I65fdaaacb56c8ef227eaf1a0193efe8d332d6473

Pechetty Sravani (xWF)   commited 2025-03-17 00:48:05 -07:00
30fcf820f9
Revert "Add a queue system server-side for NetworkAgent"
Revert submission 3535182

Reason for revert: <Droidmonitor created revert due to b/404070202.Will be verified through ABTD for standard investigation.>

Reverted changes: /q/submissionid:3535182

Change-Id: Id48ef1cf44911cb291bcd8db349934751297718b

Pechetty Sravani (xWF)   authored and   Gerrit Code Review   commited 2025-03-17 00:48:05 -07:00
a5ec9b4112
Merge changes I4bc29b10,I94a56b2b,I9ca025b1 into main
* changes:
  Add a queue system server-side for NetworkAgent
  Unify registration and NM assignment in NAI
  Return the registry in registerNetworkAgent.

Jean Chalard   authored and   Gerrit Code Review   commited 2025-03-16 15:57:51 -07:00
f04de0efc1
Add a queue system server-side for NetworkAgent
The intent is to remove the queue on the NetworkAgent side.
This queue is triggered with the same conditions as the
existing one.

Test: ConnectivityCoverageTests, CtsNetTests
Change-Id: I4bc29b10e48e13cdf3c3a8a15a7c8d15954d2457

Chalard Jean   commited 2025-03-14 13:23:50 +09:00
34ccc71462
Unify registration and NM assignment in NAI
Registration is marked by the creation of the network monitor
for a given network agent. This patch makes this fact much
more ovbious.

Test: CtsNetTests ConnectivityCoverageTests
Change-Id: I94a56b2bce6f453322b1eb91d6a6f14b31e7a95f

Chalard Jean   commited 2025-03-14 13:23:50 +09:00
2e2f5faecd
Return the registry in registerNetworkAgent.
This is a resubmit of
I0fd90716b9f5501bdcdc7ee5165321737a0076ae
which did not account for testing of this private method
in Telephony tests.

Also make the network agent registry two way to eliminate
reordering possibilities.

Test: ConnectivityCoverageTest, CtsNetTests
Change-Id: I9ca025b1369dcb1202f906d5cff79e3d935b40da

Chalard Jean   commited 2025-03-14 13:23:50 +09:00
80d4326d76
Creating interface name to index tracking for Bpf Maps.
Adding mechanism to track interaface name to interface index, this map
would be used by BpfNetMaps for storing interface index.

Bug: 400681214
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.InterfaceTrackerTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Change-Id: I2a65cac908d9c4d10714e3fe26be20322d4a1db3

Sarup Dalwani   commited 2025-03-13 17:04:54 +00:00
53ecd95072
Revert "Return the registry in registerNetworkAgent."
This reverts commit 70ede3260c.

Reason for revert: Likely culprit for b/402365566 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.

Change-Id: If72cc264c5e505348309c6c11dbbfd11adeaf31b

Chaitanya Cheemala (xWF)   authored and   Gerrit Code Review   commited 2025-03-11 06:05:49 -07:00
846fb39e8a
Return the registry in registerNetworkAgent.
Also make the network agent registry two way to eliminate
reordering possibilities.

Test: ConnectivityCoverageTest, CtsNetTests
Change-Id: I0fd90716b9f5501bdcdc7ee5165321737a0076ae

Chalard Jean   commited 2025-03-11 16:26:17 +09:00
70ede3260c
Merge "Enable early native network creation for local network" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-09 20:53:11 -07:00
daa1f52b02
Enable early native network creation for local network
This is needed by tethering local network feature, given that
the IpServer needs to setup forwarding after native network
creation and before signaling network availability.

Test: atest CtsNetTestCases:android.net.cts.NetworkAgentTest \
      ConnectivityCoverageTests:android.net.EthernetTetheringTest \
      ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest \
      --update-device
Bug: 349487600
Change-Id: I2bc2ec355e01be661b587406bd127dff11665047

Junyu Lai   commited 2025-03-10 10:31:11 +08:00
91ef9d38e3
Merge "Fix wrong condition for blocked status tracking wtf log" into main
Motomu Utsumi   authored and   Gerrit Code Review   commited 2025-03-09 16:44:22 -07:00
f498a21182
Change error log to warning for removing multicast vif
Removing a multicast virtual interface with setsockoptMrt6DelMif may
return error if the interface is already gone. This is expected behavior
and should be logged as a warning instead of error.

Bug: 400596719
Change-Id: I11bfe22be5dc2479768dbc1b53eb7feeec27af3f

Yang Sun   commited 2025-03-06 02:22:23 +00:00
00077e0054
Merge "Adding more test cases for stacked link properties for local network." into main
Sarup Dalwani   authored and   Gerrit Code Review   commited 2025-03-01 10:03:31 -08:00
9de6f57d2d
Merge "Fix : crash ConnectivityService when PendingIntent is canceled" into main
Jean Chalard   authored and   Gerrit Code Review   commited 2025-02-26 22:17:11 -08:00
5c909394a6
Fix : crash ConnectivityService when PendingIntent is canceled
PendingIntent.send will throw CanceledException when the intent
can't be sent, because it was canceled or some other reason. In
some, but not all of these cases, it will still call onSendFinished
after the send is done. This means there is no way to be sure
to do something exactly once after the intent is sent.

Unfortunately, ConnectivityService must keep a wakelock until
sent is finished, and wakelocks must be released exactly once.
Too bad.

The simplest solution is to create a specialized listener object
that can manage the lifecycle of the wakelock. This allows
very localized code, easy review and checking, cheap thread
safety, and not creating multiple locks. It also avoids the
ConnectivityService class implementing OnFinished itself,
which is arguably not very readable considering how big
the class is.

Test: new test that crashes the system without the patch
Fixes: 390043283
Change-Id: Ice528eddaedb4d663098eb2bb0ae7183dafbc073

Chalard Jean   commited 2025-02-27 11:46:06 +09:00
f34735ebdc
Merge "Handling null interface in addLocalNetAccess, removeLocalNetAccess and getLocalNetAccess" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-02-25 20:20:49 -08:00
cbd6238696
Merge "Stop forwarding when BluetoothSocket read returns -1" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-02-25 14:20:44 -08:00
028d6681fb
Merge "Move server reservation validation to L2capNetworkSpecifier" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-02-25 14:20:23 -08:00
3687f0e65e
Merge "Move client request validation to L2capNetworkSpecifier" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-02-25 14:18:19 -08:00
47669ff8e4
Merge changes Ic597ee91,I6a2b48aa,Ia71c79aa,I570dbff5,Ia063deea, ... into main
* changes:
  Get rid of volatile mIsAborted
  Get rid of volatile mIsRunning
  Add some more client network tests
  Add test for when BluetoothSocket#connect throws
  Add a test for when createInsecureL2capChannel throws
  Add a test that brings up an L2cap server network
  Move creating L2capIpClient to Dependencies

Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-02-25 14:17:58 -08:00
695779c24d
Enable NetworkCallback optimizations by default.
These optimizations are already launched to all public Pixel
devices and were in in 25Q2 beta releases as well. Enable them
by default on all supported releases. The appcompat risk is very
low (these changes are difficult even for an app to detect if
it's looking for them), the user benefits are substantial, and
there is a kill switch if any unforeseen issues do occur.

Bug: 327038794
Test: both codepaths are covered by existing tests
Change-Id: I42c7ceb71ef02d078bf4563744cb11afd412f267

Lorenzo Colitti   commited 2025-02-26 04:24:58 +09:00
2169522878
Stop forwarding when BluetoothSocket read returns -1
When BluetoothSocket.InputStream#read() returns -1, the Bluetooth stack
closes the socket. Instead of dropping these packets, throw an exception
to tear down the link.

Test: TH
Change-Id: I7b78d01bc62383d9f93fa70cc4237e3604c98913

Patrick Rohr   commited 2025-02-25 09:43:18 -08:00
acbd2cce99
Move server reservation validation to L2capNetworkSpecifier
Test: TH
Change-Id: If0abf62bf008750d67d3687e5f59734421cce7cf

Patrick Rohr   commited 2025-02-25 09:26:08 -08:00
0508c94e14
Move client request validation to L2capNetworkSpecifier
Test: TH
Change-Id: Ied1af7edc60a0df01d820c2e81e16de980eb526f

Patrick Rohr   commited 2025-02-25 09:20:40 -08:00
bf65974835
Get rid of volatile mIsAborted
This has always been race-y as a socket exception could coincide with a
call to #close(). Since it is safe to run the full code paths for both
"regular" exceptions and exceptions triggered by the socket closing,
mIsAborted is not actually needed. This CL gets rid of it in favor of
simplicity.

Test: TH
Change-Id: Ic597ee917daffd6315c349dc435e5533b686bc2d

Patrick Rohr   commited 2025-02-25 09:14:11 -08:00
df26cda358
Get rid of volatile mIsRunning
The check for mIsRunning inside catch(IOException) was always race-y as
BluetoothServerSocket could have thrown an unrelated exception at the
same time tearDown() is called -- the only side effect being
inconsistent logging. However, it is safe to call
postDestroyAndUnregisterReservedOffer() as that function first checks
whether the offer still exists.

Therefore, this CL just gets rid of mIsRunning in favor of always
calling postDestroyAndUnregisterReservedOffer().

Test: TH
Change-Id: I6a2b48aa54dfa1ad55030bdcef847a1a9efa0787

Patrick Rohr   commited 2025-02-25 08:47:53 -08:00
adfe68f282
Move creating L2capIpClient to Dependencies
Unfortunately, the test does not have the permission to create an actual
IpClient. As a workaround, this change moves createL2capIpClient to the
depencencies object, so the test can mock the functionality.

Test: TH
Change-Id: I2b9128936f861bb822d80546efd72c14481bc2ed

Patrick Rohr   commited 2025-02-24 17:02:36 -08:00
a89224fea7
Handling null interface in addLocalNetAccess, removeLocalNetAccess and getLocalNetAccess
Bug: 398022752
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Change-Id: I4627fb83727d81108ed4629beb80a36e5433e140

Sarup Dalwani   commited 2025-02-24 20:13:46 +00:00
2e336acd5b
Add missing javadocs to satisfy linter
Test: TH
Change-Id: Ib2febede8b95bc74ef8d9b0f25b62320dde2cf84

Patrick Rohr   commited 2025-02-21 11:57:23 -08:00
14ba95c48e
Use ThreadLeakMonitor for CSL2capProviderTest
This CL introduces ThreadLeakMonitor for CSL2capProviderTest.
ThreadLeakMonitor ignores threads with unique names, so all
L2capNetworkProvider related threads must specify a name.

Test: TH
Change-Id: I7cfcc93ab562a1ada2058d8c73e968a8d0005b1d

Patrick Rohr   commited 2025-02-21 11:57:23 -08:00
b4f3922c01
Move creating L2capPacketForwarder to dependencies
For testing which will not do any packet forwarding as that part is
already tested.

Test: TH
Change-Id: I5d722c0d8f85c8016061f624357ff7e6ddcbfdf1

Patrick Rohr   commited 2025-02-21 11:57:23 -08:00
fdb097e77f
Remove outdated TODO
As was pointed out on the doc, "bandwidth constrained" implies that data
on this network costs money to the user, e.g. a satellite network. This
is not the case for an IPv6 over BLE network, so the TODO can be
removed.

Test: TH
Change-Id: Ide854634381d24c2f2fa49dc099f86f4cc2d813b

Patrick Rohr   commited 2025-02-20 14:56:29 -08:00
599bd47753
Make linter happier
Add 4 more spaces.

Test: TH
Change-Id: I89f65af37f847211ba49876bd7776ab44afbcb00

Patrick Rohr   commited 2025-02-20 14:56:29 -08:00
ef2e0123b4
Add thread checks
This CL adds thread checks to various functions. It also adds 2 missing
@Override annotations to make it clear that run() is part of the Thread
itself.

Test: TH
Change-Id: Ic89a85b25bdf6afaab0310a641956001d7c83a77

Patrick Rohr   commited 2025-02-20 14:56:29 -08:00
2195bb65b0
Adding more test cases for stacked link properties for local network.
Addressing feedback from previous change "Adding stacked link addresses
to local_net_access map" and adding more test cases for impact of
stacked link properties on local network prefixes.

Bug: 369815823
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSLocalNetworkProtectionTest
Change-Id: I4d32d86d3e083a1a14b845583fd80a7a4b18ae5f

Sarup Dalwani   commited 2025-02-20 05:46:02 +00:00
e53faa4e84
Check local network permissions when permission changes, or when user or
packages is added or removed

Bug: 388803658
Test: atest ConnectivityCoverageTests

Change-Id: I7d098c4d9a7614d0bd40ae23869a2010ee3f0779

Jacque Li   authored and   Neha Raj   commited 2025-02-20 04:59:45 +00:00
8d5c6eae80
Merge "Wrapping Network and Traffic permissions in a class for module usage." into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-02-19 19:27:48 -08:00
37e457bd0a
Merge "Adding stacked link addresses to local_net_access map" into main
Sarup Dalwani   authored and   Gerrit Code Review   commited 2025-02-19 19:01:55 -08:00
c42f5fc47f
Properly handle provisioning failures
This effectively cannot happen for IPv6 link-local only provisioning
unless the interface goes away during "provisioning".

Test: TH
Change-Id: Ib2c5238fdb816e74afa2300017f1014f9376ad17

Patrick Rohr   commited 2025-02-19 16:19:51 -08:00
cf0655c78a
Mark LinkProperties as volatile
LinkProperties are populated on a different thread, so must be marked as
volatile.

Test: TH
Change-Id: I5fb98bf90aa0c3f420c3619a9d58cd82986cef7e

Patrick Rohr   commited 2025-02-19 16:19:51 -08:00
909691a2ca
Fix some log statements
Test: TH
Change-Id: I470b2e810332f0f2cd229916e81bf54228cbe440

Patrick Rohr   commited 2025-02-19 16:19:51 -08:00
4cdd7253de
Split parts of L2capNetwork constructor into a static create()
Provisioning can fail if the interface disappears. This CL splits
IpClient provisioning into the create function which will eventually
return null when provisioning fails.

Test: TH
Change-Id: Ie815b0781c7642c05684438525290067d17d1a9e

Patrick Rohr   commited 2025-02-19 16:19:51 -08:00
ea137bd5eb
Fix import ordering and unused imports
Test: TH
Change-Id: I652c75c0c301df0040131f75f369065ea0a58250

Patrick Rohr   commited 2025-02-19 10:10:38 -08:00
f7343d9c15
Move createTunInterface to Dependencies for testing
Test: TH
Change-Id: I7b253db7242084c7343a589c733eccf68b3be728

Patrick Rohr   commited 2025-02-19 10:05:33 -08:00
1ad7cbfb74
Do not log when NetworkSpecifier is null
To avoid logging requests with empty capabilities and no
NetworkSpecifier. This also renames the validation functions for clarity
as was suggested in a previous review, and changes the Log.w to Log.i if
the specifier is invalid.

Test: TH
Bug: 397130676
Change-Id: I488b466f83f85ea9f3c067c95c4e01846560dea7

Patrick Rohr   commited 2025-02-19 10:05:33 -08:00
1cf990e003