Use AsynChannel for synchronous API

also cleaned up some unnecessary synchronous commands from state machine,
and fixed an issue with a synchronous WPS command

Change-Id: I55bf4379d9810e11f2ba2e03e2e703b132d1488f
This commit is contained in:
Irfan Sheriff
2010-10-28 14:41:39 -07:00
parent 3521e2202d
commit 1406bcb751
4 changed files with 294 additions and 223 deletions

View File

@ -423,7 +423,12 @@ public class WifiService extends IWifiManager.Stub {
*/
public boolean pingSupplicant() {
enforceAccessPermission();
return mWifiStateMachine.syncPingSupplicant();
if (mChannel != null) {
return mWifiStateMachine.syncPingSupplicant(mChannel);
} else {
Slog.e(TAG, "mChannel is not initialized");
return false;
}
}
/**
@ -634,7 +639,12 @@ public class WifiService extends IWifiManager.Stub {
*/
public int addOrUpdateNetwork(WifiConfiguration config) {
enforceChangePermission();
return mWifiStateMachine.syncAddOrUpdateNetwork(config);
if (mChannel != null) {
return mWifiStateMachine.syncAddOrUpdateNetwork(mChannel, config);
} else {
Slog.e(TAG, "mChannel is not initialized");
return -1;
}
}
/**
@ -662,7 +672,12 @@ public class WifiService extends IWifiManager.Stub {
*/
public boolean enableNetwork(int netId, boolean disableOthers) {
enforceChangePermission();
return mWifiStateMachine.syncEnableNetwork(netId, disableOthers);
if (mChannel != null) {
return mWifiStateMachine.syncEnableNetwork(mChannel, netId, disableOthers);
} else {
Slog.e(TAG, "mChannel is not initialized");
return false;
}
}
/**
@ -673,7 +688,12 @@ public class WifiService extends IWifiManager.Stub {
*/
public boolean disableNetwork(int netId) {
enforceChangePermission();
return mWifiStateMachine.syncDisableNetwork(netId);
if (mChannel != null) {
return mWifiStateMachine.syncDisableNetwork(mChannel, netId);
} else {
Slog.e(TAG, "mChannel is not initialized");
return false;
}
}
/**
@ -708,7 +728,12 @@ public class WifiService extends IWifiManager.Stub {
public boolean saveConfiguration() {
boolean result = true;
enforceChangePermission();
return mWifiStateMachine.syncSaveConfig();
if (mChannel != null) {
return mWifiStateMachine.syncSaveConfig(mChannel);
} else {
Slog.e(TAG, "mChannel is not initialized");
return false;
}
}
/**