Commit graph android_packages_modules_Co.../service/src/com/android/server
Message SHA1
Support Satellite Network Preferred uid's multi layer request
- Implement handleSetSatelliteNetworkPreference() at ConnectivityService
  to create multi layer request with preference order
  PREFERENCE_ORDER_SATELLITE_FALLBACK.
- unit test coverage

Bug: 320514105
Test: m and atest FrameworksNetTests
Change-Id: I3f71104f8c3c998599eaab71ae4076985f4bed77

Nagendra Prasad Nagarle Basavaraju   commited 2024-02-07 16:16:42 +00:00
804aa2326d
Add SatelliteAccessController class to support messaging on Satellite Internet
- create SatelliteAccessController class to identify role sms and
  satellite communication enabled uid's, to keep track of role changes
  through OnRoleHoldersChangedListener and to request to create
  multi layer request to ConnectivityService.
- unit test coverage

Bug: 320514105
Test: m and atest FrameworksNetTests
Change-Id: I95086f7a4fd6fe1261f432e605d792204ff5310b

Nagendra Prasad Nagarle Basavaraju   commited 2024-02-07 16:10:20 +00:00
33c7da3661
Support bringing up restricted wifi
This CL allows the Carrier Config app to request restricted WiFi nework
by setting the correspoding subscription ID in the network request.

Bug: 315835605
Test: atest android.net.cts.NetworkRequestTest
      atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.connectivity.CarrierPrivilegeAuthenticatorTest
      atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest

Change-Id: I237e692d092ff5f969ce4b7962f6d58099a6f3a9

Ying Xu   commited 2024-02-07 04:24:38 -08:00
7cabd32bc5
Merge "Rename check*Permission* to has*Permission" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2024-02-02 07:07:31 +00:00
ef58a8a33a
Merge "Increase max metrics duration deviation to 2 hours" into main
Hansen Kurli   authored and   Gerrit Code Review   commited 2024-02-02 05:29:54 +00:00
84cc4e507e
Rename check*Permission* to has*Permission
The check*Permission methods are a bit error-prone because people
can forget to check the return value and expect that they behave
like the enforce* methods. This was pointed out before in some bugs.

This change adds @CheckResult annotation to enforce linter warning
and rename methods accordingly.

Test: TH
Fix: 279691948
Change-Id: Ibb0df6540fe0ed40289bb190b790130daaa2f763

Junyu Lai   commited 2024-02-01 15:24:35 +08:00
71b5153898
Increase max metrics duration deviation to 2 hours
A lot of WTF logs reported were barely 1 second over the 1 hour
limit. AlarmManager has a maximum window of 1 hour so these cases
are possible and expected.
Increase the max metrics duration deviation to 2 hours to avoid
this log.

Bug: 297292877
Test: Manual test
Change-Id: I9a476e8061944c6499fe1b1d6e9ad1e19e6ce2b9

Hansen Kurli   commited 2024-01-31 20:09:27 +08:00
d85482534c
Bpf: open code PRE_T - too complex for errorprone linter
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I1ad2d0dd288882e84925f0b59961dcd33612f3f7

Maciej Żenczykowski   commited 2024-01-25 16:09:11 -08:00
0d450d3e4d
BpfNetMaps - add RequiresApi(T) annotations
netd.o bpf program was mainlined in T

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I6d2b34e26f5640840b74d4c761b01668e44dc9d6

Maciej Żenczykowski   commited 2024-01-25 15:15:26 -08:00
6b9d921f1c
new BpfMap<> - remove spurious generic type arguments
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic32ccd7c2c415c462c4e1fdc9002cf7858ed587c

Maciej Żenczykowski   commited 2024-01-24 12:15:44 -08:00
3863c094f3
BpfMap - add R/W constructor alias
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I7cef2b19f55e6e056b46bb1b28f85c7f7376f6f4

Maciej Żenczykowski   commited 2024-01-23 16:16:44 -08:00
06155c8040
Add Multicast routing status to dump
Bug: 281217735

Test: adb shell dumpsys connectivity
Change-Id: I0816f8cd1b9bcbcbac3f78f98c499874976cef6d

