summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2016-03-07 04:30:24 +0000
committerAndroid Partner Code Review <android-gerrit-partner@google.com>2016-03-07 04:30:24 +0000
commitffe70f78d0aca71e9c5af82f11472d422f14b301 (patch)
treef896954e1533d5948598f5e58c09861cbafc7496
parent6b0c636d0a97e6163a99a8fbf5c199998c1be770 (diff)
parent9bd01d6cb65ea96d6729d35a1fc43bb2bb40e3bd (diff)
Merge "PNO: Changes in Native for new interface" into mm-wireless-dev
-rw-r--r--service/java/com/android/server/wifi/WifiConfigManager.java27
-rw-r--r--service/java/com/android/server/wifi/WifiNative.java191
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java20
-rw-r--r--service/jni/com_android_server_wifi_WifiNative.cpp49
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java36
5 files changed, 188 insertions, 135 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index 4f3109dd6..ef23ba1df 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -1181,8 +1181,8 @@ public class WifiConfigManager {
*
* @return list of networks with updated priorities.
*/
- public ArrayList<WifiNative.WifiPnoNetwork> retrieveDisconnectedWifiPnoNetworkList() {
- return retrieveWifiPnoNetworkList(true, sDisconnectedPnoListComparator);
+ public ArrayList<WifiNative.PnoNetwork> retrieveDisconnectedPnoNetworkList() {
+ return retrievePnoNetworkList(true, sDisconnectedPnoListComparator);
}
/**
@@ -1197,9 +1197,9 @@ public class WifiConfigManager {
* @param enablePno boolean indicating whether PNO is being enabled or disabled.
* @return list of networks with updated priorities.
*/
- public ArrayList<WifiNative.WifiPnoNetwork> retrieveDisconnectedWifiPnoNetworkList(
+ public ArrayList<WifiNative.PnoNetwork> retrieveDisconnectedPnoNetworkList(
boolean enablePno) {
- return retrieveWifiPnoNetworkList(enablePno, sDisconnectedPnoListComparator);
+ return retrievePnoNetworkList(enablePno, sDisconnectedPnoListComparator);
}
/**
@@ -1230,8 +1230,8 @@ public class WifiConfigManager {
*
* @return list of networks with updated priorities.
*/
- public ArrayList<WifiNative.WifiPnoNetwork> retrieveConnectedWifiPnoNetworkList() {
- return retrieveWifiPnoNetworkList(true, sConnectedPnoListComparator);
+ public ArrayList<WifiNative.PnoNetwork> retrieveConnectedPnoNetworkList() {
+ return retrievePnoNetworkList(true, sConnectedPnoListComparator);
}
/**
@@ -1241,10 +1241,10 @@ public class WifiConfigManager {
* @param enablePno boolean indicating whether PNO is being enabled or disabled.
* @return list of networks with updated priorities.
*/
- private ArrayList<WifiNative.WifiPnoNetwork> retrieveWifiPnoNetworkList(
+ private ArrayList<WifiNative.PnoNetwork> retrievePnoNetworkList(
boolean enablePno, PnoListComparator pnoListComparator) {
- ArrayList<WifiNative.WifiPnoNetwork> pnoList =
- new ArrayList<WifiNative.WifiPnoNetwork>();
+ ArrayList<WifiNative.PnoNetwork> pnoList =
+ new ArrayList<WifiNative.PnoNetwork>();
ArrayList<WifiConfiguration> wifiConfigurations =
new ArrayList<WifiConfiguration>(mConfiguredNetworks.valuesForCurrentUser());
if (enablePno) {
@@ -1255,20 +1255,15 @@ public class WifiConfigManager {
if (DBG) {
Log.d(TAG, "Retrieve network priorities before PNO. Max priority: " + priority);
}
- // Initialize the RSSI threshold with sane value:
- // Use the 2.4GHz threshold since most WifiConfigurations are dual bands
- // There is very little penalty with triggering too soon, i.e. if PNO finds a network
- // that has an RSSI too low for us to attempt joining it.
- int threshold = thresholdMinimumRssi24.get();
for (WifiConfiguration config : wifiConfigurations) {
- pnoList.add(new WifiNative.WifiPnoNetwork(config, threshold, priority));
+ pnoList.add(new WifiNative.PnoNetwork(config, priority));
priority--;
}
} else {
// Revert the priorities back to the saved config values after PNO.
if (DBG) Log.d(TAG, "Retrieve network priorities after PNO.");
for (WifiConfiguration config : wifiConfigurations) {
- pnoList.add(new WifiNative.WifiPnoNetwork(config, 0, config.priority));
+ pnoList.add(new WifiNative.PnoNetwork(config, config.priority));
}
}
return pnoList;
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java
index 6b9683150..4aeb02d49 100644
--- a/service/java/com/android/server/wifi/WifiNative.java
+++ b/service/java/com/android/server/wifi/WifiNative.java
@@ -917,7 +917,7 @@ public class WifiNative {
"com.android.server.Wifi.action.TOGGLE_PNO";
long mLastPnoChangeTimeStamp = -1L;
boolean mExpectedPnoState = false;
- List<WifiPnoNetwork> mExpectedWifiPnoNetworkList = null;
+ List<PnoNetwork> mExpectedPnoNetworkList = null;
boolean mCurrentPnoState = false;;
boolean mWaitForTimer = false;
final Object mPnoLock = new Object();
@@ -941,7 +941,7 @@ public class WifiNative {
if (DBG) Log.d(mTAG, "change PNO from " + mCurrentPnoState + " to "
+ mExpectedPnoState);
boolean ret = setPno(
- mExpectedPnoState, mExpectedWifiPnoNetworkList);
+ mExpectedPnoState, mExpectedPnoNetworkList);
if (!ret) {
Log.e(mTAG, "set PNO failure");
}
@@ -960,13 +960,13 @@ public class WifiNative {
* @param enable boolean indicating whether PNO is being enabled or disabled.
* @param pnoNetworkList list of networks with priorities to be set before PNO setting.
*/
- private boolean setPno(boolean enable, List<WifiPnoNetwork> pnoNetworkList) {
+ private boolean setPno(boolean enable, List<PnoNetwork> pnoNetworkList) {
// TODO: Couple of cases yet to be handled:
// 1. What if the network priority update fails, should we bail out of PNO setting?
// 2. If PNO setting fails below, should we go back and revert this priority change?
if (pnoNetworkList != null) {
if (DBG) Log.i(mTAG, "Update priorities for PNO. Enable: " + enable);
- for (WifiPnoNetwork pnoNetwork : pnoNetworkList) {
+ for (PnoNetwork pnoNetwork : pnoNetworkList) {
// What if this fails? Should we bail out?
boolean isSuccess = setNetworkVariable(pnoNetwork.networkId,
WifiConfiguration.priorityVarName,
@@ -987,12 +987,12 @@ public class WifiNative {
public boolean enableBackgroundScan(
boolean enable,
- List<WifiPnoNetwork> pnoNetworkList) {
+ List<PnoNetwork> pnoNetworkList) {
synchronized(mPnoLock) {
if (mWaitForTimer) {
//already has a timer
mExpectedPnoState = enable;
- mExpectedWifiPnoNetworkList = pnoNetworkList;
+ mExpectedPnoNetworkList = pnoNetworkList;
if (DBG) Log.d(mTAG, "update expected PNO to " + mExpectedPnoState);
} else {
if (mCurrentPnoState == enable) {
@@ -1003,7 +1003,7 @@ public class WifiNative {
return setPno(enable, pnoNetworkList);
} else {
mExpectedPnoState = enable;
- mExpectedWifiPnoNetworkList = pnoNetworkList;
+ mExpectedPnoNetworkList = pnoNetworkList;
mWaitForTimer = true;
if (DBG) Log.d(mTAG, "start PNO timer with delay:" + timeDifference);
mAlarmManager.set(AlarmManager.RTC_WAKEUP,
@@ -1017,7 +1017,7 @@ public class WifiNative {
public boolean enableBackgroundScan(
boolean enable,
- List<WifiPnoNetwork> pnoNetworkList) {
+ List<PnoNetwork> pnoNetworkList) {
if (mPnoMonitor != null) {
return mPnoMonitor.enableBackgroundScan(enable, pnoNetworkList);
} else {
@@ -1788,6 +1788,61 @@ public class WifiNative {
}
/**
+ * Network parameters to start PNO scan.
+ */
+ public static class PnoNetwork {
+ public String ssid;
+ public int networkId;
+ public int priority;
+ public byte flags;
+ public byte auth;
+ public String configKey; // kept for reference
+
+ /**
+ * Constructor for the PnoNetwork object used by WifiStateMachine.
+ * TODO(rpius): Remove this interface when we remove the PNO usage out of StateMachine.
+ * @param config Corresponding configuration for the network
+ * @param newPriority Priority to be set.
+ */
+ PnoNetwork(WifiConfiguration config, int newPriority) {
+ if (config.SSID == null) {
+ ssid = "";
+ flags = WifiScanner.PnoSettings.PnoNetwork.FLAG_DIRECTED_SCAN;
+ } else {
+ ssid = config.SSID;
+ }
+ if (config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.WPA_PSK)) {
+ auth |= WifiScanner.PnoSettings.PnoNetwork.AUTH_CODE_PSK;
+ } else if (config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.WPA_EAP)
+ || config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.IEEE8021X)) {
+ auth |= WifiScanner.PnoSettings.PnoNetwork.AUTH_CODE_EAPOL;
+ } else {
+ auth |= WifiScanner.PnoSettings.PnoNetwork.AUTH_CODE_OPEN;
+ }
+ flags = WifiScanner.PnoSettings.PnoNetwork.FLAG_A_BAND;
+ flags |= WifiScanner.PnoSettings.PnoNetwork.FLAG_G_BAND;
+ configKey = config.configKey();
+ networkId = config.networkId;
+ priority = newPriority;
+ }
+ }
+
+ /**
+ * Parameters to start PNO scan. This holds the list of networks which are going to used for
+ * PNO scan.
+ */
+ public static class PnoSettings {
+ public int min5GHzRssi;
+ public int min24GHzRssi;
+ public int initialScoreMax;
+ public int currentConnectionBonus;
+ public int sameNetworkBonus;
+ public int secureBonus;
+ public int band5GHzBonus;
+ public PnoNetwork[] networkList;
+ }
+
+ /**
* Wi-Fi channel information.
*/
public static class WifiChannelInfo {
@@ -1819,6 +1874,17 @@ public class WifiNative {
void onScanRestarted();
}
+ /**
+ * Handler to notify the occurrence of various events during PNO scan.
+ */
+ public interface PnoEventHandler {
+ /**
+ * Callback to notify when one of the shortlisted networks is found during PNO scan.
+ * @param results List of Scan results received.
+ */
+ void onPnoNetworkFound(ScanResult[] results);
+ }
+
/* scan status, keep these values in sync with gscan.h */
public static final int WIFI_SCAN_RESULTS_AVAILABLE = 0;
public static final int WIFI_SCAN_THRESHOLD_NUM_SCANS = 1;
@@ -2673,95 +2739,62 @@ public class WifiNative {
//---------------------------------------------------------------------------------
/* Configure ePNO/PNO */
+ private static PnoEventHandler sPnoEventHandler;
+ private static int sPnoCmdId = 0;
- /* pno flags, keep these values in sync with gscan.h */
- private static int WIFI_PNO_AUTH_CODE_OPEN = 1; // open
- private static int WIFI_PNO_AUTH_CODE_PSK = 2; // WPA_PSK or WPA2PSK
- private static int WIFI_PNO_AUTH_CODE_EAPOL = 4; // any EAPOL
-
- // Whether directed scan needs to be performed (for hidden SSIDs)
- private static int WIFI_PNO_FLAG_DIRECTED_SCAN = 1;
- // Whether PNO event shall be triggered if the network is found on A band
- private static int WIFI_PNO_FLAG_A_BAND = 2;
- // Whether PNO event shall be triggered if the network is found on G band
- private static int WIFI_PNO_FLAG_G_BAND = 4;
- // Whether strict matching is required (i.e. firmware shall not match on the entire SSID)
- private static int WIFI_PNO_FLAG_STRICT_MATCH = 8;
+ private static native boolean setPnoListNative(int iface, int id, PnoSettings settings);
/**
- * Object holding the network ID and the corresponding priority to be set before enabling/
- * disabling PNO.
+ * Set the PNO settings & the network list in HAL to start PNO.
+ * @param settings PNO settings and network list.
+ * @param eventHandler Handler to receive notifications back during PNO scan.
+ * @return true if success, false otherwise
*/
- public static class WifiPnoNetwork {
- public String SSID;
- public int rssi_threshold; // TODO remove
- public int flags;
- public int auth;
- public String configKey; // kept for reference
- public int networkId;
- public int priority;
+ public boolean setPnoList(PnoSettings settings, PnoEventHandler eventHandler) {
+ Log.e(TAG, "setPnoList cmd " + sPnoCmdId);
- WifiPnoNetwork(WifiConfiguration config, int threshold, int newPriority) {
- if (config.SSID == null) {
- SSID = "";
- flags = WIFI_PNO_FLAG_DIRECTED_SCAN;
- } else {
- SSID = config.SSID;
- }
- rssi_threshold = threshold;
- if (config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.WPA_PSK)) {
- auth |= WIFI_PNO_AUTH_CODE_PSK;
- } else if (config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.WPA_EAP) ||
- config.allowedKeyManagement.get(WifiConfiguration.KeyMgmt.IEEE8021X)) {
- auth |= WIFI_PNO_AUTH_CODE_EAPOL;
- } else {
- auth |= WIFI_PNO_AUTH_CODE_OPEN;
+ synchronized (sLock) {
+ if (isHalStarted()) {
+ sPnoCmdId = getNewCmdIdLocked();
+ sPnoEventHandler = eventHandler;
+ if (setPnoListNative(sWlan0Index, sPnoCmdId, settings)) {
+ return true;
+ }
}
- flags |= WIFI_PNO_FLAG_A_BAND | WIFI_PNO_FLAG_G_BAND;
- configKey = config.configKey();
- networkId = config.networkId;
- priority = newPriority;
- }
-
- @Override
- public String toString() {
- StringBuilder sbuf = new StringBuilder();
- sbuf.append(this.SSID);
- sbuf.append(" flags=").append(this.flags);
- sbuf.append(" rssi=").append(this.rssi_threshold);
- sbuf.append(" auth=").append(this.auth);
- sbuf.append(" Network ID=").append(this.networkId);
- sbuf.append(" Priority=").append(this.priority);
- return sbuf.toString();
+ sPnoEventHandler = null;
+ return false;
}
}
- public static interface WifiPnoEventHandler {
- void onPnoNetworkFound(ScanResult results[]);
+ /**
+ * Set the PNO network list in HAL to start PNO.
+ * @param list PNO network list.
+ * @param eventHandler Handler to receive notifications back during PNO scan.
+ * @return true if success, false otherwise
+ */
+ public boolean setPnoList(PnoNetwork[] list, PnoEventHandler eventHandler) {
+ PnoSettings settings = new PnoSettings();
+ settings.networkList = list;
+ return setPnoList(settings, eventHandler);
}
- private static WifiPnoEventHandler sWifiPnoEventHandler;
-
- private static int sPnoCmdId = 0;
-
- private native static boolean setPnoListNative(int iface, int id, WifiPnoNetwork list[]);
+ private static native boolean resetPnoListNative(int iface, int id);
- public boolean setPnoList(WifiPnoNetwork list[],
- WifiPnoEventHandler eventHandler) {
- Log.e(TAG, "setPnoList cmd " + sPnoCmdId);
+ /**
+ * Reset the PNO settings in HAL to stop PNO.
+ * @return true if success, false otherwise
+ */
+ public boolean resetPnoList() {
+ Log.e(TAG, "resetPnoList cmd " + sPnoCmdId);
synchronized (sLock) {
if (isHalStarted()) {
-
sPnoCmdId = getNewCmdIdLocked();
-
- sWifiPnoEventHandler = eventHandler;
- if (setPnoListNative(sWlan0Index, sPnoCmdId, list)) {
+ sPnoEventHandler = null;
+ if (resetPnoListNative(sWlan0Index, sPnoCmdId)) {
return true;
}
}
-
- sWifiPnoEventHandler = null;
return false;
}
}
@@ -2775,7 +2808,7 @@ public class WifiNative {
}
Log.d(TAG, "WifiNative.onPnoNetworkFound result " + results.length);
- WifiPnoEventHandler handler = sWifiPnoEventHandler;
+ PnoEventHandler handler = sPnoEventHandler;
if (sPnoCmdId != 0 && handler != null) {
for (int i=0; i<results.length; i++) {
Log.e(TAG, "onPnoNetworkFound SSID " + results[i].SSID
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 2ce51114b..169897b5c 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -149,7 +149,7 @@ import java.util.concurrent.atomic.AtomicInteger;
*
* @hide
*/
-public class WifiStateMachine extends StateMachine implements WifiNative.WifiPnoEventHandler,
+public class WifiStateMachine extends StateMachine implements WifiNative.PnoEventHandler,
WifiNative.WifiRssiEventHandler {
private static final String NETWORKTYPE = "WIFI";
@@ -2471,8 +2471,8 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno
// disabled when we connect to a network after PNO.
mWifiConfigManager.enableAllNetworksNative();
}
- List<WifiNative.WifiPnoNetwork> pnoList =
- mWifiConfigManager.retrieveDisconnectedWifiPnoNetworkList(enable);
+ List<WifiNative.PnoNetwork> pnoList =
+ mWifiConfigManager.retrieveDisconnectedPnoNetworkList(enable);
boolean ret = mWifiNative.enableBackgroundScan(enable, pnoList);
if (ret) {
mLegacyPnoEnabled = enable;
@@ -3391,7 +3391,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno
private void stopPnoOffload() {
// clear the PNO list
- if (!mWifiNative.setPnoList(null, WifiStateMachine.this)) {
+ if (!mWifiNative.resetPnoList()) {
Log.e(TAG, "Failed to stop pno");
}
@@ -3468,7 +3468,7 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno
return true;
}
- List<WifiNative.WifiPnoNetwork> llist = null;
+ List<WifiNative.PnoNetwork> llist = null;
//TODO: add getPnoList in WifiQualifiedNetworkSelector
//mWifiAutoJoinController.getPnoList(getCurrentWifiConfiguration());
if (llist == null || llist.size() == 0) {
@@ -3481,8 +3481,8 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno
}
// first program the network we want to look for thru the pno API
- WifiNative.WifiPnoNetwork list[]
- = (WifiNative.WifiPnoNetwork[]) llist.toArray(new WifiNative.WifiPnoNetwork[0]);
+ WifiNative.PnoNetwork[] list =
+ (WifiNative.PnoNetwork[]) llist.toArray(new WifiNative.PnoNetwork[0]);
if (!mWifiNative.setPnoList(list, WifiStateMachine.this)) {
Log.e(TAG, "Failed to set pno, length = " + list.length);
@@ -3491,10 +3491,10 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiPno
if (true) {
StringBuilder sb = new StringBuilder();
- for (WifiNative.WifiPnoNetwork network : list) {
- sb.append("[").append(network.SSID).append(" auth=").append(network.auth);
+ for (WifiNative.PnoNetwork network : list) {
+ sb.append("[").append(network.ssid).append(" auth=").append(network.auth);
sb.append(" flags=");
- sb.append(network.flags).append(" rssi").append(network.rssi_threshold);
+ sb.append(network.flags);
sb.append("] ");
}
diff --git a/service/jni/com_android_server_wifi_WifiNative.cpp b/service/jni/com_android_server_wifi_WifiNative.cpp
index 99b8517ca..c4f94df64 100644
--- a/service/jni/com_android_server_wifi_WifiNative.cpp
+++ b/service/jni/com_android_server_wifi_WifiNative.cpp
@@ -1891,7 +1891,7 @@ static void onPnoNetworkFound(wifi_request_id id,
}
static jboolean android_net_wifi_setPnoListNative(
- JNIEnv *env, jclass cls, jint iface, jint id, jobject list) {
+ JNIEnv *env, jclass cls, jint iface, jint id, jobject settings) {
JNIHelper helper(env);
wifi_epno_handler handler;
@@ -1900,30 +1900,33 @@ static jboolean android_net_wifi_setPnoListNative(
wifi_interface_handle handle = getIfaceHandle(helper, cls, iface);
ALOGD("configure ePno list request [%d] = %p", id, handle);
- if (list == NULL) {
- // stop pno
- int result = hal_fn.wifi_reset_epno_list(id, handle);
- ALOGD(" setPnoListNative: STOP result = %d", result);
- return result >= 0;
+ if (settings == NULL) {
+ return false;
}
- wifi_epno_params params;
- memset(&params, 0, sizeof(params));
+ JNIObject<jobjectArray> list = helper.getArrayField(settings, "networkList",
+ "[Lcom/android/server/wifi/WifiNative$PnoNetwork");
+ if (list == NULL) {
+ return false;
+ }
- size_t len = helper.getArrayLength((jobjectArray)list);
+ size_t len = helper.getArrayLength(list);
if (len > (size_t)MAX_EPNO_NETWORKS) {
return false;
}
+ wifi_epno_params params;
+ memset(&params, 0, sizeof(params));
+
for (unsigned int i = 0; i < len; i++) {
- JNIObject<jobject> pno_net = helper.getObjectArrayElement((jobjectArray)list, i);
+ JNIObject<jobject> pno_net = helper.getObjectArrayElement(list, i);
if (pno_net == NULL) {
ALOGE("setPnoListNative: could not get element %d", i);
continue;
}
- JNIObject<jstring> sssid = helper.getStringField(pno_net, "SSID");
+ JNIObject<jstring> sssid = helper.getStringField(pno_net, "ssid");
if (sssid == NULL) {
ALOGE("Error setPnoListNative: getting ssid field");
return false;
@@ -1961,6 +1964,13 @@ static jboolean android_net_wifi_setPnoListNative(
params.networks[i].auth_bit_field, a, params.networks[i].flags, f,
params.networks[i].ssid);
}
+ params.min5GHz_rssi = helper.getIntField(settings, "min5GHzRssi");
+ params.min24GHz_rssi = helper.getIntField(settings, "min24GHzRssi");
+ params.initial_score_max = helper.getIntField(settings, "initialScoreMax");
+ params.current_connection_bonus = helper.getIntField(settings, "currentConnectionBonus");
+ params.same_network_bonus = helper.getIntField(settings, "sameNetworkBonus");
+ params.secure_bonus = helper.getIntField(settings, "secureBonus");
+ params.band5GHz_bonus = helper.getIntField(settings, "band5GHzBonus");
params.num_networks = len;
int result = hal_fn.wifi_set_epno_list(id, handle, &params, handler);
@@ -1969,6 +1979,20 @@ static jboolean android_net_wifi_setPnoListNative(
return result >= 0;
}
+static jboolean android_net_wifi_resetPnoListNative(
+ JNIEnv *env, jclass cls, jint iface, jint id) {
+
+ JNIHelper helper(env);
+
+ wifi_interface_handle handle = getIfaceHandle(helper, cls, iface);
+ ALOGD("reset ePno list request [%d] = %p", id, handle);
+
+ // stop pno
+ int result = hal_fn.wifi_reset_epno_list(id, handle);
+ ALOGD(" ressetPnoListNative: result = %d", result);
+ return result >= 0;
+}
+
static jboolean android_net_wifi_setBssidBlacklist(
JNIEnv *env, jclass cls, jint iface, jint id, jobject list) {
@@ -2284,8 +2308,9 @@ static JNINativeMethod gWifiMethods[] = {
{ "installPacketFilterNative", "(I[B)Z", (void*) android_net_wifi_install_packet_filter},
{"setCountryCodeHalNative", "(ILjava/lang/String;)Z",
(void*) android_net_wifi_set_Country_Code_Hal},
- { "setPnoListNative", "(II[Lcom/android/server/wifi/WifiNative$WifiPnoNetwork;)Z",
+ { "setPnoListNative", "(IILcom/android/server/wifi/WifiNative$PnoSettings;)Z",
(void*) android_net_wifi_setPnoListNative},
+ { "resetPnoListNative", "(II)Z", (void*) android_net_wifi_resetPnoListNative},
{"enableDisableTdlsNative", "(IZLjava/lang/String;)Z",
(void*) android_net_wifi_enable_disable_tdls},
{"getTdlsStatusNative", "(ILjava/lang/String;)Lcom/android/server/wifi/WifiNative$TdlsStatus;",
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
index 1adf0b940..5cb570746 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java
@@ -968,10 +968,10 @@ public class WifiConfigManagerTest {
* network in expectedNetworkIDOrder list.
*/
private static void verifyPnoNetworkListOrder(
- ArrayList<WifiNative.WifiPnoNetwork> pnoNetworkList,
+ ArrayList<WifiNative.PnoNetwork> pnoNetworkList,
ArrayList<Integer> expectedNetworkIdOrder) throws Exception {
int i = 0;
- for (WifiNative.WifiPnoNetwork pnoNetwork : pnoNetworkList) {
+ for (WifiNative.PnoNetwork pnoNetwork : pnoNetworkList) {
Log.i(TAG, "PNO Network List Index: " + i + ", networkID: " + pnoNetwork.networkId);
assertEquals("Expected network ID: " + pnoNetwork.networkId,
pnoNetwork.networkId, expectedNetworkIdOrder.get(i++).intValue());
@@ -979,11 +979,11 @@ public class WifiConfigManagerTest {
}
/**
- * Verifies the retrieveDisconnectedWifiPnoNetworkList API. The test verifies that the list
+ * Verifies the retrieveDisconnectedPnoNetworkList API. The test verifies that the list
* returned from the API is sorted as expected.
*/
@Test
- public void testDisconnectedWifiPnoNetworkListCreation() throws Exception {
+ public void testDisconnectedPnoNetworkListCreation() throws Exception {
addNetworks();
Random rand = new Random(WifiTestUtil.getTestMethod().hashCode());
@@ -1007,8 +1007,8 @@ public class WifiConfigManagerTest {
Log.i(TAG, "networkID: " + config.networkId + ", numAssociation: "
+ config.numAssociation);
}
- ArrayList<WifiNative.WifiPnoNetwork> pnoNetworkList =
- mWifiConfigManager.retrieveDisconnectedWifiPnoNetworkList();
+ ArrayList<WifiNative.PnoNetwork> pnoNetworkList =
+ mWifiConfigManager.retrieveDisconnectedPnoNetworkList();
verifyPnoNetworkListOrder(pnoNetworkList,
new ArrayList(numAssociationToNetworkIdMap.values()));
}
@@ -1030,8 +1030,8 @@ public class WifiConfigManagerTest {
priorityToNetworkIdMap.put(config.priority, config.networkId);
Log.i(TAG, "networkID: " + config.networkId + ", priority: " + config.priority);
}
- ArrayList<WifiNative.WifiPnoNetwork> pnoNetworkList =
- mWifiConfigManager.retrieveDisconnectedWifiPnoNetworkList();
+ ArrayList<WifiNative.PnoNetwork> pnoNetworkList =
+ mWifiConfigManager.retrieveDisconnectedPnoNetworkList();
verifyPnoNetworkListOrder(pnoNetworkList,
new ArrayList(priorityToNetworkIdMap.values()));
}
@@ -1057,19 +1057,19 @@ public class WifiConfigManagerTest {
Log.i(TAG, "networkID: " + config.networkId + ", NetworkSelectionStatus: "
+ config.getNetworkSelectionStatus().getNetworkSelectionStatus());
}
- ArrayList<WifiNative.WifiPnoNetwork> pnoNetworkList =
- mWifiConfigManager.retrieveDisconnectedWifiPnoNetworkList();
+ ArrayList<WifiNative.PnoNetwork> pnoNetworkList =
+ mWifiConfigManager.retrieveDisconnectedPnoNetworkList();
verifyPnoNetworkListOrder(pnoNetworkList,
new ArrayList(networkSelectionStatusToNetworkIdMap.values()));
}
}
/**
- * Verifies the retrieveConnectedWifiPnoNetworkList API. The test verifies that the list
+ * Verifies the retrieveConnectedPnoNetworkList API. The test verifies that the list
* returned from the API is sorted as expected.
*/
@Test
- public void testConnectedWifiPnoNetworkListCreation() throws Exception {
+ public void testConnectedPnoNetworkListCreation() throws Exception {
addNetworks();
Random rand = new Random(WifiTestUtil.getTestMethod().hashCode());
@@ -1094,8 +1094,8 @@ public class WifiConfigManagerTest {
lastSeenToNetworkIdMap.put(lastSeenValue, config.networkId);
Log.i(TAG, "networkID: " + config.networkId + ", lastSeen: " + lastSeenValue);
}
- ArrayList<WifiNative.WifiPnoNetwork> pnoNetworkList =
- mWifiConfigManager.retrieveConnectedWifiPnoNetworkList();
+ ArrayList<WifiNative.PnoNetwork> pnoNetworkList =
+ mWifiConfigManager.retrieveConnectedPnoNetworkList();
verifyPnoNetworkListOrder(pnoNetworkList,
new ArrayList(lastSeenToNetworkIdMap.values()));
}
@@ -1120,8 +1120,8 @@ public class WifiConfigManagerTest {
Log.i(TAG, "networkID: " + config.networkId + ", numAssociation: "
+ config.numAssociation);
}
- ArrayList<WifiNative.WifiPnoNetwork> pnoNetworkList =
- mWifiConfigManager.retrieveConnectedWifiPnoNetworkList();
+ ArrayList<WifiNative.PnoNetwork> pnoNetworkList =
+ mWifiConfigManager.retrieveConnectedPnoNetworkList();
verifyPnoNetworkListOrder(pnoNetworkList,
new ArrayList(numAssociationToNetworkIdMap.values()));
}
@@ -1147,8 +1147,8 @@ public class WifiConfigManagerTest {
Log.i(TAG, "networkID: " + config.networkId + ", NetworkSelectionStatus: "
+ config.getNetworkSelectionStatus().getNetworkSelectionStatus());
}
- ArrayList<WifiNative.WifiPnoNetwork> pnoNetworkList =
- mWifiConfigManager.retrieveConnectedWifiPnoNetworkList();
+ ArrayList<WifiNative.PnoNetwork> pnoNetworkList =
+ mWifiConfigManager.retrieveConnectedPnoNetworkList();
verifyPnoNetworkListOrder(pnoNetworkList,
new ArrayList(networkSelectionStatusToNetworkIdMap.values()));
}