diff options
author | Irfan Sheriff <isheriff@google.com> | 2012-05-22 12:53:47 -0700 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2012-05-22 13:15:00 -0700 |
commit | 4dd5a25a32dc4a721a411f92f0720672ee08020b (patch) | |
tree | 6fc7202bcb31d9e0c40dd29142954832902248f6 /wifi | |
parent | ae14715284837aebe179f790e0456d2bdb367583 (diff) | |
download | frameworks_base-4dd5a25a32dc4a721a411f92f0720672ee08020b.zip frameworks_base-4dd5a25a32dc4a721a411f92f0720672ee08020b.tar.gz frameworks_base-4dd5a25a32dc4a721a411f92f0720672ee08020b.tar.bz2 |
Add WPS details for certification
We need to provide device details to the supplicant for WPS 2.0 certification
Bug: 6450363
Change-Id: I3eb8bc75faacf392a43b6ef3085971bd32a675ac
Diffstat (limited to 'wifi')
-rw-r--r-- | wifi/java/android/net/wifi/WifiNative.java | 16 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateMachine.java | 37 |
2 files changed, 52 insertions, 1 deletions
diff --git a/wifi/java/android/net/wifi/WifiNative.java b/wifi/java/android/net/wifi/WifiNative.java index 0a87a53..63359c1 100644 --- a/wifi/java/android/net/wifi/WifiNative.java +++ b/wifi/java/android/net/wifi/WifiNative.java @@ -438,6 +438,22 @@ public class WifiNative { return doBooleanCommand("SET config_methods " + cfg); } + public boolean setManufacturer(String value) { + return doBooleanCommand("SET manufacturer " + value); + } + + public boolean setModelName(String value) { + return doBooleanCommand("SET model_name " + value); + } + + public boolean setModelNumber(String value) { + return doBooleanCommand("SET model_number " + value); + } + + public boolean setSerialNumber(String value) { + return doBooleanCommand("SET serial_number " + value); + } + public boolean setP2pSsidPostfix(String postfix) { return doBooleanCommand("SET p2p_ssid_postfix " + postfix); } diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index 2903faa..a0f3281 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -120,6 +120,7 @@ public class WifiStateMachine extends StateMachine { private ConnectivityManager mCm; private final boolean mP2pSupported; + private final String mPrimaryDeviceType; /* Scan results handling */ private List<ScanResult> mScanResults; @@ -590,6 +591,9 @@ public class WifiStateMachine extends StateMachine { mBackgroundScanSupported = mContext.getResources().getBoolean( com.android.internal.R.bool.config_wifi_background_scan_support); + mPrimaryDeviceType = mContext.getResources().getString( + com.android.internal.R.string.config_wifi_p2p_device_type); + mContext.registerReceiver( new BroadcastReceiver() { @Override @@ -2214,6 +2218,37 @@ public class WifiStateMachine extends StateMachine { if (DBG) log(getName() + "\n"); EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName()); } + + private void initializeWpsDetails() { + String detail; + detail = SystemProperties.get("ro.product.name", ""); + if (!mWifiNative.setDeviceName(detail)) { + loge("Failed to set device name " + detail); + } + detail = SystemProperties.get("ro.product.manufacturer", ""); + if (!mWifiNative.setManufacturer(detail)) { + loge("Failed to set manufacturer " + detail); + } + detail = SystemProperties.get("ro.product.model", ""); + if (!mWifiNative.setModelName(detail)) { + loge("Failed to set model name " + detail); + } + detail = SystemProperties.get("ro.product.model", ""); + if (!mWifiNative.setModelNumber(detail)) { + loge("Failed to set model number " + detail); + } + detail = SystemProperties.get("ro.serialno", ""); + if (!mWifiNative.setSerialNumber(detail)) { + loge("Failed to set serial number " + detail); + } + if (!mWifiNative.setConfigMethods("physical_display virtual_push_button keypad")) { + loge("Failed to set WPS config methods"); + } + if (!mWifiNative.setDeviceType(mPrimaryDeviceType)) { + loge("Failed to set primary device type " + mPrimaryDeviceType); + } + } + @Override public boolean processMessage(Message message) { if (DBG) log(getName() + message.toString() + "\n"); @@ -2231,8 +2266,8 @@ public class WifiStateMachine extends StateMachine { mLastSignalLevel = -1; mWifiInfo.setMacAddress(mWifiNative.getMacAddress()); - mWifiConfigStore.initialize(); + initializeWpsDetails(); sendSupplicantConnectionChangedBroadcast(true); transitionTo(mDriverStartedState); |