Yang Sun   commited 2024-01-22 13:37:25 +08:00
ca537d5e25
Merge "Apply multicast routing configs" into main
Yang Sun   authored and   Gerrit Code Review   commited 2024-01-22 00:57:42 +00:00
cc23753288
Merge "Support multicast routing" into main
Yang Sun   authored and   Gerrit Code Review   commited 2024-01-22 00:55:10 +00:00
bcc245d5bf
Apply multicast routing configs
Applies multicast routing configs when they are updated in
LocalNetworkConfig, or when local network/upstream network
status changes.

Bug: 281217735

Test: atest CSLocalAgentTests
Change-Id: Ib1c43c645a367d0f91e5cf0a0d9f8e5883be2c40

Yang Sun   commited 2024-01-20 21:32:20 +08:00
29037f6046
Support multicast routing
Added support to apply multicast routing config between network
interfaces in MulticastRoutingCoordinatorService.

Bug: 281217735

Test: atest FrameworksNetTests:android.net.connectivity.com.android.server.connectivity.MulticastRoutingCoordinatorServiceTest

Change-Id: If608b79d4e62a20d2e01755a83a901f6e274d9a2

Yang Sun   commited 2024-01-20 21:32:11 +08:00
baa50fa478
Remove the UID range check for TCP sockets
The original patch (aosp/2891011) incorrectly counted TCP
sockets with keepalive enabled for VPNs. This issue was
caused by the UID range verification. On bypassable VPNs,
the socket mark is always correct. It's possible for an
app that is not in the UID ranges to establish a socket
on the VPN. But that socket should be counted for the
purposes of keepalive. The old code would correctly count
it and the new code will incorrectly not count it. Also,
the UID range verification does not help on non-bypassable
VPNs since the socket mark is always the mark of default
network, not the socket mark of the VPN.

Instead of reverting the entire patch, this commit
removes the UID range mechanism. The code refactoring from
the original commit (which used structured classes to read
socket information) has been kept as it is a valuable
improvement.

Bug: 320842519
Test: atest FrameworksNetTests
Change-Id: I00731796144c982b9fd4d9771f3d0db1f1529a89

Chiachang Wang   commited 2024-01-19 02:50:35 +00:00
ac2e8f354d
Merge changes Ifafafcd6,I5802dedc into main
* changes:
  Fix incorrect nullability annotations
  Add helper method to enfore a package name belongs to an uid

Junyu Lai   authored and   Gerrit Code Review   commited 2024-01-18 07:35:38 +00:00
fbc97d95bb
Add helper method to enfore a package name belongs to an uid
This is no-op refactor to move utility methods from
ConnectivityService to a common place.

Test: atest NetworkStaticLibTests#com.android.net.moduletests.util.PermissionUtilsTest#testEnforcePackageNameMatchesUid
Bug: N/A
Change-Id: I5802dedcc91fa6e130a5c534bba5080ca37dbeec

Junyu Lai   commited 2024-01-18 11:26:55 +08:00
8fdc4318c7
Implement NetworkRequestsState atom
Bug: 278833398
Test: atest FrameworksNetTests
Change-Id: I95a8c8dddd2d8f6863fe64cd4a65ef48dfb5153a

Danuta Brotikovskaya   commited 2024-01-16 21:50:12 +00:00
878fd25d84
Merge "Revert "Implement NetworkRequestsState atom"" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-01-12 05:18:49 +00:00
a8062d9ed0
Merge "Migrate Tethering#dump to use runWithScissorsForDump" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2024-01-10 09:46:12 +00:00
7b4ebdf2ef
Migrate Tethering#dump to use runWithScissorsForDump
This change includes:
  1. Refactor the logic in Tethering#dump into utils class.
  2. Move the utils class to a common place which could be referenced
     from other sub-modules.
  3. Add @MonitorThreadLeak annotation to enforce
     there is no thread leak problem.

Test: atest FrameworksNetTests NetworkStaticLibTests
Test: atest ConnectivityCoverageTests:com.android.networkstack.tethering.TetheringTest#testDumpTetheringLog
Test: adb shell dumpsys tethering (with hardcoded exception)
Fix: 312669345

Change-Id: Ia6fdfeeec2110afa0ec9e056e9db3843748845c3

Junyu Lai   commited 2024-01-10 13:56:55 +08:00
2ff42d264b
Revert "Implement NetworkRequestsState atom"
This reverts commit e3245081b1.

