Commit graph

107,362 commits

Message SHA1
Use MANAGE_USERS permission to check for admin user
The current implementation uses MANAGE_USERS, CREATE_USERS, or
QUERY_USERS to check if the user is an admin. However,
QUERY_USERS is not a privileged permission until Android U.
This can cause issues on devices running older Android versions
(e.g., T) where the tethering module requires this check but
doesn't have the necessary permission, leading to crashes.

This change updates the code to use MANAGE_USERS, a privileged
permission since 2015, to reliably determine if the user is
an admin across different Android versions.

Test: Manual on T device:
      1. Mock entitlement and enable hotspot
      2. Check granted permissions of android.uid.networkstack
Fix: 366816004
Change-Id: Iee060f0225d23c62d836f0211c63b649e539f77b

Junyu Lai   commited 2024-10-28 17:31:22 +08:00
f014ae2f2a
Introduce dependencies object for EntitlementManager
This is a no-op refactoring which only introduce
dependencies object injection to replace the wrapper class.

Test: atest TetheringTests:EntitlementManagerTest
Fix: 363972541
Change-Id: I24b0bf5f8951c453af1e9ae9278285d1a7b86849

Junyu Lai   commited 2024-10-21 10:22:48 +08:00
1193f08d69
Improved Entitlement UI Launch for multiple admin users
This change addresses the launch of entitlement UI activities
in Headless System User Mode (HSUM) on multi-user devices.

HSUM is a configuration where the system user (user 0) does
not represent a human user and primarily runs system services.
In this mode, the first user set up on the device is not user 0.

Modified the EntitlementManager logic to handle the
launch of the entitlement UI in multi-user environments,
specifically addressing scenarios where HSUM is enabled, which
includes:
  1. Always launch the UI to the foreground current user.
  2. Check whether the current user is allowed to show the UI.
This ensures the UI is presented to the appropriate user.

Test: Manual
  1. Mock requires entitlement
  2. adb shell cmd user set-system-user-mode-emulation headless
  3. enable hotspot
Test: atest TetheringTests:EntitlementManagerTest
Fix: 363972541

Change-Id: I950d678741a3f1714f347206fa161bcd7538b402

Junyu Lai   commited 2024-10-21 10:22:42 +08:00
b4a92ff791
Delete empty directory
Test: n/a
Change-Id: Iad6d6c0ab0319f9c4a05d9e120ac70d5168b07cb

Patrick Rohr   commited 2024-09-30 11:21:08 -07:00
2afd53948f
Merge "Support get multiple ipv4/ipv6 addresses in apf_utils" into main
Jimi Chen   authored and   Gerrit Code Review   commited 2024-09-30 02:28:06 +00:00
09f39d2c52
Merge changes from topic "thread-epskc" into main
* changes:
  [Thread] Add unit test for ephemeral key API
  [Thread] support ephemeral key API in ThreadNetworkControllerService
  [Thread][API] add API for ephemeral key.

Yang Sun   authored and   Gerrit Code Review   commited 2024-09-29 06:09:43 +00:00
f5a4adb341
Merge changes from topic "pac-random-address" into main
* changes:
  Drastically simplify prefix and address selection process
  Simplify getSanitizedSubAddr to 1-liner
  Rename getStartedPrefixIndex to getRandomPrefixIndex
  Remove unused imports

Treehugger Robot   authored and   Gerrit Code Review   commited 2024-09-29 04:25:22 +00:00
76b4a63ec1
[Thread] Add unit test for ephemeral key API
Bug: 348323600

Test: atest ThreadNetworkUnitTests
Change-Id: I8148b20b02010d57020b2d5d2eb9a3e79e68b10f

Yang Sun   commited 2024-09-29 02:35:51 +00:00
018f163cc9
[Thread] support ephemeral key API in ThreadNetworkControllerService
Bug: 348323600

Test: atest CtsThreadNetworkTestCases
Change-Id: Ic8cae057f1bc8e631e47cfc1afba59b09bf0b35f

Yang Sun   commited 2024-09-29 02:35:51 +00:00
a591d0432b
[Thread][API] add API for ephemeral key.
This CL adds the API for starting/stopping the ephemeral key mode, and
subscribing to the ephemeral key state changes.

Ephemeral key mode is started with a limit amount of time to allow
Thread credential sharing.

