Commit graph android_packages_modules_Co.../framework
Message SHA1
Merge "Parcel Network#mPrivateDnsBypass" into main
Jean Chalard   authored and   Android (Google) Code Review   commited 2025-05-19 00:03:32 -07:00
499961d60f
Extend QosFilter address matching function
Extend QosFilter address match function for IP address range based on
prefix length.

Bug: 406146808
Bug: 399960748
Flag: com.android.net.flags.qos_filter_ip_range_matching
Test: atest CtsNetTestCases
Test: atest ConnectivityCoverageTests
Change-Id: I78d995fda111d258da9a912c7afa5e472e43437f

Sewook Seo   commited 2025-05-08 22:37:32 -07:00
6305252415
Update enforceMeteredApnPolicy to follow the compat flag
On V+, ConnectivityService uses uid blocking state in BpfMap instead of
asking NetworkPolicyManager.
But, there was one behavior difference because NetworkPolicyManager
considers the network is always not blocked for apps without Internet
permission.
To ensure backward compatibility, the
NETWORK_BLOCKED_WITHOUT_INTERNET_PERMISSION flag was introduced in
aosp/3076606, aosp/3088285.

This CL updates enforceMeteredApnPolicy to respect this flag for
backward compatibility.

Test: CSEnforceMeteredApnPolicy
Bug: 404428733
Bug: 370383309
Flag: EXEMPT bugfix
Change-Id: I631f4f840818e1d40f20fccae1ec1a2cbbb6a166

Motomu Utsumi   commited 2025-04-21 12:19:45 +09:00
5759bf45a5
Parcel Network#mPrivateDnsBypass
Though all versions will parcel this, the behavior will not change
before B. Starting with B, this flag is parceled and handed over
to apps.

Test: ConnectivityCoverageTests, CtsNetTestCases
Flag: EXEMPT no behavior change before B
Change-Id: I7e9ae9011c74b80c208d8f297aa3b7d1aea176f2

Chalard Jean   authored and   Xiao Ma   commited 2025-04-07 11:46:38 +09:00
4f07a5b911
Make NetworkAgent#sendNetworkInfo public again
Changing this method to private broke OEM code that would link
directly against the non-public methods of the module. This
should not be allowed, and we have changes in the works to
disallow this, but in the mean time we can't afford to break
devices in the field.

Test: will have to see how it behaves in the lab on relevant devices
Flag: EXEMPT bugfix
Bug: 406489362
Change-Id: Ie6c1ebb04e49317fdda34ff3dd522cd9d4677556

Chalard Jean   commited 2025-03-28 18:09:13 +09:00
f7e102081d
Merge "Changing from EnabledAfter to Disabled for RESTRICT_LOCAL_NETWORK" into main
Sarup Dalwani   authored and   Android (Google) Code Review   commited 2025-03-27 06:46:52 -07:00
8590d2dfd9
Changing from EnabledAfter to Disabled for RESTRICT_LOCAL_NETWORK
The adb app compat command to enable fails for platform being old. Making this flag as disabled by default and overridable.

Bug: 405186661
Test: atest ConnectivityCoverageTests
Flag: EXEMPT bugfix
Change-Id: Ia1242803ed9b02290a5b66c4d1e224c87450d370

Sarup Dalwani   commited 2025-03-26 21:50:17 -07:00
65ce25496b
Revert "Revert "Add hidden API to register/unregister QUIC conne..."
Revert submission 3561690-revert-3538339-SNUWWZJNJZ

Reason for revert: NewAPI error will be fixed by separate CL

Reverted changes: /q/submissionid:3561690-revert-3538339-SNUWWZJNJZ

Change-Id: Ia7367e9332f4d376bd0be4c03c095ee00de9177a

Motomu Utsumi   commited 2025-03-27 08:49:00 +09:00
e8e28f6236
Revert "Add hidden API to register/unregister QUIC connection cl..."
Revert submission 3538339

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

Reverted changes: /q/submissionid:3538339

Change-Id: I61b02f2b1b667e9a41b677f8062e8e96aac09f6e

Chaitanya Cheemala (xWF)   commited 2025-03-26 03:07:07 -07:00
947b53b0d3
Add hidden API to register/unregister QUIC connection close payload
QUIC stack running on the app process will call this API and register
QUIC UDP socket and UDP payload that can close QUIC connection.

When the app loses network access (e.g. due to freezer or firewall
chain), ConnectivityService 1)destroys the registered UDP socket by
sending a SOCK_DESTROY netlink message and 2)sends the registered UDP
payload to the server. This prevents unnecessary modem wakeups caused
by packets from the server after the apps lose network access.

Additionally, to close QUIC connection for apps that crash or are
killed, ConnectivityService sends the registered UDP payload when it
receives a socket destroy diag message for the registered socket.

