WifiUtils icon indicating copy to clipboard operation
WifiUtils copied to clipboard

Constant disconnect on OnePlus devices

Open gadget-man opened this issue 4 years ago • 17 comments

I'm using the latest WifiUtils and it works OK on most devices, but whenever we try it on OnePlus on Android 10 the connection to the new WiFi network drops and gets stuck in a loop.

I've attached a video showing the behaviour on OnePlus8: https://drive.google.com/open?id=1-vP8LR-rMQcaWBRugKhmPMZ8R2C-OabD

All I get in the logs when the 'Device to use with iParcelBox' pops up is the following: D/WifiUtils: WifiUtils: AndroidQ+ connected to wifi V/FA: Screen exposed for less than 1000 ms. Event not sent. time: 152 V/FA: Activity paused, time: 83058133 D/ViewRootImpl[MainActivity]: windowFocusChanged hasFocus=false inTouchMode=true D/DecorView: onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@527918c[MainActivity]

gadget-man avatar Apr 25 '20 08:04 gadget-man

me too

Jasperben avatar Apr 25 '20 11:04 Jasperben

I'm wondering whether this is somehow linked to the below, which I can't see implemented in WifiUtils anywhere (if it's even relevant) https://developer.android.com/guide/topics/connectivity/wifi-suggest

gadget-man avatar Apr 25 '20 15:04 gadget-man

I will have to look into it. The annoying thing is that Wifi behavior differs across different devices and since I do not own an OnePlus to test it I will have to guess and generally code in blind.

ThanosFisherman avatar Apr 25 '20 18:04 ThanosFisherman

I think it may be an issue with OxygenOS on OnePlus Devices: https://issuetracker.google.com/issues/143549613

gadget-man avatar Apr 25 '20 18:04 gadget-man

I am having the same issue and also looking into it.

eliaslecomte avatar Apr 26 '20 17:04 eliaslecomte

I'm wondering whether this is somehow linked to the below, which I can't see implemented in WifiUtils anywhere (if it's even relevant) https://developer.android.com/guide/topics/connectivity/wifi-suggest

At the moment this api is not used. For android 10 there are 2 approaches. A new api to temporary connect to a wifi access point (setup of IoT devices) and this suggestion api.

eliaslecomte avatar May 01 '20 14:05 eliaslecomte

My use case it temporary connection to an IoT device for provisioning purposes. It works on most devices, just not OnePlus. I did manage to do something on one device and it started working fine (no idea what!), but after a factory reset, the device reverted to the error state originally described above. I've submitted a bug report to OnePlus and google as it seems to be on their side rather than @ThanosFisherman

gadget-man avatar May 01 '20 14:05 gadget-man

If you can link your bug reports pls do. I am also using this library for IoT provisioning. Do notice there is an issue with 1.5.1 & android 10. Better use 1.5.0 or the next release (https://github.com/ThanosFisherman/WifiUtils/pull/66).

eliaslecomte avatar May 01 '20 14:05 eliaslecomte

Sure: https://issuetracker.google.com/issues/143549613 https://forums.oneplus.com/threads/wifinetworkspecifier-immediately-drops-connection.1219734/

I'm using 1.6.0 Note your comment about bindProcess being required - I'd prefer that this wasn't in the library - it's useful when you connect to the iOT device, but after provisioning is complete and you want to reconnect to the original wifi network, you don't want to necessarily bind to that network. I therefore call a seperate bind process function outside the lib and only bind if and when I'm connecting to the IoT AP. Perhaps it could be included with an optional flag?

gadget-man avatar May 01 '20 14:05 gadget-man

How do you disconnect from the IoT device? Or does it terminate by itself?

For IoT device I understand that it's required, but it also isn't possible to do api calls if the AP does have internet connectivity. By disconnecting via the library it should remove the bind.

eliaslecomte avatar May 01 '20 15:05 eliaslecomte

My IoT device does a reboot, so the connection get terminated.

gadget-man avatar May 01 '20 15:05 gadget-man

@gadget-man did you solve the problem?. I am facing with same problem in your video. I am using OnePlus7 Pro device.

JavaDeveloper08 avatar Jun 01 '20 14:06 JavaDeveloper08

No, it appears that it is a bug in either OxygenOS or Android 10. It affects all OnePlus devices, and possibly also Samsung S7 edge (we're trying to verify). I've raised a bug report on both Android and OnePlus and have provided logs etc, but still waiting for resolution.

gadget-man avatar Jun 01 '20 15:06 gadget-man

I'm hoping 10.3.3 Oxygen OS silently fixes this, but I won't hold my breath. Has anyone tried this issue against the latest stable release?

qcasey avatar Jun 01 '20 15:06 qcasey

I'm on 10.5.6.IN21BA and it's still an issue.

gadget-man avatar Jun 01 '20 15:06 gadget-man

Good to know, thanks.

qcasey avatar Jun 01 '20 15:06 qcasey

This is fixed on OxygenOS starting 10.5.7.IN21BA (Oneplus 8).

eliaslecomte avatar Aug 17 '20 12:08 eliaslecomte