Bug: 348323500
Test: atest CtsThreadNetworkTestCases
Change-Id: I540c88ec4668291358fbe87a678d8f9d31a67e54

Yang Sun   commited 2024-09-29 02:35:44 +00:00
b8aa8bb47f
Drastically simplify prefix and address selection process
This removes all the complex downstream prefix / address selection
logic and reduces it to generating a random address within the selected
prefix and checking whether it satisfies a set of conditions. If the
conditions are not met, the process is retried (for a total of 10 times)
before eventually moving on to the next prefix.

The conditions that must be satisfied are:
- Address within prefix does not end in .0, .1, .255
- Address is not contained within a range of commonly used prefixes.
- Prefix does not overlap with another prefix on the system.

Test: TH
Change-Id: I4c53bcaa29c11cde4df99d5bcb834fde94961da4

Patrick Rohr   commited 2024-09-27 20:47:13 -07:00
b9cfcce30a
Merge "KernelUtils.h: add 6.12 to isLtsKernel()." into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-09-27 22:46:19 +00:00
ad5fa93c30
Merge "Prefer framework-annotations-lib dependency" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-09-27 19:48:21 +00:00
acdd45dd3c
Simplify getSanitizedSubAddr to 1-liner
This assumes that PREFIX_LENGTH is 24. The change also adds a warning to
make sure PREFIX_LENGTH is not updated without updating
chooseDownstreamAddress.

Test: TH
Change-Id: I96a7f8bf273d69ed27320f9c6f5af4fd41f7097d

Patrick Rohr   commited 2024-09-27 12:19:02 -07:00
b1280c0467
Prefer framework-annotations-lib dependency
Rather than bundling a copy of the framework annotations, reference them
via framework-annotations-lib as a libs reference. This ensures the
target inherits any necessary keep rule configurations, and is the same
pattern used by other mainline modules.

Bug: 275175207
Test: m
Flag: EXEMPT refactor
Change-Id: I014aa79f4fec69aef062a2fb855a50f658380ac5

Jared Duke   commited 2024-09-27 18:41:54 +00:00
dff99282e8
Merge "bpf: git mv DnsResolver bpf/dns_helper" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-09-27 18:40:19 +00:00
57f7eecafd
KernelUtils.h: add 6.12 to isLtsKernel().
6.12 is virtually certain to release in the second half of November:

2024-09-15 - 6.11 release
2024-09-22 - merge window
2024-09-29 - 6.12-rc1
2024-10-06 - 6.12-rc2
2024-10-13 - 6.12-rc3
2024-10-20 - 6.12-rc4
2024-10-27 - 6.12-rc5
2024-11-03 - 6.12-rc6
2024-11-10 - 6.12-rc7 or 6.12
2024-11-16 - 6.12-rc8 or 6.12
2024-11-23 - 6.12-rc9 or 6.12
2024-11-30 - 6.12

This means it *will* be the last Linus kernel of the year.
Hence it is almost certainly going to be the LTS for 2024.

Thus the next Android OS release will drop support for 4.19
and add support for 6.12.

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

Maciej Żenczykowski   commited 2024-09-27 17:12:56 +00:00
7f5b601864
Rename getStartedPrefixIndex to getRandomPrefixIndex
Test: builds
Change-Id: I38bba24dd0a1053e3795495cfdc14c9960056ffc

Patrick Rohr   commited 2024-09-27 10:05:31 -07:00
65bf46db67
Remove unused imports
Test: TH
Change-Id: Ifd3881133e11f303da03b85d845361f00a0fe198

Patrick Rohr   commited 2024-09-27 10:05:31 -07:00
f77127509e
Merge "PrivateAddress: Clarify the dependency" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-09-27 15:27:45 +00:00
d3d8456d15
PrivateAddress: Clarify the dependency
The dependency of PrivateAddressCoordinator on Context is too generic.
Actually it just needs the ConnectivityManager#getAllNetworks.

This CL clarifies the dependency and this provides flexibility of
instantiation of the class.

Bug: 369282577

Change-Id: I49043f7f557d83856d54cefc201208b7d9b9dd7f

Handa Wang   commited 2024-09-27 13:56:16 +00:00
1cda02fd4a
Support get multiple ipv4/ipv6 addresses in apf_utils
Test: atest NetworkStaticLibHostPythonTests
Change-Id: I806696437acf905c049762d59a46c866ff0584ef

