Open Rkareko opened 1 month ago
Research has shown that a probable cause for some devices failing to pair is a requirement that apps which target Android 13 (API level 33) and manage Wi-Fi connections should request the NEARBY_WIFI_DEVICES runtime permission according to these docs This permission is required for peer discovery and requesting peers, requesting devices info among other functionality that is used in P2P sync
Request for NEARBY_WIFI_DEVICES permission for Android 13 and higher github ticket will track the implementation for requesting this permission on the p2p-lib.
There's a need for QA P2P feature on Samsung devices with Android versions 13,12,11,10,9 (depending on availablity) the test should cover the following;
Devices used:
G60 android 9
Samsung A12 android 11
Nokia G22 android 13
I have tested P2P on eCBIS using 2 releases Prod on MOH servers and Preview from OpenSRP 0.2.5 branch See below details on the test findings:
P2P on Prod on MOH serverDone on 7 Aug 24:
Blu G60- Blu G60 Initial with no added data Does p2p complete to 100% - ✅ Can one open the HH and registers ✅ subsequent with added data(patient and careplan) Does p2p complete to 100% - ✅ Does added data show? - ✅
Samsung to Blu G60 Initial with no added data Does p2p complete to 100% - ✅ Can one open the HH and registers ✅ subsequent with added data(patient and careplan) Does p2p complete to 100% - ✅ Does added data show? - ✅
G60 to Samsung Initial with no added data Does p2p complete to 100% - ✅ Can one open the HH and registers ✅ subsequent with added data(patient and careplan) Does p2p complete to 100% - ✅ Does added data show? - ✅
QA done on OpenSRP 0.2.5 Branch on 28th Aug 24:
G60 to NOKIA
NOKIA to G60
samsung to nokia
Initial Request
The devices fail to pair we get the error attached below
after reopening the transfer module on both devices, the sender devices disconnects in an attempt to pair . see attached screenshot
after reopening the transfer module again (4th time now) p2p happens successfully but there is a difference in the amount of records transferred (less amount being on chss) see screenshot below
is subsequent P2P successful ✅
is the transferred data correct? ✅
Nokia to Samsung
Nokia to Nokia
search failed error
is returned.
to be able to proceed (being able to search for a device to pair with and pair), one has to exit the transfer module on both devices and open it again. NB// Important to note that subsequent P2P requests are a success and data is transferred .
Error Logs:
2024-08-28 12:04:22.348 21267-22434 WifiDirect...rverSocket org.smartregister.opensrp.ecbis E java.net.SocketTimeoutException: Poll timed out
at libcore.io.IoBridge.poll(IoBridge.java:866)
at java.net.PlainSocketImpl.socketAccept(PlainSocketImpl.java:196)
at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:451)
at java.net.ServerSocket.implAccept(ServerSocket.java:569)
at java.net.ServerSocket.accept(ServerSocket.java:537)
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy$acceptConnectionsToServerSocket$2.invokeSuspend(WifiDirectDataSharingStrategy.kt:619)
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy$acceptConnectionsToServerSocket$2.invoke(Unknown Source:8)
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy$acceptConnectionsToServerSocket$2.invoke(Unknown Source:4)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:78)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:167)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:1)
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy.acceptConnectionsToServerSocket(WifiDirectDataSharingStrategy.kt:611)
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy.makeSocketConnections(WifiDirectDataSharingStrategy.kt:598)
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy$send$1.invokeSuspend(WifiDirectDataSharingStrategy.kt:493)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
2024-08-28 12:04:22.350 21267-22434 P2PSenderV...iceDetails org.smartregister.opensrp.ecbis E An error occurred trying to setup the socket
java.lang.Exception: An exception occurred and the socket is null
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy$send$1$1.invoke(WifiDirectDataSharingStrategy.kt:512)
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy$send$1$1.invoke(WifiDirectDataSharingStrategy.kt:493)
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy.makeSocketConnections(WifiDirectDataSharingStrategy.kt:607)
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy$send$1.invokeSuspend(WifiDirectDataSharingStrategy.kt:493)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
2024-08-28 12:04:22.400 21267-21267 WifiDirect...ngStrategy org.smartregister.opensrp.ecbis D disconnect successfull
2024-08-28 12:04:22.402 21267-21267 BaseViewMo...disconnect org.smartregister.opensrp.ecbis I Disconnection successful
2024-08-28 12:04:22.402 21267-21267 P2PViewModel org.smartregister.opensrp.ecbis I P2P state updated to DEVICE_DISCONNECTED
2024-08-28 12:04:22.446 21267-21267 BottomShee...ottomSheet org.smartregister.opensrp.ecbis D BottomSheetScreen: Device Role: SENDER
2024-08-28 12:04:22.447 21267-21267 BottomShee...ottomSheet org.smartregister.opensrp.ecbis D BottomSheetScreen: P2P State: DEVICE_DISCONNECTED
2024-08-28 12:04:22.447 21267-21267 BottomShee...ottomSheet org.smartregister.opensrp.ecbis D BottomSheetScreen: Devices list 1
2024-08-28 12:04:22.447 21267-21267 BottomShee...ottomSheet org.smartregister.opensrp.ecbis D Device list Else p2p state. State is DEVICE_DISCONNECTED
2024-08-28 12:04:23.015 21267-21267 WifiP2pBro...stReceiver org.smartregister.opensrp.ecbis E Wifi p2p Connection changed action.
2024-08-28 12:04:23.016 21267-21267 WifiDirect...nitChannel org.smartregister.opensrp.ecbis E onConnectionInfoAvailable() WIFIp2p Group is null
2024-08-28 12:04:23.016 21267-21267 WifiDirect...nitChannel org.smartregister.opensrp.ecbis E onConnectionInfoAvailable() Paired: false
2024-08-28 12:04:23.017 21267-21267 WifiDirect...nitChannel org.smartregister.opensrp.ecbis E onConnectionInfoAvailable() Requested disconnection: true
2024-08-28 12:04:23.017 21267-21267 WifiDirect...ngStrategy org.smartregister.opensrp.ecbis D Connection info available: groupFormed = false, isGroupOwner = false
2024-08-28 12:04:23.018 21267-22434 WifiDirect...ategy$send org.smartregister.opensrp.ecbis E groupOwnerAddress is null
2024-08-28 12:04:23.019 21267-22434 P2PSenderV...iceDetails org.smartregister.opensrp.ecbis E An error occurred trying to setup the socket
java.lang.Exception: An exception occurred and the groupOwnerAddress is null
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy$send$1.invokeSuspend(WifiDirectDataSharingStrategy.kt:486)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
2024-08-28 12:04:23.026 21267-21267 WifiDirect...ngStrategy org.smartregister.opensrp.ecbis D Successfully stopped peer discovery
2024-08-28 12:04:23.030 21267-21267 P2PViewMod...eviceFound org.smartregister.opensrp.ecbis I onDeviceFound: State is DEVICE_DISCONNECTED
2024-08-28 12:04:23.030 21267-21267 P2PViewMod...eviceFound org.smartregister.opensrp.ecbis I Devices searching succeeded. Found 0 devices
2024-08-28 12:04:23.031 21267-21267 WifiDirect...ngStrategy org.smartregister.opensrp.ecbis D disconnect failed
2024-08-28 12:04:23.032 21267-21267 BaseViewMo...disconnect org.smartregister.opensrp.ecbis E P2P diconnection failed
java.lang.Exception: Error #2: Busy
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy$disconnect$1.onFailure(WifiDirectDataSharingStrategy.kt:454)
at android.net.wifi.p2p.WifiP2pManager$Channel$P2pHandler.handleMessage(WifiP2pManager.java:1292)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:8057)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:703)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)
2024-08-28 12:04:23.034 21267-21267 P2PViewModel org.smartregister.opensrp.ecbis I P2P state updated to DEVICE_DISCONNECTED
G60 android 9 Samsung A12 android 11 Nokia G22 android 13
@Rkareko This passes QA , on the error on the initial pairing request. tested this on below devices:
@Rkareko I've tested on these devices too and working as expected
@Rkareko
apk: https://onaio.slack.com/archives/C0E2558SH/p1725527632562549
samsung A15 6 GB RAM Android 14
Redmi A3x 4 GB RAM android 14
Nokia G22 4GB RAM android 13
we have 2 identified issues:
1.
samsung A15 to nokia G22
and nokia G22 to samsung A15
.
the observations are:
logs of the error:
-09-09 15:36:43.377 13078-13120 WifiDirect...rverSocket org.smartregister.opensrp.ecbis E java.net.ConnectException: failed to connect to /192.168.49.1 (port 8988) from /192.168.49.244 (port 47897) after 5000ms: isConnected failed: ECONNREFUSED (Connection refused)
at libcore.io.IoBridge.isConnected(IoBridge.java:347)
at libcore.io.IoBridge.connectErrno(IoBridge.java:237)
at libcore.io.IoBridge.connect(IoBridge.java:179)
at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:142)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:390)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:230)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:212)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436)
at java.net.Socket.connect(Socket.java:646)
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy$connectToServerSocket$2.invokeSuspend(WifiDirectDataSharingStrategy.kt:648)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
Caused by: android.system.ErrnoException: isConnected failed: ECONNREFUSED (Connection refused)
at libcore.io.IoBridge.isConnected(IoBridge.java:334)
at libcore.io.IoBridge.connectErrno(IoBridge.java:237)
at libcore.io.IoBridge.connect(IoBridge.java:179)
at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:142)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:390)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:230)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:212)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436)
at java.net.Socket.connect(Socket.java:646)
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy$connectToServerSocket$2.invokeSuspend(WifiDirectDataSharingStrategy.kt:648)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
2024-09-09 15:36:48.379 13078-13120 TrafficStats org.smartregister.opensrp.ecbis D tagSocket(5) with statsTag=0xffffffff, statsUid=-1
2024-09-09 15:36:48.391 13078-1312
2.
2024-09-09 10:02:27.070 21765-24450 WifiDirect...ategy$send org.smartregister.opensrp.ecbis E java.net.SocketException: No route to host
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:116)
at java.net.SocketOutputStream.write(SocketOutputStream.java:156)
at java.io.DataOutputStream.write(DataOutputStream.java:107)
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy.writeBytePayload(WifiDirectDataSharingStrategy.kt:549)
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy.access$writeBytePayload(WifiDirectDataSharingStrategy.kt:57)
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy$send$1$1.invoke(WifiDirectDataSharingStrategy.kt:508)
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy$send$1$1.invoke(WifiDirectDataSharingStrategy.kt:500)
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy.makeSocketConnections(WifiDirectDataSharingStrategy.kt:614)
at org.smartregister.p2p.data_sharing.WifiDirectDataSharingStrategy$send$1.invokeSuspend(WifiDirectDataSharingStrategy.kt:500)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)
2024-09-09 10:02:27.071 21765-24450 P2PSenderV...dChunkData org.smartregister.opensrp.ecbis E Failed to send chunk data
2024-09-09 10:02:27.433 21765-21765 WifiDirect...ngStrategy org.smartregister.opensrp.ecbis D Successfully stopped peer discovery
2024-09-09 10:02:27.577 21765-21792 OpenGLRenderer org.smartregister.opensrp.ecbis E Unable to match the desired swap behavior.
2024-09-09 10:02:27.646 21765-25277 IMGGralloc org.smartregister.opensrp.ecbis D Gralloc Register w:720, h:1650, f:0x101, usage:0x900, ui64Stamp:44295, sSize:4792320, line = 2453
2024-09-09 10:02:27.667 21
RedMi to samsung A15: pairs well but fails on sending data sender gets stuck at 2% and receiver gets stuck at 0% and then P2P fails with the error below:
@madrinekariuki could you test whether the error noted above happens when transferring data from the RedMi
to other devices in addition to the Samsung device?
RedMi to samsung A15: pairs well but fails on sending data sender gets stuck at 2% and receiver gets stuck at 0% and then P2P fails with the error below:
@madrinekariuki could you test whether the error noted above happens when transferring data from the
RedMi
to other devices in addition to the Samsung device?
@Rkareko I am able to successfully transfer data in other devices from theRedmi A3x 4 GB RAM android 14
I have used:
Redmi to Blu G60 android 9
Redmi to Samsung A12 android 11
nb// below issue is not happening all the times but reporting it as it has been observed a couple of times on samsung A15 to nokia G22 and nokia G22 to samsung A15. the observations are:
Fails to pair on the sender device on initial pair request.
pairs after exiting the module and reopening it.
after pairing is successful, the data is transferred successful and the data is correct
screenshot on the error
@madrinekariuki couple of questions
@Rkareko find my responses in Italics below:
Does this happen to devices of the same brand e.g samsung A15 (android 14) and Samsung A25(Android 14) no, transfer starts and works well. e.g tested this on, samsung A15(android 14) to samsung A12 (android 11) , I do not have android 14 devices of the same brand
Has this been observed on other combinations of devices apart from the samsung A15 (android 14) and the Nokia G22 (Android 13) no, other combinations of the devices that i have are working well. tested on Redmi (android 14) to Samsung A12 ( android 11)
What happens when trying to pair the devices after the initial pairing failure without exiting the module? I have not managed to replicate this issue today, will update this when i experience this error again.
@Rkareko find my responses in Italics below:
- Does this happen to devices of the same brand e.g samsung A15 (android 14) and Samsung A25(Android 14) no, transfer starts and works well. e.g tested this on, samsung A15(android 14) to samsung A12 (android 11) , I do not have android 14 devices of the same brand
- Has this been observed on other combinations of devices apart from the samsung A15 (android 14) and the Nokia G22 (Android 13) no, other combinations of the devices that i have are working well. tested on
Redmi (android 14)
to Samsung A12 ( android 11)- What happens when trying to pair the devices after the initial pairing failure without exiting the module? I have not managed to replicate this issue today, will update this when i experience this error again.
@Rkareko
On further testing, I have not been able to replicate this issue again between the Samsung A15 android 14
and Nokia G22 android 13
. I will be on the look out incase it happens.
Also to note that there is a work around on this incase it happens again. (i.e exiting the transfer module and re-opening it) and one can progress with the P2P transfer successfully.
cc @Gental-Giant @ageryck @Mstjamush
Describe the issue to be investigated When sending data via p2p, on some devices, especially if the devices are not of the same model, they are failing to pair. As described on [Prod apk] P2P failing to pair on some devices ticket the following issues were observed :-