Reason for revert: The change is unsafe as it introduces code with writings to a separate thread whose message queue size is unlimited.
Test: atest FrameworksNetTests

Change-Id: I392a30f77cfbcd17f420e29f0944604fd789b10a

Danuta Brotikovskaya   commited 2023-12-28 18:19:20 +00:00
2971ffc776
Merge "Change throw to Log.wtf" into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-12-28 01:40:10 +00:00
ab2fd4cac9
Merge "Revert "Rename checkSystemBarServicePermission"" into main
Karl Shaffer   authored and   Gerrit Code Review   commited 2023-12-27 17:22:36 +00:00
ac6a617415
Change throw to Log.wtf
Log.wtf should avoid crashes, while making sure that one can still
notice if there is a problem.

In particular, it may be possible that calling ensureIpServerStopped
and ensureIpServerStarted could start forwarding before the previous
IpServer has stopped it.

Bug: 314260975
Change-Id: I047a673d2fe6f218192d3144fa0bd60ce8739a15
Test: TH

Remi NGUYEN VAN   commited 2023-12-27 19:31:54 +09:00
ca3c524b49
Revert "Rename checkSystemBarServicePermission"
This reverts commit c0baea5406.

Reason for revert: Checking if culprit of b/317506400

Change-Id: Icbe9d993c6d4bfdf305f2a4c7b8422095c8846a6
Bug: 317506400

Chris Göllner   commited 2023-12-26 16:13:51 +00:00
cc9620267e
Merge "Check target sockets by UID range" into main
Chiachang Wang   authored and   Gerrit Code Review   commited 2023-12-26 06:19:17 +00:00
34afa7b73c
Check target sockets by UID range
This commit optimizes the mechanism to examine the TCP sockets
based on the VPN UID range.

The automaticOnOffKeepalives will be paused/resumed by checking
the TCP sockets status on the VPN network. The existing design
considers all UIDs, not the UID ranges for the specific VPN
network. This may lead to an inaccurate judgement to not to
stop the keepalive even when there is no socket on the VPN
network.

This commit is also a part of follow-up work from aosp/2354202
to use structized class to parse the TCP sockets.

Bug: 311119352
Bug: 265877161
Test: atest FrameworksNetTests
Change-Id: I4a6b751cb904b9c18ed1df420cc880ea38022d6a

Chiachang Wang   commited 2023-12-26 05:22:00 +00:00
d8474bb1cf
Merge "Implement NetworkRequestsState atom" into main
Danuta Brotikovskaya   authored and   Gerrit Code Review   commited 2023-12-21 18:02:50 +00:00
0d8a980059
Implement NetworkRequestsState atom
Bug: 278833398
Test: atest FrameworksNetTests
Change-Id: Ie83bf49693411e4c3f629c07d98071505f48c08f

Danuta Brotikovskaya   commited 2023-12-21 15:56:03 +00:00
e3245081b1
Merge "Rename checkSystemBarServicePermission" into main
Quang Luong   authored and   Gerrit Code Review   commited 2023-12-21 04:43:03 +00:00
b8eedd186d
Rename checkSystemBarServicePermission
Rename checkSystemBarServicePermission to checkStatusBarServicePermission to be consistent with the actual permission name.

Bug: 307161342
Change-Id: Ib0d353d33f1fc64d298919c107d3bc6691dc0bfe
Test: build

Quang Luong   commited 2023-12-18 07:31:17 +00:00
c0baea5406
Merge "[BR14] Tracker Data Saver status in ConnectivityService" into main
Junyu Lai   authored and   Gerrit Code Review   commited 2023-12-11 10:09:57 +00:00
5ad399d8c3
Merge "Fix BpfLoaderRcUtils to support IOS_8859_1" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2023-12-08 11:38:55 +00:00
742c476d89
Fix BpfLoaderRcUtils to support IOS_8859_1
Test: TH
Change-Id: Ic53e903f7a971c92793e3360a5d3f53c97c0503b

Yuyang Huang   commited 2023-12-08 15:03:01 +09:00
71a65dc21b
[BR14] Tracker Data Saver status in ConnectivityService
BYPASS_INCLUSIVE_LANGUAGE_REASON=Using public API
Test: atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.CSBpfNetMapsTest
      (on U and V devices respectively)
Bug: 297836825
Fix: 314858283

Change-Id: Ibeac8cd3a33468c6539234255328affc6b3f8ffe

Junyu Lai   commited 2023-12-08 13:54:29 +08:00
38c7503ab5
Merge "Support network slicing permission check in multi-user environment" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2023-12-07 12:32:18 +00:00
38f871c8e0
Revert canSeeAllowedUids for ownerUid
aosp/2405720 allowed network owner uid to see allowed uids
But this breaked old cts.
This CL reverts the behavior for network owner uid.

Bug: 312093253
Bug: 313025186
Bug: 312196228
Test: TH
Change-Id: Iaa732d22f67ecce7678e68bb8b20cec526116dc9

Motomu Utsumi   commited 2023-12-01 00:45:14 +09:00
eb4a1968ef
Merge "Log bpf rc file if it differs from the template files." into main
Yuyang Huang   authored and   Gerrit Code Review   commited 2023-11-30 03:32:56 +00:00
8670809d7f
Log bpf rc file if it differs from the template files.
Check if the bpf loader rc file is differs from the template files when
ConnectivityService starts. Use Log.wtf() to log the file if there is a
diff.

Bug: 312638861
Test: TH
Change-Id: I0b9ed9962ad0954a051a17b01357d04a0e655ff4

Yuyang Huang   commited 2023-11-29 19:58:15 +09:00
41557553f6
Support network slicing permission check in multi-user environment
In multi-user environment, the App might not be installed by system user.
As a result, the ConnectivityService should use the packageManager from
the user's context to be able to read the property correctly.

Bug: 300274339
Test: TH
Change-Id: I5398c95562bcaf5752270b52f38cca1f02698ba1

Yuyang Huang   commited 2023-11-28 16:54:49 +09:00
4c7deee859
Replace useTls with mode in PrivateDnsConfig
In PrivateDnsConfig class, `useTls` is replaced with `mode`.
This CL a corresponding change.

Bug: 240259333
Test: atest ConnectivityCoverageTests
Change-Id: I60c53e52f287fc7fa05543603a62632d934bb2e6

Mike Yu   commited 2023-11-28 07:49:58 +00:00
9738b47758
Merge "Prompt user to add data on mobile portals" into main
Remi NGUYEN VAN   authored and   Gerrit Code Review   commited 2023-11-27 02:45:14 +00:00
5db2089717
Merge "Revert "Prioritize non-slices over slices"" into main
Jean Chalard   authored and   Gerrit Code Review   commited 2023-11-24 02:50:35 +00:00
11162e97c6
Prompt user to add data on mobile portals
On mobile networks it is more likely that the user needs to top up or
get a mobile data subscription, rather than "sign in" as the previous
messaging was suggesting.
Following feedback from interaction designers / UX writers, change the
strings to be more appropriate for the most common use-case.

Bug: 153673376
Test: atest FrameworksNetTests
      manual test on mobile network force-detecting a portal.
Change-Id: I5b4d4a17fd507d8cf3c9863cf23b5fedb258852e

Remi NGUYEN VAN   commited 2023-11-24 11:02:19 +09:00
3f2ff2e3d7
Revert "Prioritize non-slices over slices"
This reverts commit 14499f0119.

Reason for revert: b/312408745

Change-Id: I8b03799fe6e0e256263240909ee7446c178bf508

Jean Chalard   authored and   Gerrit Code Review   commited 2023-11-21 10:25:14 +00:00
6121a7656c
Merge changes I30f8814c,Ifdf67318,If312b8f8 into main
* changes:
  Rename hasCarrierPrivilege... to isCarrierServiceUid...
  Detect discrepancies in subIds
  Allow carrier service UIDs to access their own WiFi networks.

Jean Chalard   authored and   Gerrit Code Review   commited 2023-11-20 06:55:04 +00:00
4a013c47c2
Stop CarrierPrivilegeAuthenticator thread in tests
Bug: 308519360
Test: CarrierPrivilegeAuthenticatorTest
Change-Id: I59164be00a9e1fcced8538537c1dcabd214f2170

Chalard Jean   commited 2023-11-20 14:31:32 +09:00
96ff954464