Commit graph android_packages_modules_Co.../framework
Message SHA1
Merge "Prepare to move VCN: Add visibilities for tests" into main
Yan Yan   authored and   Android (Google) Code Review   commited 2025-07-15 13:09:27 -07:00
a5b6808587
Revert^2 "Implement opt-in to custom tabs in captive portals."
This reverts commit 5177b0b6b4.

Reason for revert: try again

Change-Id: I2832861643e4c5ab41b5d857e210f1fd9bf62a69

Yuyang Huang   authored and   Android (Google) Code Review   commited 2025-07-13 23:47:42 -07:00
569563cb08
Revert "Implement opt-in to custom tabs in captive portals."
This reverts commit f2cb190a73.

Reason for revert: This is the integration test CL, it will break due to ag/34545776 reverted.

Change-Id: I5fc66fab409989479078dfcffea7793b9d6dd749

Yuyang Huang   authored and   Android (Google) Code Review   commited 2025-07-13 22:23:21 -07:00
5177b0b6b4
Implement opt-in to custom tabs in captive portals.
This will allow portal operators to opt-in to custom tabs in
captive portal, either across the board with "true" or with
a version of the module above which it wants to opt-in.

Ideally there could be a separate key to also list opted-in
browsers and their versions, but this would become a lot
more complex. To start with, there is no place in
CaptivePortalData to store this kind of info, and that would
mean adding API which would have to be supported forever.

The constant inside the source represents a capport source that
contains the custom tabs opt-in. This is not a great place to put
this information in, but it has the characteristics of a benign and
useful hack :
- Time to market is 0
- It's easy to remove once we have a better API
- It's not a large problem if it's never cleaned up

Also, allowing to choose the browsers and the versions would
be uncomfortable since the choice of the browser is the user's
choice. On the one hand it does make some sense that the
operator could test with a given browser, see the UX is not
well adapted, and reject it, but on the other hand giving the
operator the choice of what browser the user can choose to
use on their portal is disputable, as this should generally be
under the control of the user.

In any case even if we decided to add a per-browser version
check it should be done in some other change.

Test: manual
Flag: EXEMPT opt-in feature
Change-Id: I540f4fcb6fb26f7f18077d9c8d06e5f7df206056

Chalard Jean   commited 2025-07-11 15:03:51 +09:00
f2cb190a73
Prepare to move VCN: Add visibilities for tests
Before moving VCN code, add the new code locations to the
"visibility" fields of Connectivity dependencies.

Bug: 379938062
Flag: EXEMPT; visibility changes
Test: presubmit
Change-Id: I51becaacb93d5e43b8b8234b80cb9b272181ad01

Yan Yan   commited 2025-07-10 20:47:00 +00:00
e82942e7c5
Merge changes from topic "avoid-bad-wifi-api-update" into main
* changes:
  Enable per-subId 'avoid bad Wi-Fi' setting storage
  Use ConnectivitySettingsManager API for avoid bad Wi-Fi updates

Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-06-20 00:42:48 -07:00
553054fcee
Enable per-subId 'avoid bad Wi-Fi' setting storage
Breaks out the `network_carrier_aware_avoid_bad_wifi` setting from a single
string key into individual `Global.Settings` entries per subscription ID.

Flag: EXEMPT mainline
Bug: 424330991
Test: atest ConnectivityCoverageTests:android.net.connectivity.android.net.ConnectivitySettingsManagerTest
Change-Id: Ida673c1b8b915719b8e64ea85a66c2b98862e5f5

Jimi Chen   commited 2025-06-19 11:30:06 +00:00
1bfe086299
Merge "Allow VCN network to beat a physical cell in network ranking" into main
Yan Yan   authored and   Android (Google) Code Review   commited 2025-06-17 11:09:54 -07:00
7b1145e6b4
Allow VCN network to beat a physical cell in network ranking
This patch adds a new POLICY to identify a VCN network offer, and
updates NetworkRanker to allow a VCN network to win over a physical
cell network. This is to fix the issue where VCN cannot exit safe
mode when there is already a phsical cell

Bug: 391977557
Test: NetworkRankerTest(new test)
Flag: EXEMPT bugfix
Change-Id: I00ebeb3eeb30ca8b46d25bbde1b6fd3dfee53993

