diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2015-02-12 04:39:39 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-02-12 04:39:39 -0800 |
commit | 1b0ef143ec87a08eed44635baefe5de807cefbd4 (patch) | |
tree | fda901ba4c2a74d4f3e856a3247c014272fffe60 | |
parent | 387f56e23635cbfa9c05994aaa07da76e5c2172d (diff) | |
parent | ae78221ce2fb27dd978ec1f8714389adb9605414 (diff) | |
download | android_frameworks_opt_net_wifi-1b0ef143ec87a08eed44635baefe5de807cefbd4.tar.gz android_frameworks_opt_net_wifi-1b0ef143ec87a08eed44635baefe5de807cefbd4.tar.bz2 android_frameworks_opt_net_wifi-1b0ef143ec87a08eed44635baefe5de807cefbd4.zip |
Merge "wifi:Provide UI with SIM info for EAP-SIM authentication"
4 files changed, 60 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigStore.java b/service/java/com/android/server/wifi/WifiConfigStore.java index bf2f3a42e..c534e4307 100755 --- a/service/java/com/android/server/wifi/WifiConfigStore.java +++ b/service/java/com/android/server/wifi/WifiConfigStore.java @@ -2654,6 +2654,15 @@ public class WifiConfigStore extends IpConfigStore { } } + if (!mWifiNative.setNetworkVariable( + netId, + WifiConfiguration.SIMNumVarName, + Integer.toString(config.SIMNum))) { + loge(config.SIMNum + ": failed to set sim no: " + +config.SIMNum); + break setVariables; + } + String allowedKeyManagementString = makeString(config.allowedKeyManagement, WifiConfiguration.KeyMgmt.strings); if (config.allowedKeyManagement.cardinality() != 0 && @@ -3484,6 +3493,15 @@ public class WifiConfigStore extends IpConfigStore { } } + value = mWifiNative.getNetworkVariable(netId, WifiConfiguration.SIMNumVarName); + if (!TextUtils.isEmpty(value)) { + try { + config.SIMNum = Integer.parseInt(value); + } catch (NumberFormatException ignore) { + Log.e(TAG,"error in parsing Selected Sim number " + config.SIMNum); + } + } + value = mWifiNative.getNetworkVariable(netId, WifiConfiguration.hiddenSSIDVarName); config.hiddenSSID = false; if (!TextUtils.isEmpty(value)) { diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java index 0e01e27f7..6b813639d 100644 --- a/service/java/com/android/server/wifi/WifiNative.java +++ b/service/java/com/android/server/wifi/WifiNative.java @@ -631,6 +631,10 @@ public class WifiNative { return doStringCommand("PKTCNT_POLL"); } + public String getSimInfoNative() { + return doStringCommand("GET_SIM_INFO"); + } + public void bssFlush() { doBooleanCommand("BSS_FLUSH 0"); } diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java index 8de6c0fb6..7589673d0 100644 --- a/service/java/com/android/server/wifi/WifiServiceImpl.java +++ b/service/java/com/android/server/wifi/WifiServiceImpl.java @@ -798,6 +798,19 @@ public final class WifiServiceImpl extends IWifiManager.Stub { } /** + * see {@link android.net.wifi.WifiManager#getSimInfo} + */ + public WifiEapSimInfo getSimInfo() { + enforceAccessPermission(); + if (mWifiStateMachineChannel != null) { + return mWifiStateMachine.syncGetSimInfo(mWifiStateMachineChannel); + } else { + Slog.e(TAG, "mWifiStateMachineChannel is not initialized"); + return null; + } + } + + /** * see {@link android.net.wifi.WifiAdapter#reportActivityInfo} */ public WifiActivityEnergyInfo reportActivityInfo() { diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index 60fc02060..8f0d950bf 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -629,6 +629,8 @@ public class WifiStateMachine extends StateMachine { /* Supplicant is trying to associate to a given SSID */ static final int CMD_TARGET_SSID = BASE + 148; + static final int CMD_GET_SIM_INFO = BASE + 149; + /* Wifi state machine modes of operation */ /* CONNECT_MODE - connect to any 'known' AP when it becomes available */ public static final int CONNECT_MODE = 1; @@ -2146,6 +2148,17 @@ public class WifiStateMachine extends StateMachine { } /** + * Get sim info synchronously + */ + + public WifiEapSimInfo syncGetSimInfo(AsyncChannel channel) { + Message resultMsg = channel.sendMessageSynchronously(CMD_GET_SIM_INFO); + WifiEapSimInfo mWifiEapSimInfo = (WifiEapSimInfo) resultMsg.obj; + resultMsg.recycle(); + return mWifiEapSimInfo; + } + + /** * Get link layers stats for adapter synchronously */ public WifiLinkLayerStats syncGetLinkLayerStats(AsyncChannel channel) { @@ -4809,6 +4822,9 @@ public class WifiStateMachine extends StateMachine { replyToMessage(message, message.what, 0); } break; + case CMD_GET_SIM_INFO: + replyToMessage(message,message.what, (WifiEapSimInfo) null); + break; case CMD_GET_LINK_LAYER_STATS: // Not supported hence reply with error message replyToMessage(message, message.what, null); @@ -5424,6 +5440,15 @@ public class WifiStateMachine extends StateMachine { loge("Failed to set frequency band " + band); } break; + case CMD_GET_SIM_INFO: + String mSimInfo = mWifiNative.getSimInfoNative(); + WifiEapSimInfo mWifiEapSimInfo = new WifiEapSimInfo(mSimInfo); + if (mWifiEapSimInfo != null) { + replyToMessage(message, message.what ,(WifiEapSimInfo) mWifiEapSimInfo); + } else { + replyToMessage(message, message.what ,(WifiEapSimInfo) null); + } + break; case CMD_BLUETOOTH_ADAPTER_STATE_CHANGE: mBluetoothConnectionActive = (message.arg1 != BluetoothAdapter.STATE_DISCONNECTED); |