Jimi Chen   commited 2024-09-27 06:55:54 +00:00
738bf999d5
Merge "Fix the test flake in testRemoveServicesAfterSocketDestroyed" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-09-27 06:31:38 +00:00
8a0613cc9e
bpf: git mv DnsResolver bpf/dns_helper
This is entirely bpf specific logic for the dns_helper.so
shared library.  Let's put it under bpf/ so it can be covered
by bpf source hash logic and used by UML NetBpfLoad test.

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

Maciej Żenczykowski   commited 2024-09-27 02:06:05 +00:00
2bb5b7ebee
Mark Martin as LAST_RESORT_SUGGESTION
Change-Id: I3603ca8dd599e3ab472a44e3fc102aa5ec056b87

Patrick Rohr   commited 2024-09-26 22:29:48 +00:00
77f5e9af1a
Mark Sat as LAST_RESORT_SUGGESTION
Change-Id: Ib33d06183710d54849423605c9ee1131f1ccfe15
Test: n/a

Patrick Rohr   commited 2024-09-26 22:23:36 +00:00
f926010f90
Merge "Revert "Use unicast instead of broadcast as ethernet destination in test_apf_drop_ethercat"" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2024-09-26 18:12:15 +00:00
b437e753f7
Revert "Use unicast instead of broadcast as ethernet destination in test_apf_drop_ethercat"
This reverts commit 46102348e0.

Reason for revert: mistakenly submitted.

Change-Id: I6072a9828a8cc0633ca35ea2ecf7707f2b3573a1

Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2024-09-26 18:11:41 +00:00
c3eccf9ef4
Merge "NetBpfLoad: don't allow prog-less bpf .o's targetting platform bpfloader" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-09-26 17:04:56 +00:00
7e59e5de3a
Merge "Add link-related methods at NetlinkUtils" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-09-26 09:47:31 +00:00
842fb52fef
Add link-related methods at NetlinkUtils
This CL adds static methods at NetlinkUtils class that send the
netlink message to kernel to configure the network interface up or down,
rename the interface, and query the interface.

Bug: 364501824
Test: NetworkStackIntegrationTests:android.net.ip.IpClientSignatureTest

Change-Id: Ie545a6617adff2601f405df01dea9edd59952a53

Chih-Yu Huang   commited 2024-09-26 15:08:31 +09:00
a7fc900db7
Fix the test flake in testRemoveServicesAfterSocketDestroyed
The removeServices() is running on a different handler, which
might take some time to complete. Therefore, the verification
should include a timeout to wait longer and prevent test flake.

Bug: 367429622
Test: atest MdnsDiscoveryManagerTests#testRemoveServicesAfter\
      SocketDestroyed --iteration
Change-Id: I79626bad680a62993c3e7d6b356acc10755257e3

Paul Hu   commited 2024-09-26 05:56:28 +00:00
78bd66003a
Merge "PrivateAddressCoordinator: remove the dependency on TetheringConfiguration" into main
Handa Wang   authored and   Gerrit Code Review   commited 2024-09-26 03:42:32 +00:00
ccad05f060
NetBpfLoad: don't allow prog-less bpf .o's targetting platform bpfloader
Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I0360c8bb7486b3ed125c0fd0d40b4b8d97bfb3e3

Maciej Żenczykowski   commited 2024-09-25 22:17:34 +00:00
2d52f8c139
Merge "Use unicast instead of broadcast as ethernet destination in test_apf_drop_ethercat" into main
Maciej Żenczykowski   authored and   Gerrit Code Review   commited 2024-09-25 21:02:35 +00:00
aabad69006
Use unicast instead of broadcast as ethernet destination in test_apf_drop_ethercat
To prevent packet dropped earlier by multicast filtering,
use unicast ethernet destination instead

Bug: 360730207
Test: m connectivity_multi_devices_snippet && atest CtsConnectivityMultiDevicesTestCases:ApfV4Test
Change-Id: I4816b71f68f349abf1423c7013bb058ccc233d61

Jimi Chen   authored and   Maciej Żenczykowski   commited 2024-09-25 19:42:01 +00:00
46102348e0
Merge "Add createGetLinkMessage() at RtNetlinkLinkMessage" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-09-25 11:55:40 +00:00
1a9758e5a2
PrivateAddressCoordinator: remove the dependency on
TetheringConfiguration

We're removing the dependency on TetheringConfiguration because
TetheringConfiguration is not parcelable so it cannot be used in AIDL
API. Eventually we'll make PrivateAddressCoordinator expose its
functionalities via AIDL API at RoutingCoordinator.

Bug: 369282577
Change-Id: Id839d183b9463baa18a92a629370b4b8374f1ffd

Handa Wang   commited 2024-09-25 09:01:38 +00:00
664e1f4b89
Add createGetLinkMessage() at RtNetlinkLinkMessage
This CL adds the createGetLinkMessage() method at the
RtNetlinkLinkMessage class, that creates a link message to get the
information of a interface. The functionality is the same as
"ip link show $interface".

Bug: 364501824
Test: atest NetworkStaticLibTests

Change-Id: I87a120f488e5b6f7f24c663c68ba26835fa2157a

Chih-Yu Huang   commited 2024-09-25 17:16:24 +09:00
f0bcd6f4d6
Merge "PrivateAddressCoordinator: get rid of UpstreamNetworkState for updateUpstreamPrefix()" into main
Handa Wang   authored and   Gerrit Code Review   commited 2024-09-25 00:58:45 +00:00
28617443d2
Merge "Add persist.bluetooth.finder.supported property" into main
Yahav Nussbaum   authored and   Gerrit Code Review   commited 2024-09-24 19:43:03 +00:00
454a93e9c4
Merge "Add get ipv4/ipv6 address function to apf_utils" into main
Jimi Chen   authored and   Gerrit Code Review   commited 2024-09-24 13:38:54 +00:00
a0d22134b1
Merge "Add packet_utils for multi-devices tests" into main
Jimi Chen   authored and   Gerrit Code Review   commited 2024-09-24 13:38:44 +00:00
df2eadce09
PrivateAddressCoordinator: get rid of UpstreamNetworkState for
updateUpstreamPrefix()

This CL changes the signature of
PrivateAddressCoordinator#updateUpstreamPrefix to replace the
UpstreamNetworkState parameter with its member class. This is because we
want to make updateUpstreamPrefix() an AIDL API soon and
UpstreamNetworkState is not parcelable while its member fields are.

Bug: 369282577

Change-Id: Icf71d02d48c8c0d5dc2b21ee351efba956b6752d

Handa Wang   commited 2024-09-24 12:15:45 +00:00
8df9d34eb3
Merge "Add current state to unhandled message error log" into main
Patrick Rohr   authored and   Gerrit Code Review   commited 2024-09-24 03:10:55 +00:00
46a5123374
Merge "Remove load_bpf_programs trigger (moving to system/core)" into main
Treehugger Robot   authored and   Gerrit Code Review   commited 2024-09-24 01:49:11 +00:00
b0e0f62a2c
Merge changes I2368f118,I57eb7c6d,I66e4e537,If510519b,Ia441170c into main
* changes:
  Skip testRouterSolicitations on T- devices.
  Remove CtsHostsideNetworkTestAppNext.
  Set all hostside network tests apps' target SDK to 10000.
  Consolidate defaults for hostside network tests apps.
  Stop depending on shims in CtsHostsideNetworkTests.

Lorenzo Colitti   authored and   Gerrit Code Review   commited 2024-09-23 23:53:02 +00:00
daab4db187
Add current state to unhandled message error log
Note that I am not certain whether (nullable) mCurrentState can be null
in the given context, though checking for it seems safest.

Test: TH
Change-Id: I8f6f3e060efab775a4ecc9fe92333aa62dbde5ec

Patrick Rohr   commited 2024-09-23 22:26:02 +00:00
3baeb73304
Remove load_bpf_programs trigger (moving to system/core)
Note: this is a no-op for mainline as this file is built into platform,
and not into the tethering apex mainline module.

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

Maciej Żenczykowski   commited 2024-09-23 21:27:37 +00:00
3664aa8b0c
bpf: promote inet_release hook from V+ 5.10+ to T+ 5.10+
will land in M-2025-01

should fix some long standing cookie_tag_map full issues
(due to the userspace socket destroy listener code failing to run - likely due to buffer overflow)

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

Maciej Żenczykowski   commited 2024-09-23 20:21:40 +00:00
6e94583641