Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5693ba41 authored by Mahesh A Saptasagar's avatar Mahesh A Saptasagar Committed by Steve Kondik
Browse files

p2p: Fix for discovery failure until AP is connected in WFD client.

When station is connecting to AP i.e wifi state is either
connecting or obtaing ip address, Wi-Fi state machine will
send BLOCK_DISCOVERY event to P2P service manager and discovery
is postponed until DHCP success/failure. During this if we
receive DISCOVER_PEERS command then p2p service manager will
return discovery failure because "mDiscoveryPostponed"
variable is not getting updated properly due to improper
condition checking.

To mitigate this issue modified the conditions to update
the variable "mDiscoveryPostponed".

CRs-Fixed: 532138
Change-Id: Ie92a42b17d264cfca5ec2af2dfb4db542deddaac
parent ba4aa762
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -975,15 +975,11 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
                    boolean blocked = (message.arg1 == ENABLED ? true : false);
                    if (mDiscoveryBlocked == blocked) break;
                    mDiscoveryBlocked = blocked;
                    if (blocked && mDiscoveryStarted) {
                    if (blocked) {
                        if (mDiscoveryStarted) {
                            mWifiNative.p2pStopFind();
                        mDiscoveryPostponed = true;
                        }
                    if (!blocked && mDiscoveryPostponed) {
                        mDiscoveryPostponed = false;
                        mWifiNative.p2pFind(DISCOVER_TIMEOUT_S);
                    }
                    if (blocked) {
                        mDiscoveryPostponed = true;
                        try {
                            StateMachine m = (StateMachine)message.obj;
                            m.sendMessage(message.arg2);
@@ -991,11 +987,16 @@ public class WifiP2pService extends IWifiP2pManager.Stub {
                            loge("unable to send BLOCK_DISCOVERY response: " + e);
                        }
                    }
                    if (!blocked && mDiscoveryPostponed) {
                        mDiscoveryPostponed = false;
                        mWifiNative.p2pFind(DISCOVER_TIMEOUT_S);
                    }
                    break;
                case WifiP2pManager.DISCOVER_PEERS:
                    if (mDiscoveryBlocked) {
                        replyToMessage(message, WifiP2pManager.DISCOVER_PEERS_FAILED,
                                WifiP2pManager.BUSY);
                    /* do not send discovery failure to apps.
                       since discovery is postponed and not failed */
                       loge("P2P_FIND is deffered");
                       break;
                    }
                    // do not send service discovery request while normal find operation.