Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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:
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.