Skip to content

fix: handle Android 16 P2P security and hotspot mode switching - #21

Open
TioaChan wants to merge 2 commits into
fython:mainfrom
TioaChan:codex/fix-wifi-p2p-unknown-security
Open

TioaChan wants to merge 2 commits into
fython:mainfrom
TioaChan:codex/fix-wifi-p2p-unknown-security

Conversation

@TioaChan

@TioaChan TioaChan commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Wireless CarPlay has two related startup failures:

  • On some Android 16 devices, a successfully created WPA2-PSK group reports SECURITY_TYPE_UNKNOWN (-1); WheelPlay rejects it and removes the group.
  • After switching from “Wi-Fi Direct” to “Device hotspot” without restarting the app, a reused connection screen can retain the old backend and hotspot credentials. It can consequently start Wi-Fi Direct and trigger Android's hotspot conflict dialog. Changing the mode can also leave the old P2P session running while checking whether the system hotspot is enabled.

Handle UNKNOWN using the same WPA2 assumption already used before API 36, with a diagnostic. Preserve explicit WPA2/WPA3 mappings and rejection of other unsupported values. Adapted from DiPlay #121.

Refresh the persisted transport, hotspot mode, and manual hotspot credentials when an idle connection screen resumes. Recheck startup permissions when the transport changes. Preserve active sessions, teardown, menu edits, and transient permission prompts. Wait for the previous background session to stop before checking and connecting with the newly selected hotspot mode.

Validation:

  • 90 related tests passed; the 10 directly related mode/settings tests were rerun against the final code and passed.
  • The original code failed three regressions covering stale hotspot mode, stale credentials, and old-session cleanup. Tests also cover mode changes in both directions, station Wi-Fi being off, wired-to-wireless permissions, and asynchronous stop completion.
  • API 36 regressions cover UNKNOWN startup/credential preservation, explicit security mappings, and unsupported-value cleanup. The test JVM export enables Robolectric's Android 16 shared-memory implementation.
  • Release lint: 0 errors, 4 existing warnings.
  • Signed arm64 release built, signature/authentication assets/16 KiB alignment verified, and installed over the existing app on Samsung SM-S9280 / Android 16. The installed APK hash matches the local artifact.
  • On Samsung SM-S9280 / Android 16, the reporter confirmed wireless CarPlay works with the UNKNOWN fix. After installing the latest release, switching from Wi-Fi Direct to Device hotspot without restarting the app also succeeded, with no Android prompt asking to turn off the hotspot.

Fixes #20

Android 16 vendor frameworks can return SECURITY_TYPE_UNKNOWN (-1) for
a successfully created WPA2-PSK group. Treat that documented value as
the pre-Android-16 WPA2 assumption instead of tearing down the group
and preventing wireless CarPlay from starting. Preserve explicit
WPA2/WPA3 mappings and reject other unsupported values.

Adapt the UNKNOWN fallback from shihabal3amri/DiPlay#121. Add API 36
regressions for successful startup and credential preservation, explicit
security modes, and cleanup of unsupported values. Export the JDK
FileDescriptor accessor required by Android 16 Robolectric tests.

Validation: 45 related tests passed; release lint has 0 errors and 4
existing warnings; signed arm64 release built and installed. Wireless
CarPlay was confirmed working by the reporter on SM-S9280 / Android 16.

Fixes fython#20

Co-authored-by: Codex <noreply@openai.com>
The singleTask host cached the wireless backend and manual hotspot
credentials from onCreate. Returning from settings before its controller
started could therefore create a Wi-Fi Direct group after the user had
selected Device hotspot, triggering Android's hotspot conflict dialog.
Refresh persisted transport/backend settings on idle resume, and request
startup prerequisites if the transport changed. Preserve active sessions,
in-progress teardown, menu edits and transient permission prompt state.

When applying a different wireless mode, wait for the old background
session to stop before checking the new hotspot state. This releases the
old P2P group even when the system hotspot still needs to be enabled.

Add lifecycle regressions for both mode directions, edited credentials,
station Wi-Fi being off, wired-to-wireless permissions and asynchronous
old-session cleanup. The original code failed the first three regressions.
Related validation: 90 tests passed, with the 10 directly related tests
rerun against the final code; release lint has 0 errors and 4 existing
warnings. Signed arm64 release, authentication assets and 16 KiB alignment
verified.

Co-authored-by: Codex <noreply@openai.com>
@TioaChan TioaChan changed the title fix: handle unknown Wi-Fi P2P security on Android 16 fix: handle Android 16 P2P security and hotspot mode switching Oct 15, 2026
@TioaChan

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T09:40:25.583669Z bd941a4 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: bd941a461e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

Wireless CarPlay fails on Android 16 with Wi-Fi P2P security type UNKNOWN (-1)

1 participant