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
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
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
* changes:
[Thread] Add unit test for ephemeral key API
[Thread] support ephemeral key API in ThreadNetworkControllerService
[Thread][API] add API for ephemeral key.
Yang Sunauthored and Gerrit Code Reviewcommited 2024-09-29 06:09:43 +00:00
* changes:
Drastically simplify prefix and address selection process
Simplify getSanitizedSubAddr to 1-liner
Rename getStartedPrefixIndex to getRandomPrefixIndex
Remove unused imports
Treehugger Robotauthored and Gerrit Code Reviewcommited 2024-09-29 04:25:22 +00:00
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
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
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
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
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 Żenczykowskicommited 2024-09-27 17:12:56 +00:00
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
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 Żenczykowskicommited 2024-09-27 02:06:05 +00:00
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
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
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
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
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
* 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 Colittiauthored and Gerrit Code Reviewcommited 2024-09-23 23:53:02 +00:00
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
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 Żenczykowskicommited 2024-09-23 21:27:37 +00:00
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 Żenczykowskicommited 2024-09-23 20:21:40 +00:00