summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSravanthi Palakonda <srapal@codeaurora.org>2015-07-24 17:10:04 +0530
committerLinux Build Service Account <lnxbuild@localhost>2016-08-24 08:07:55 -0600
commite06235a27b68163bc066d425fa9d43437224b3b6 (patch)
treee3d253e85710bb3080d7c434323670f5bc90ceb0
parent61ebcfc5e047951f7f4ee885fd54c42b19e78cb8 (diff)
downloadandroid_frameworks_opt_net_wifi-e06235a27b68163bc066d425fa9d43437224b3b6.tar.gz
android_frameworks_opt_net_wifi-e06235a27b68163bc066d425fa9d43437224b3b6.tar.bz2
android_frameworks_opt_net_wifi-e06235a27b68163bc066d425fa9d43437224b3b6.zip
P2P: Fix for GO inviting a p2p device.
A p2p device on an invitation request from the peer invokes p2p_peer command to know if the peer is a p2p device / GO. Due to the cached entries there would be a possibility of not getting the updated information, ending up in the wrong negotiation with the invited peer. Thus do not rely on p2p_peer command, rather assume that the peer is a GO on an invitation request, provided there is no persistent network configured. CRs-Fixed: 1038655 Change-Id: I4e9ede2baa8c46dcd7c5bf6442c8c58e66717b3e
-rw-r--r--service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
index 74639e7b3..c264ea5d9 100644
--- a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
+++ b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
@@ -198,6 +198,8 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub {
/* Invitation to join an existing p2p group */
private boolean mJoinExistingGroup;
+ private boolean mIsInvite = false;
+
/* Track whether we are in p2p discovery. This is used to avoid sending duplicate
* broadcasts
*/
@@ -1303,6 +1305,7 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub {
@Override
public void enter() {
if (DBG) logd(getName());
+ mIsInvite = false;
mSavedPeerConfig.invalidate();
}
@@ -1386,6 +1389,7 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub {
mAutonomousGroup = false;
mJoinExistingGroup = true;
+ mIsInvite = true;
transitionTo(mUserAuthorizingInviteRequestState);
break;
case WifiMonitor.P2P_PROV_DISC_PBC_REQ_EVENT:
@@ -2620,15 +2624,22 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub {
* @param config for the peer
*/
private void p2pConnectWithPinDisplay(WifiP2pConfig config) {
+ boolean join = false;
WifiP2pDevice dev = fetchCurrentDeviceDetails(config);
+ if (mIsInvite) {
+ join = true;
+ } else {
+ join = dev.isGroupOwner();
+ }
- String pin = mWifiNative.p2pConnect(config, dev.isGroupOwner());
+ String pin = mWifiNative.p2pConnect(config, join);
try {
Integer.parseInt(pin);
notifyInvitationSent(pin, config.deviceAddress);
} catch (NumberFormatException ignore) {
// do nothing if p2pConnect did not return a pin
}
+ mIsInvite = false;
}
/**