summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRajiv Ranjan <rrajiv@codeaurora.org>2017-07-02 10:49:36 +0530
committerJong Wook Kim <jongwook@google.com>2018-05-02 13:50:41 -0700
commite62a75f3884ecaf38451e3af631b2c173ea511c1 (patch)
tree5c9772daa4795b12e0dcdec9a513def88d06a439 /service
parent7d8f472a86f2d2dee7719c1e467d808608fcfe0a (diff)
Sink device not displaying PIN when connect using WPS_KEYPAD option
Sink device is not displaying PIN when trying to connect from source using WPS_KEYPAD connection option. The code for displaying PIN was missing in Process message for the event P2P_PROV_DISC_SHOW_PIN_EVENT in WifiServiceImpl file. Added code for the same. Test: manual test Bug: 35126933 Change-Id: I5a5d412fd3aa21f5e12cbc3990f6a5c6029364fc
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java50
1 files changed, 49 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 fdad6574e..c089c9c09 100644
--- a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
+++ b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java
@@ -1553,12 +1553,27 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub {
break;
case WifiP2pMonitor.P2P_PROV_DISC_PBC_REQ_EVENT:
case WifiP2pMonitor.P2P_PROV_DISC_ENTER_PIN_EVENT:
- case WifiP2pMonitor.P2P_PROV_DISC_SHOW_PIN_EVENT:
// We let the supplicant handle the provision discovery response
// and wait instead for the GO_NEGOTIATION_REQUEST_EVENT.
// Handling provision discovery and issuing a p2p_connect before
// group negotiation comes through causes issues
break;
+ case WifiP2pMonitor.P2P_PROV_DISC_SHOW_PIN_EVENT:
+ if (message.obj == null) {
+ Log.e(TAG, "Illegal argument(s)");
+ break;
+ }
+ WifiP2pProvDiscEvent provDisc = (WifiP2pProvDiscEvent) message.obj;
+ WifiP2pDevice device = provDisc.device;
+ if (device == null) {
+ loge("Device entry is null");
+ break;
+ }
+ notifyP2pProvDiscShowPinRequest(provDisc.pin, device.deviceAddress);
+ mPeers.updateStatus(device.deviceAddress, WifiP2pDevice.INVITED);
+ sendPeersChangedBroadcast();
+ transitionTo(mGroupNegotiationState);
+ break;
case WifiP2pManager.CREATE_GROUP:
mAutonomousGroup = true;
int netId = message.arg1;
@@ -2648,6 +2663,39 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub {
dialog.show();
}
+ private void notifyP2pProvDiscShowPinRequest(String pin, String peerAddress) {
+ Resources r = Resources.getSystem();
+ final String tempDevAddress = peerAddress;
+ final String tempPin = pin;
+
+ final View textEntryView = LayoutInflater.from(mContext)
+ .inflate(R.layout.wifi_p2p_dialog, null);
+
+ ViewGroup group = (ViewGroup) textEntryView.findViewById(R.id.info);
+ addRowToDialog(group, R.string.wifi_p2p_to_message, getDeviceName(peerAddress));
+ addRowToDialog(group, R.string.wifi_p2p_show_pin_message, pin);
+
+ AlertDialog dialog = new AlertDialog.Builder(mContext)
+ .setTitle(r.getString(R.string.wifi_p2p_invitation_sent_title))
+ .setView(textEntryView)
+ .setPositiveButton(r.getString(R.string.accept), new OnClickListener() {
+ public void onClick(DialogInterface dialog, int which) {
+ mSavedPeerConfig = new WifiP2pConfig();
+ mSavedPeerConfig.deviceAddress = tempDevAddress;
+ mSavedPeerConfig.wps.setup = WpsInfo.DISPLAY;
+ mSavedPeerConfig.wps.pin = tempPin;
+ mWifiNative.p2pConnect(mSavedPeerConfig, FORM_GROUP);
+ }
+ })
+ .create();
+ dialog.setCanceledOnTouchOutside(false);
+ dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
+ WindowManager.LayoutParams attrs = dialog.getWindow().getAttributes();
+ attrs.privateFlags = WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
+ dialog.getWindow().setAttributes(attrs);
+ dialog.show();
+ }
+
private void notifyInvitationReceived() {
Resources r = Resources.getSystem();
final WpsInfo wps = mSavedPeerConfig.wps;