Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fix for issue 111 try 2 #114

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mrlambchop
Copy link
Contributor

This is a second attempt to fix issue 111

Issue 111 describes an issue that can occur during the setup of a Particle Photon using a subset of Android phones running Android 12 or above.

The following SKUs are affected running any Device OS version and below:

  • Photon
  • P1/P0

This issue impacts all versions of the Particle Android SDK.

Root Cause and Symptoms

Android 12 introduced a new Wi-Fi feature known as Wi-Fi STA/STA concurrency. This allows devices to connect to two Wi-Fi networks concurrently.
This feature is designed to support make-before-break Wi-Fi continuity (for Wi-Fi roaming situations) as well as support concurrent local-only and internet connectivity connections. In Android 13, the feature was expanded to support connections to multiple internet providing networks at the same time.
This feature is limited to Android phones that contain a Wi-Fi chip and firmware that can support two concurrent STA connections. As of this date of writing, this list of phones includes the following models:

  • Google Pixel 6 / 6 Pro / 6a
  • Google Pixel 7 / 7 Pro
  • Google Pixel Fold

Behavior when connected to Particle P0/P1/Photon Module

When connecting to a Particle Wi-Fi Module using SoftAP mode for the purposes of onboarding the device to a Wi-Fi network, the impacted Android devices can retain access to the current Wi-Fi network they are attached to.
Android Phones

This feature can’t be disable by the user.

Note from the code:

Due to a known issue with certain Android phones (e.g., Pixel 6/7 series) running Android 12 or above,
these devices may retain access to their current Wi-Fi network while also connecting to a Particle Wi-Fi Module
in SoftAP mode. This behavior is due to a feature introduced in Android 12 known as Wi-Fi STA/STA concurrency,
which allows devices to connect to two Wi-Fi networks concurrently.

The correct way to handle this programmatically using Android's ConnectivityManager APIs (SDK 31+) has proven
to be unreliable due to the bugs tracked at:
https://issuetracker.google.com/issues/249023377
https://issuetracker.google.com/issues/232107693

Exhaustive testing was done after implementing this the correct way and it just didn't work.
Before giving up, the Android source code was examined to see how the system itself handles this situation.
In that code, we found a similar hack to the one below, which is used to determine whether a network is
a "valid" internet connection. If it is, then the system will not bind to it.

The current workaround involves excluding all networks with internet capability when binding to a network.
While this is not a perfect fix (as future changes in Android might affect its effectiveness), this solution
has proven to be reliable for the time being and manages to address the issue across all Pixel phones tested,
ranging from the latest models back to those running Android 5.

For more information, refer to the aforementioned issue trackers.

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