Yan Yan   commited 2025-06-17 01:30:07 +00:00
6eab1d0af3
Merge "Improve annotation and javadoc for set/getTransportType APIs" into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-06-12 04:34:11 -07:00
da3cfacbf6
Improve annotation and javadoc for set/getTransportType APIs
This change address api council review feedback for ag/33705589,
which includes:
  1. Mirror `@Transport` annotation in NetworkCapabilities to
     the NetworkTemplate class, because such annotation is
     not visible to NetworkTemplate class.
  2. Add @Transport annotation for the APIs.
  3. Add @throws in the javadoc.

Flag: com.android.net.flags.netstats_transport_type
Test: m
Fix: 424088371
Change-Id: I2c3ed5e1abc6d647bbb5af99446e3d75ed167f05

Junyu Lai   commited 2025-06-12 14:03:04 +08:00
c5f7cf21b5
Introduce carrier-aware avoid bad Wi-Fi APIs
This commit introduces new system APIs to manage "avoid bad Wi-Fi" settings,
leveraging both global system settings and carrier configurations. This
enhancement allows for more granular control and visibility into how Wi-Fi
networks are managed, especially in multi-SIM environments.

The new `setNetworkAvoidBadWifi(Context, int subId)` method provides
the ability to programmatically control this setting based on carrier-specific
policies or user preferences. This complements `getNetworkAvoidBadWifi(Context, int subId)`,
which allows querying the setting for a specific subscription ID, ensuring the
system can accurately determine the avoid bad Wi-Fi status.

Additionally, `shouldShowAvoidBadWifiToggle(Context, int subId)` is introduced.
This method determines whether the 'Avoid Bad Wi-Fi' user interface toggle
should be displayed. It considers both global settings and carrier configurations,
allowing for dynamic UI adjustments based on carrier requirements or user preferences.

These changes provide greater flexibility for managing Wi-Fi network selection
and improve the user experience by offering more context-aware control over
cellular behavior.

Deprecated APIs:
- `setNetworkAvoidBadWifi(Context, int value)`
- `getNetworkAvoidBadWifi(Context)`
New APIs:
- `setNetworkAvoidBadWifi(Context, int subId, int value)`
- `getNetworkAvoidBadWifi(Context, int subId)`
- `shouldShowAvoidBadWifiToggle(Context, int subId)`

Flag: com.android.net.flags.carrier_aware_avoid_bad_wifi
Bug: 410976315
Test: atest ConnectivityCoverageTests:android.net.connectivity.android.net.ConnectivitySettingsManagerTest
Change-Id: I79469cfe865a585593219d226c8198206c06b589

Jimi Chen   commited 2025-06-10 12:18:35 +00:00
92e23acebb
Merge "Add NetworkCapabilities transport types into NetworkIdentity." into main
Treehugger Robot   authored and   Android (Google) Code Review   commited 2025-05-27 00:41:35 -07:00
2a4acb194c
Fix NetworkAgent 4-way binder interlock
System server        |    Client (e.g. phone)
------------------------------|-----------------------------
                              |
NetworkAgentMessageHandler ←--|--- INetworkAgentRegistry
              ↓               |              ↑
                              |         NetworkAgent
        NetworkAgentInfo      |              ↑
              ↓               |      NetworkAgentHandler
                              |              ↑
         INetworkAgent     ---|--→   NetworkAgentBinder

The simplest artifact is observed by watching the output of
adb shell dumpsys meminfo -d phone | grep 'Proxy Binders'
while turning airplane mode on and off (slowly, to allow the
cell network to connect and disconnect).
This will display the number of binder proxies. Before this, the binder
proxy count increases by 2 with each connection and never goes down (there
is some noise, as proxy objects are sometimes created for other reasons,
and get GC'd eventually). After this, the binder proxy count is always
eventually stable.

Also see b/133174607.

Bug: 400358935
Flag: EXEMPT bugfix
Test: manual, also regression test on the way
Change-Id: I1dcdaec1f3bd42bc2a406c9e9318208f96266bd6

Chalard Jean   commited 2025-05-26 11:16:51 +09:00
75349105d1
Add NetworkCapabilities transport types into NetworkIdentity.
This change updates NetworkIdentity to have NetworkCapabilities
transport types for improved network identification, and updates
NetworkIdentitySet for backward compatibility with older data.

Flag: EXEMPT implemented in the counter-part CL
Test: atest ConnectivityCoverageTests --test-filter \
      'NetworkIdentity*' --update-device
Test: atest ConnectivityCoverageTests --test-filter \
      'NetworkStats*' --update-device
Bug: 419123367
Change-Id: I26cc770d90b4687d832dd029d9a11db03404db39

Junyu Lai   commited 2025-05-24 00:30:41 +08:00
bebd4090ae
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