Bug: 311792075
Test: CSDestroySocketTest CtsNetTestCases
Change-Id: I6cd727bd8bb0fe1d17360edfa395f73d24da6920

Motomu Utsumi   commited 2025-03-26 16:48:28 +09:00
627b8c6d34
Merge "Disable non-thread local network matching" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-21 08:08:56 -07:00
e0051cdeb9
Merge changes from topic "tetherlocalagent" into main
* changes:
  Add integration test of tethering local network agent feature
  Add unit test of tethering local network agent feature
  Support LocalNetworkAgent for Tethering

Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-21 07:42:40 -07:00
0b7d710ba0
Disable non-thread local network matching
Currently, apps targeting V can see thread local network.

This change introduces a mechanism to make existing
apps unable to see non-thread local networks to ensure minimal
impact on existing devices and applications while adopting this
behavior. Apps targeting B+ Sdk and run on V+ devices can see
non-thread local networks.

Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSLocalAgentTests \
      --update-device
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server --update-device
      (on next/trunk_staging release config)
Bug: 349487600
Change-Id: I6aa43cebc20a9017c2d8a8a90ebb1d53040a27bb

Junyu Lai   commited 2025-03-21 19:34:49 +08:00
0b806fd931
Support LocalNetworkAgent for Tethering
The feature will be gradually enabled via flag rollout.

Sample ip rule output:
0:	from all lookup local
10000:	from all fwmark 0xc0000/0xd0000 lookup legacy_system
11000:	from all iif lo oif dummy0 uidrange 0-0 lookup dummy0
11000:	from all iif lo oif rmnet1 uidrange 0-0 lookup rmnet1
11000:	from all iif lo oif wlan0 uidrange 0-0 lookup wlan0
16000:	from all fwmark 0x10063/0x1ffff iif lo lookup local_network
16000:	from all fwmark 0x10064/0x1ffff iif lo lookup rmnet1
16000:	from all fwmark 0x10066/0x1ffff iif lo lookup wlan0
16000:	from all fwmark 0x10063/0x1ffff iif lo lookup wlan0
17000:	from all iif lo oif dummy0 lookup dummy0
17000:	from all iif lo oif rmnet1 lookup rmnet1
17000:	from all iif lo oif wlan0 lookup wlan0
18000:	from all fwmark 0x0/0x10000 lookup legacy_system
19000:	from all fwmark 0x0/0x10000 lookup legacy_network
20000:	from all fwmark 0x0/0x10000 lookup local_network
20000:	from all fwmark 0x0/0x10000 lookup wlan0
21000:	from all iif wlan0 lookup rmnet1
23000:	from all fwmark 0x64/0x1ffff iif lo lookup rmnet1
23000:	from all fwmark 0x66/0x1ffff iif lo lookup wlan0
31000:	from all fwmark 0x0/0xffff iif lo lookup rmnet1
32000:	from all unreachable

Test: adb shell device_config put tethering tethering_local_network_agent 1
Test: atest TetheringTests:android.net.ip.IpServerTest TetheringManagerTest
Bug: 349487600
Change-Id: Iaa88dde645da917149fec0d44fff796c551bcc7e

Junyu Lai   commited 2025-03-21 17:16:46 +08:00
d55bd89bd6
Merge "Changing the targetSdkVersion for RESTRICT_LOCAL_NETWORK" into main
Sarup Dalwani   authored and   Gerrit Code Review   commited 2025-03-20 23:13:12 -07:00
d43a4fdbfd
Changing the targetSdkVersion for RESTRICT_LOCAL_NETWORK
The targetSdkVersion was set to enable after current_development version
so the test cases targetting current do not have change enabled. It was
observed that user builds did not allowed changing compat flag on
current values. Changing this to enabled after baklava.

Bug: 405183129
Test: atest ConnectivityCoverageTests
Change-Id: Ifeb7cde9f1a7d2b5a254f297207d625bf9d02731

Sarup Dalwani   commited 2025-03-21 04:32:25 +00:00
5f020a5ab8
Add MatchNonThreadLocalNetworks flag in NetworkCapabilities
This is for backwards compatibility. Apps targeting V or lower
SDK should not see Tethering network agent.

This restriction is still disabled to maintain no-op in this
change. Will be enabled when introducing ConnectivityService
part in the subsequent change.

Test: atest CtsNetTestCases:android.net.NetworkCapabilitiesTest \
      ConnectivityCoverageTests:android.net.connectivity.com.android.server \
      --update-device
Bug: 349487600
Change-Id: I99405ab62e82ff4b7fcebffd3a1a31ec6d8962a9

Junyu Lai   commited 2025-03-21 10:36:41 +08:00
f3ae766e8e
Remove the queue on the NetworkAgent side
Now that the system server has a queue doing this job,
the queue on the network agent side can be removed.

