summaryrefslogtreecommitdiffstats
path: root/wifi
diff options
context:
space:
mode:
authorVinit Deshapnde <vinitd@google.com>2013-09-09 16:24:36 -0700
committerVinit Deshapnde <vinitd@google.com>2013-09-09 16:24:36 -0700
commit10652a95b16909acf26f31cdafc0c6aa09212f26 (patch)
tree747c7535600c995ca13c0e2f51cda9243afc7350 /wifi
parent2def61485413084e68233c89ba956a2282fbacd1 (diff)
downloadframeworks_base-10652a95b16909acf26f31cdafc0c6aa09212f26.zip
frameworks_base-10652a95b16909acf26f31cdafc0c6aa09212f26.tar.gz
frameworks_base-10652a95b16909acf26f31cdafc0c6aa09212f26.tar.bz2
Fix invalid Wifi Network system crash
There is some validation code that is eventually detecting that we have an invalid network; only the result is a crash. The right thing to do is to do validation up front; and fail calls if the network configuration looks invalid. Bug: 10571289 Change-Id: I100506b777a34b26ac9a310ba508140560f87a90
Diffstat (limited to 'wifi')
-rw-r--r--wifi/java/android/net/wifi/WifiConfiguration.java14
-rw-r--r--wifi/java/android/net/wifi/WifiManager.java7
2 files changed, 21 insertions, 0 deletions
diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java
index de377ee..2ce584b 100644
--- a/wifi/java/android/net/wifi/WifiConfiguration.java
+++ b/wifi/java/android/net/wifi/WifiConfiguration.java
@@ -348,6 +348,20 @@ public class WifiConfiguration implements Parcelable {
linkProperties = new LinkProperties();
}
+ /**
+ * indicates whether the configuration is valid
+ * @return true if valid, false otherwise
+ * @hide
+ */
+ public boolean isValid() {
+ if (allowedKeyManagement.cardinality() > 1) {
+ return false;
+ }
+
+ // TODO: Add more checks
+ return true;
+ }
+
@Override
public String toString() {
StringBuilder sbuf = new StringBuilder();
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 5f5d54f..d6d0b8c 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -1366,6 +1366,13 @@ public class WifiManager {
/** WPS timed out {@hide} */
public static final int WPS_TIMED_OUT = 7;
+ /**
+ * Passed with {@link ActionListener#onFailure}.
+ * Indicates that the operation failed due to invalid inputs
+ * @hide
+ */
+ public static final int INVALID_ARGS = 8;
+
/** Interface for callback invocation on an application action {@hide} */
public interface ActionListener {
/** The operation succeeded */