问题
See-> https://android.googlesource.com/platform/frameworks/base/+/b267554/wifi/java/android/net/wifi/p2p/WifiP2pGroupList.java#34
private static final int CREDENTIAL_MAX_NUM = 32;
Which is essentially limiting the number of devices I can have connected in a single Wi-Fi Direct 'cloud' per se.
This Question spawns from the answer and comments at https://stackoverflow.com/a/26242221/1815624
This Question is not a question of "How to" connect multiple device such as found at WiFi Direct for multiple devices
回答1:
CREDENTIAL_MAX_NUM
is a limit on the number of WifiP2pGroup
objects that the the WififP2pGroupList
will store. It is not a limit on the number of devices that can be a member a single Wi-Fi Direct group - this is theoretically bounded by the IP address range of the group. It is a bound on the number of persistent groups that can be stored in and utilised by the device.
WifiP2pGroupList
is instantiated by the Wi-Fi P2P service and is populated by the wpa_supplicant, so changing the value of CREDENTIAL_MAX_NUM
by reflection is not a solution, as the bound may be inherited from the supplicant and the P2P service resides in the system server process.
The list object can be acquired by reflection (to do this requires the use of a dynamic proxy class to implement the hidden method WifiP2pManager.PersistentGroupInfoListener
and then passing this to the system service via IPC), but it's use is limited - for all groups it will not contain credentials, so caching for future use is not possible. Modification of the list will be restricted to whatever is provided by methods that are exposed by the WifiP2pManager
.
So to summarise, modification of the CREDENTIAL_MAX_NUM
is not possible and even if it was, an upper bound may exist in the wpa_supplicant.
来源:https://stackoverflow.com/questions/36211035/32-how-to-overcome-the-wi-fi-direct-32-limit-on-credentials-in-android