Test: ConnectivityCoverageTests, CtsNetTestCases
Change-Id: Idf0435f447cfdd28d829a867d1085771837c6f9b

Chalard Jean   commited 2025-03-18 19:23:57 +09:00
391ec5d99c
Reapply "Return the registry in registerNetworkAgent."
Now that faulty Telephony tests have been disabled temporarily
to allow for this bugfix, this can be reverted.
This reverts commit 653d5f1ef4.

Test: FrameworksTelephonyTests CtsNetTestCases
Change-Id: If6b1541981803dc84de57b48adb13d40c9997fa0

Chalard Jean   commited 2025-03-18 14:42:39 +09:00
8a97692638
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
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
Add a method to help mocking registerNetworkAgent
This is a trick to help mocking registerNetworkAgent without
having to import its return type. In the near future the
return type will be changed to a non-public class, which
can't be seen in CTS.

Really this shouldn't be necessary because only Connectivity
tests should mock ConnectivityManager, but the practice is
different and other mockers need this support.

See also aosp/3538922

Test: NetworkAgentTest
Change-Id: I3ac63d95d3830a3b413f9ad12b84ac426b63dd08

Chalard Jean   commited 2025-03-14 13:23:37 +09:00
8fd6347d35
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
Change NETWORK_BLOCKED_WITHOUT_INTERNET_PERMISSION ChangeId to target 37+
This was causing issues with jobs execution using JobScheduler, in apps that don't request INTERNET permission.

Bug: 397348342 
Flag: EXEMPT changes a compat flag
Change-Id: I1c421cbaff815ed761ec4c0da3ead942ddc55d5c

Sandeep Bandaru   commited 2025-03-05 02:38:22 -08:00
597a64fc23
Merge "Add method to get socket cookie from socket FileDescriptor" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-03-03 20:55:49 -08:00
c088b301a8
Add method to get socket cookie from socket FileDescriptor
aosp/3502915 use this method from ConnectivityService to get socket
cookie that is required for closing QUIC connection.

Bug: 311792075
Test: m, boot
Change-Id: I17d8a4dd24cfb84e9b008b8eb87eedec67b29020

Motomu Utsumi   authored and   Maciej Żenczykowski   commited 2025-03-03 17:23:04 -08:00
b9b8828bf5
Remove -stubs-including-flagged
These were added to allow tests to build against flagged off APIs, in
legacy downstream branches that did not support the flagging
infrastructure and stripped out flagged off APIs from the stubs.

Flagged off APIs are part of the regular stubs in branches used today,
so this is not needed anymore.

Bug: 399365344
Test: atest
Change-Id: Ica7df0c5c9be39d9dca49e0114711a7c43125c3d

Remi NGUYEN VAN   authored and   Paul Duffin   commited 2025-02-28 10:47:40 +00:00
df5441508e
Merge "Revert "Add SkipNativeNetworkCreation flag in NetworkAgentConfig"" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-02-26 03:02:34 -08:00
689297411a
Revert "Add SkipNativeNetworkCreation flag in NetworkAgentConfig"
This reverts commit fef111ce47.

Reason for revert: Replaced by early native network creation

Change-Id: I692f716d8651badf6d0037e55a2385d0fb0049d1

Junyu Lai   authored and   Gerrit Code Review   commited 2025-02-26 01:30:20 -08:00
b04a8048a1
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
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
Delete unused createTapInterface method
Test: TH
Change-Id: Ia273344ffa26feec78e400e2df3e890081a15a23

Patrick Rohr   commited 2025-02-24 09:19:44 -08:00
95d7f5b56b
Delete unused createTapInterface method
Test: TH
Change-Id: Iab107c5804204295e714775b3b026a8e64795378

Patrick Rohr   commited 2025-02-24 09:19:44 -08:00
d14f094e12
Replace createTapInterface() with new Builder API
Test: TH
Change-Id: I5d5bcafb2b91dd31b7d2aa71f62279ab79d971bf

Patrick Rohr   commited 2025-02-24 09:19:44 -08:00
2bef486f76
Replace createTapInterface() call with new Builder API
Test: TH
Change-Id: I0d96bfa39a378a8dcc03c2366c332ae5eb8e69d6

Patrick Rohr   commited 2025-02-24 09:19:44 -08:00
f8471445dc
Add configuration object and builder for creating tun/tap interfaces
This change is finally (!) adding a builder class for creating tun/tap
interfaces for testing.

The various create*Interface() methods which are not marked as
@SystemApi can be removed after moving existing tests over to the new
API.

Bug: 237694424
Test: TH
Change-Id: I10eff755ebda4e2ef2550a50a3bfd1543a21e5b0

