Skip to content

WifiChipAidlImpl: cache unsupported usable channel query - #4

Open
CeRRiLLo89 wants to merge 6 commits into
crdroidandroid:16.0from
CeRRiLLo89:raphael-wifi-usable-channels-fix
Open

WifiChipAidlImpl: cache unsupported usable channel query#4
CeRRiLLo89 wants to merge 6 commits into
crdroidandroid:16.0from
CeRRiLLo89:raphael-wifi-usable-channels-fix

Conversation

@CeRRiLLo89

@CeRRiLLo89 CeRRiLLo89 commented Jul 31, 2026

Copy link
Copy Markdown

Summary

Cache an explicit ERROR_NOT_SUPPORTED response from the AIDL Wi-Fi HAL for
getUsableChannels().

After the HAL reports that the operation is unsupported, subsequent calls on
the same WifiChipAidlImpl instance return null without repeating the
unsupported Binder transaction.

Problem

The AIDL contract allows getUsableChannels() to return
WifiStatusCode.ERROR_NOT_SUPPORTED.

The current implementation handles that result as a generic
ServiceSpecificException, so later framework queries can repeatedly invoke
an operation which the HAL has already declared unsupported.

This affects compatibility with older vendor Wi-Fi implementations such as
the one used by Xiaomi Mi 9T Pro / Redmi K20 Pro (raphael).

Change

  • Keep usable-channel queries enabled by default.
  • Cache only an explicit ERROR_NOT_SUPPORTED response.
  • Avoid later calls to the unsupported HAL operation for the lifetime of the
    WifiChipAidlImpl instance.
  • Preserve the existing handling for remote, invalid-argument and other
    service-specific errors.
  • Do not cache transient errors such as ERROR_BUSY.

This source change is intentionally narrower than the exact-build binary
workaround currently installed on the affected device.

The installed workaround bypasses the usable-channel query more broadly,
while this pull request first calls the HAL and disables later calls only
after receiving an explicit ERROR_NOT_SUPPORTED result.

Tests

Added unit coverage verifying that:

  • ERROR_NOT_SUPPORTED reaches the HAL once and is then cached.
  • ERROR_BUSY is not cached and the HAL is queried again.

Local validation was completed with the lineage_raphael userdebug target and
a physical Xiaomi Mi 9T Pro / Redmi K20 Pro (raphael) running Android 16 /
crDroid 12.11.

Executed tests:

FrameworksWifiTests:com.android.server.wifi.hal.WifiChipAidlImplTest#testGetUsableChannelsNotSupportedIsCached

FrameworksWifiTests:com.android.server.wifi.hal.WifiChipAidlImplTest#testGetUsableChannelsTransientErrorIsNotCached

Result:

  • FrameworksWifiTests compilation: passed.
  • Instrumentation installation: passed.
  • Tests selected: 2.
  • Passed: 2.
  • Failed: 0.
  • ERROR_NOT_SUPPORTED caching: passed.
  • Transient ERROR_BUSY retry: passed.

The tests use a mocked AIDL HAL. They validate the framework-side behavior but
do not replace runtime validation with the affected vendor HAL.

Validated pull request head:

f157424b04f69f2e258a193dc458c5e20747b055

Device context

Device:

Xiaomi Mi 9T Pro / Redmi K20 Pro
Codename: raphael

Installed build:

crDroid Android 16
v12.11-20260623

An exact-build service-wifi.jar compatibility module is currently installed
and operational on the affected device.

The module remains enabled because the installed official ROM predates this
source change.

Validation status

  • Controlled reproduction on the affected official ROM: completed.
  • Source compilation: completed.
  • Targeted unit tests: completed, 2 passed / 0 failed.
  • Full lineage_raphael userdebug build containing this change: completed.
  • Runtime validation with an official ROM build containing this source change:
    pending.

The complete local ROM build passed compilation, packaging, VINTF and ZIP
integrity checks.

The local ROM package was not installed because it is signed with the AOSP
test key, while the installed official crDroid ROM trusts the crDroid release
key.

The installed exact-build compatibility module remains enabled until an
official ROM build containing this source change is available for controlled
validation.

This pull request is ready for maintainer review.

Runtime validation with an official crDroid build remains pending because the
locally built package is signed with the AOSP test key and cannot be installed
as an update over the installed official release-key build.

The AIDL Wi-Fi HAL may report ERROR_NOT_SUPPORTED for getUsableChannels.

Cache that permanent result for the lifetime of the WifiChipAidlImpl instance to avoid repeated unsupported Binder calls and error logging.

Other service-specific and transient errors continue using the existing handling.
Verify that ERROR_NOT_SUPPORTED is cached after the first
getUsableChannels call.

Also verify that transient service errors such as ERROR_BUSY are not
cached and the HAL is queried again.
Remove trailing whitespace from the usable channel tests.
Remove the remaining whitespace from the blank line between tests.
Restore the original indentation around the existing unit tests.
Restore the expected indentation in the transient error test.
@CeRRiLLo89
CeRRiLLo89 marked this pull request as ready for review August 3, 2026 09:04
@CeRRiLLo89

Copy link
Copy Markdown
Author

Ready for maintainer review.

The affected vendor/framework incompatibility was reproduced on the official
crDroid v12.11-20260623 installation.

Validation completed for the current pull request head:

targeted FrameworksWifiTests: 2 passed / 0 failed;
full lineage_raphael userdebug build: completed;
compilation, packaging, VINTF and ZIP integrity checks: passed;
ERROR_NOT_SUPPORTED is cached;
transient ERROR_BUSY remains retryable.

Runtime validation of a ROM containing the source change remains pending.

The locally built ROM cannot be installed as an update because it is signed
with the AOSP test key, while the installed official crDroid ROM trusts the
crDroid release key. I can validate the change on the affected device when it
is included in an official build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant