Skip to content

fix: fall back to WPA2 when the P2P group security type is unreported - #26

Merged
shilapi merged 1 commit into
shilapi:masterfrom
FudanSE-Nick:fix/p2p-security-type-unreported
Sep 29, 2026
Merged

shilapi merged 1 commit into
shilapi:masterfrom
FudanSE-Nick:fix/p2p-security-type-unreported

Conversation

@FudanSE-Nick

@FudanSE-Nick FudanSE-Nick commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

WifiP2pGroupManager.groupSecurity() only accepted the three known WifiP2pGroup.SECURITY_TYPE_* constants and threw IOException for every other value.

Seen on a Xiaomi build of Android 16, where createGroup succeeded but the group came back with securityType unset (-1). The exception is raised from awaitUsableGroup() while the WirelessHotspotInfo is being built, so it propagates into the catch in start(), where cleanupFailedStart() sees createSucceeded == true and calls removeGroup(). A successfully created group is therefore torn down and the wireless CarPlay start fails.

This maps any unrecognised value to WPA_WPA2 and logs the reported value, so an unreported type no longer fails an otherwise usable group.

The fallback is safe here because WifiP2pGroupManager always builds its config with setNetworkName() / setPassphrase() and never requests SAE, so every group it creates is WPA2-PSK. The reported WPA3 cases are still honoured when the framework does report them.

Android 16 vendor frameworks can leave WifiP2pGroup.securityType unset
(-1) after a successful createGroup, which discarded the working group
and failed wireless CarPlay startup. Treat unknown types as WPA2-PSK,
which is what every group this manager creates already uses.
@FudanSE-Nick
FudanSE-Nick force-pushed the fix/p2p-security-type-unreported branch from f7afcb9 to caf0e7f Compare September 28, 2026 16:34
@shilapi
shilapi merged commit 0e1b871 into shilapi:master Sep 29, 2026
2 checks passed
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.

2 participants