summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSravanthi Palakonda <srapal@codeaurora.org>2014-12-04 19:16:52 +0530
committerSravanthi Palakonda <srapal@codeaurora.org>2015-01-14 19:32:41 +0530
commitae78221ce2fb27dd978ec1f8714389adb9605414 (patch)
treedc0c56d3b35acf0e447da4ffec858eb591b64fd5
parent650275b96c7d00fb5c30eefcb481bad729a3a2cb (diff)
downloadandroid_frameworks_opt_net_wifi-ae78221ce2fb27dd978ec1f8714389adb9605414.tar.gz
android_frameworks_opt_net_wifi-ae78221ce2fb27dd978ec1f8714389adb9605414.tar.bz2
android_frameworks_opt_net_wifi-ae78221ce2fb27dd978ec1f8714389adb9605414.zip
wifi:Provide UI with SIM info for EAP-SIM authentication
User Interface requires the SIM information (viz. number / type of SIM's supported on the device), using which the respective authentication option is provisioned to the user. This commit queries the same by invoking a command exposed by the wpa_supplicant. It is the wpa_supplicant that gets this information. CRs-Fixed: 775942 Change-Id: I93c6a5450c806d8fade0103ef96eca986c925eba
-rwxr-xr-xservice/java/com/android/server/wifi/WifiConfigStore.java18
-rw-r--r--service/java/com/android/server/wifi/WifiNative.java4
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java13
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java25
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 76255d46e..ffcb5c4a0 100755
--- a/service/java/com/android/server/wifi/WifiConfigStore.java
+++ b/service/java/com/android/server/wifi/WifiConfigStore.java
@@ -2653,6 +2653,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 &&
@@ -3483,6 +3492,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 d2f8f29d7..3ac209487 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;
@@ -2142,6 +2144,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) {
@@ -4805,6 +4818,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);
@@ -5420,6 +5436,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);