Patrick Rohr   commited 2025-02-21 13:56:02 -08:00
fe058c60b4
Update lnp app compat to be enabled after cur development version
Bug: 376030323
Test: atest CtsNetTestCases

Change-Id: I7345ac2a08d21d1226ff8607ce1edf44f0946859

Jacque Li   commited 2025-02-19 08:40:49 -08:00
8331a79292
Revert https://r.android.com/3477936
The CL has caused a memory regression in the Zygote, See: b/396156852

Test: Compile
Bug: 396156852
Change-Id: I0ca4cd430a6537d689a1b04739656afc84c43ce1

Mohannad Farrag   commited 2025-02-18 18:32:23 +00:00
e0b119773c
Merge "Add metric to HttpEngine preload" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2025-02-11 15:13:22 -08:00
02574fa4dc
Adding access methods for local_net_access_map and
local_net_blocked_uid_map

Test: Manually tested this using dumpsys commands
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.BpfNetMapsTest
Bug: 392855578

Change-Id: I61522f3282aa502f20641d3c2692a66638edf706

Sarup Dalwani   authored and   Jacque Li   commited 2025-02-07 15:10:49 -05:00
448eb43f28
Add metric to HttpEngine preload
See the other CLs in the same topic for the details.

Test: See other CL
Bug: 380349437
Change-Id: I4b936e3d834462bba5a368d6dd1a1e262c17f0c9

Mohannad Farrag   commited 2025-02-06 15:27:57 +00:00
b09cd9e50c
Merge "Add toString to L2capNetworkSpecifier" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2025-01-15 17:46:18 -08:00
074b213907
Disallow legacy tether() API starting in B
As part of the major tethering refactor to associate every IpServer with
a TetheringRequest, tether()/untether() APIs should be completely
removed in B and all tethering should go through startTethering() (with
the exception of Wifi LOHS and Wifi P2P, which will move to
startTethering() in a future CL).

Bug: 216524590
Test: atest CtsTetheringTests TetheringTests

Change-Id: If7981f1ee7d80ff0a1cc0069ba7a4ebf79144160

Quang Anh Luong   commited 2025-01-15 08:59:42 +09:00
30d8a25db3
Add toString to L2capNetworkSpecifier
Test: TH
Change-Id: Ie874fe7e54990e9dc94fe8e4a28034b5ec2a1bd4

Patrick Rohr   commited 2025-01-13 13:57:20 -08:00
080c91309f
Implement matching semantics for L2capNetworkSpecifier
A server network is created by using ConnectivityManger#reserveNetwork,
in which the app passes a specifier that sets:

reservationRequest = {
    role = server
    headerCompression = 6lowpan
    remoteAddr = any (null)
    psm = any
}

This specifier must subsequently match the blanket reservation offer,
and the reserved offer that is generated as a response:

blanketOffer = {
    role = server
    headerCompression = any
    remoteAddr = any (null)
    psm = any
}

reservedOffer = {
    role = server
    headerCompression = 6lowpan
    remoteAddr = any (null)
    psm = 0x81
}

And not the client network offer or a client network:

clientOffer = {
    role = client
    headerCompression = any
    remoteAddr = any (null)
    psm = any
}

clientNetwork = {
    role = client
    headerCompression = 6lowpan
    remoteAddr = 01:02:03:04:05:06
    psm = 0x81
}

Similarly the client request must match both the clientOffer and
clientNetweork, but not the reservedOffer (and technically
blanketOffer):

clientRequest = {
    role = client
    headerCompression = 6lowpan
    remoteAddr = 01:02:03:04:05:06
    psm = 0x81
}

Note, a request for TRANSPORT_BLUETOOTH with no specifier matches *any*
specifier per specifier matching semantics in NetworkCapabilities.

Test: L2capNetworkSpecifierTest
Change-Id: Ia16926b463a54530ae6e88278466e92ed82bf852

Patrick Rohr   commited 2025-01-10 14:46:54 -08:00
74a8f475b2
Do not allow L2CAP specifier with ROLE_SERVER and remote address set
This is an invalid combination that never seems useful. Note that this
still allows ROLE_ANY in combination with a remote address. This still
doesn't seem particularly useful, but there is no good reason to
disallow it.

Test: TH
Change-Id: Ib0b7284cb99ee92f14113f8184af978eeb2318e7

Patrick Rohr   commited 2025-01-10 08:57:03 -08:00
5e61925e51
Do not redact PSM from L2capNetworkSpecifier
Per discussion on aosp/3429160.

"It doesn't look like knowing the PSM of an L2CAP network would give
other apps any sort of useful information. They don't have the MAC, and
there are only 128 ephemeral PSM values anyway."

Test: TH
Change-Id: Ia81c97dd2e31611fd2d13d5899390fc0c67b6c0f

Patrick Rohr   commited 2025-01-08 15:57:47 -08:00
7faa0b486c