Skip to content

Commit 4dd5a25

Browse files
committed
Add WPS details for certification
We need to provide device details to the supplicant for WPS 2.0 certification Bug: 6450363 Change-Id: I3eb8bc75faacf392a43b6ef3085971bd32a675ac
1 parent ae14715 commit 4dd5a25

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

wifi/java/android/net/wifi/WifiNative.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,22 @@ public boolean setConfigMethods(String cfg) {
438438
return doBooleanCommand("SET config_methods " + cfg);
439439
}
440440

441+
public boolean setManufacturer(String value) {
442+
return doBooleanCommand("SET manufacturer " + value);
443+
}
444+
445+
public boolean setModelName(String value) {
446+
return doBooleanCommand("SET model_name " + value);
447+
}
448+
449+
public boolean setModelNumber(String value) {
450+
return doBooleanCommand("SET model_number " + value);
451+
}
452+
453+
public boolean setSerialNumber(String value) {
454+
return doBooleanCommand("SET serial_number " + value);
455+
}
456+
441457
public boolean setP2pSsidPostfix(String postfix) {
442458
return doBooleanCommand("SET p2p_ssid_postfix " + postfix);
443459
}

wifi/java/android/net/wifi/WifiStateMachine.java

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ public class WifiStateMachine extends StateMachine {
120120
private ConnectivityManager mCm;
121121

122122
private final boolean mP2pSupported;
123+
private final String mPrimaryDeviceType;
123124

124125
/* Scan results handling */
125126
private List<ScanResult> mScanResults;
@@ -590,6 +591,9 @@ public WifiStateMachine(Context context, String wlanInterface) {
590591
mBackgroundScanSupported = mContext.getResources().getBoolean(
591592
com.android.internal.R.bool.config_wifi_background_scan_support);
592593

594+
mPrimaryDeviceType = mContext.getResources().getString(
595+
com.android.internal.R.string.config_wifi_p2p_device_type);
596+
593597
mContext.registerReceiver(
594598
new BroadcastReceiver() {
595599
@Override
@@ -2214,6 +2218,37 @@ public void enter() {
22142218
if (DBG) log(getName() + "\n");
22152219
EventLog.writeEvent(EVENTLOG_WIFI_STATE_CHANGED, getName());
22162220
}
2221+
2222+
private void initializeWpsDetails() {
2223+
String detail;
2224+
detail = SystemProperties.get("ro.product.name", "");
2225+
if (!mWifiNative.setDeviceName(detail)) {
2226+
loge("Failed to set device name " + detail);
2227+
}
2228+
detail = SystemProperties.get("ro.product.manufacturer", "");
2229+
if (!mWifiNative.setManufacturer(detail)) {
2230+
loge("Failed to set manufacturer " + detail);
2231+
}
2232+
detail = SystemProperties.get("ro.product.model", "");
2233+
if (!mWifiNative.setModelName(detail)) {
2234+
loge("Failed to set model name " + detail);
2235+
}
2236+
detail = SystemProperties.get("ro.product.model", "");
2237+
if (!mWifiNative.setModelNumber(detail)) {
2238+
loge("Failed to set model number " + detail);
2239+
}
2240+
detail = SystemProperties.get("ro.serialno", "");
2241+
if (!mWifiNative.setSerialNumber(detail)) {
2242+
loge("Failed to set serial number " + detail);
2243+
}
2244+
if (!mWifiNative.setConfigMethods("physical_display virtual_push_button keypad")) {
2245+
loge("Failed to set WPS config methods");
2246+
}
2247+
if (!mWifiNative.setDeviceType(mPrimaryDeviceType)) {
2248+
loge("Failed to set primary device type " + mPrimaryDeviceType);
2249+
}
2250+
}
2251+
22172252
@Override
22182253
public boolean processMessage(Message message) {
22192254
if (DBG) log(getName() + message.toString() + "\n");
@@ -2231,8 +2266,8 @@ public boolean processMessage(Message message) {
22312266
mLastSignalLevel = -1;
22322267

22332268
mWifiInfo.setMacAddress(mWifiNative.getMacAddress());
2234-
22352269
mWifiConfigStore.initialize();
2270+
initializeWpsDetails();
22362271

22372272
sendSupplicantConnectionChangedBroadcast(true);
22382273
transitionTo(mDriverStartedState);

0 commit comments

Comments
 (0)