diff options
-rw-r--r-- | api/current.txt | 31 | ||||
-rw-r--r-- | core/java/android/view/View.java | 5 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/SupplicantStateTracker.java | 26 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiConfiguration.java | 2 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiEnterpriseConfig.java | 2 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiMonitor.java | 14 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/WifiStateMachine.java | 8 | ||||
-rw-r--r-- | wifi/java/android/net/wifi/p2p/WifiP2pService.java | 7 |
8 files changed, 75 insertions, 20 deletions
diff --git a/api/current.txt b/api/current.txt index 7462415..2c8f7af 100644 --- a/api/current.txt +++ b/api/current.txt @@ -30455,7 +30455,7 @@ package java.io { ctor public CharConversionException(java.lang.String); } - public abstract interface Closeable { + public abstract interface Closeable implements java.lang.AutoCloseable { method public abstract void close() throws java.io.IOException; } @@ -30778,7 +30778,7 @@ package java.io { ctor public NotSerializableException(java.lang.String); } - public abstract interface ObjectInput implements java.io.DataInput { + public abstract interface ObjectInput implements java.lang.AutoCloseable java.io.DataInput { method public abstract int available() throws java.io.IOException; method public abstract void close() throws java.io.IOException; method public abstract int read() throws java.io.IOException; @@ -30840,7 +30840,7 @@ package java.io { method public abstract void validateObject() throws java.io.InvalidObjectException; } - public abstract interface ObjectOutput implements java.io.DataOutput { + public abstract interface ObjectOutput implements java.lang.AutoCloseable java.io.DataOutput { method public abstract void close() throws java.io.IOException; method public abstract void flush() throws java.io.IOException; method public abstract void write(byte[]) throws java.io.IOException; @@ -31348,6 +31348,10 @@ package java.lang { ctor public AssertionError(double); } + public abstract interface AutoCloseable { + method public abstract void close() throws java.lang.Exception; + } + public final class Boolean implements java.lang.Comparable java.io.Serializable { ctor public Boolean(java.lang.String); ctor public Boolean(boolean); @@ -33403,7 +33407,7 @@ package java.net { method public synchronized void setSocketAddress(java.net.SocketAddress); } - public class DatagramSocket { + public class DatagramSocket implements java.io.Closeable { ctor public DatagramSocket() throws java.net.SocketException; ctor public DatagramSocket(int) throws java.net.SocketException; ctor public DatagramSocket(int, java.net.InetAddress) throws java.net.SocketException; @@ -33759,7 +33763,7 @@ package java.net { method public abstract java.util.List<java.security.cert.Certificate> getServerCertificateChain() throws javax.net.ssl.SSLPeerUnverifiedException; } - public class ServerSocket { + public class ServerSocket implements java.io.Closeable { ctor public ServerSocket() throws java.io.IOException; ctor public ServerSocket(int) throws java.io.IOException; ctor public ServerSocket(int, int) throws java.io.IOException; @@ -33785,7 +33789,7 @@ package java.net { method public static synchronized void setSocketFactory(java.net.SocketImplFactory) throws java.io.IOException; } - public class Socket { + public class Socket implements java.io.Closeable { ctor public Socket(); ctor public Socket(java.net.Proxy); ctor public Socket(java.lang.String, int) throws java.io.IOException, java.net.UnknownHostException; @@ -34463,9 +34467,10 @@ package java.nio.channels { field public static final java.nio.channels.FileChannel.MapMode READ_WRITE; } - public abstract class FileLock { + public abstract class FileLock implements java.lang.AutoCloseable { ctor protected FileLock(java.nio.channels.FileChannel, long, long, boolean); method public final java.nio.channels.FileChannel channel(); + method public final void close() throws java.io.IOException; method public final boolean isShared(); method public abstract boolean isValid(); method public final boolean overlaps(long, long); @@ -34580,7 +34585,7 @@ package java.nio.channels { field public static final int OP_WRITE = 4; // 0x4 } - public abstract class Selector { + public abstract class Selector implements java.io.Closeable { ctor protected Selector(); method public abstract void close() throws java.io.IOException; method public abstract boolean isOpen(); @@ -36516,7 +36521,7 @@ package java.sql { method public abstract void truncate(long) throws java.sql.SQLException; } - public abstract interface Connection implements java.sql.Wrapper { + public abstract interface Connection implements java.lang.AutoCloseable java.sql.Wrapper { method public abstract void clearWarnings() throws java.sql.SQLException; method public abstract void close() throws java.sql.SQLException; method public abstract void commit() throws java.sql.SQLException; @@ -36945,7 +36950,7 @@ package java.sql { method public abstract void setObject(java.lang.Object) throws java.sql.SQLException; } - public abstract interface ResultSet implements java.sql.Wrapper { + public abstract interface ResultSet implements java.lang.AutoCloseable java.sql.Wrapper { method public abstract boolean absolute(int) throws java.sql.SQLException; method public abstract void afterLast() throws java.sql.SQLException; method public abstract void beforeFirst() throws java.sql.SQLException; @@ -37451,7 +37456,7 @@ package java.sql { method public abstract java.lang.String getSavepointName() throws java.sql.SQLException; } - public abstract interface Statement implements java.sql.Wrapper { + public abstract interface Statement implements java.lang.AutoCloseable java.sql.Wrapper { method public abstract void addBatch(java.lang.String) throws java.sql.SQLException; method public abstract void cancel() throws java.sql.SQLException; method public abstract void clearBatch() throws java.sql.SQLException; @@ -39210,7 +39215,7 @@ package java.util { field public static final long TTL_NO_EXPIRATION_CONTROL = -2L; // 0xfffffffffffffffeL } - public final class Scanner implements java.util.Iterator { + public final class Scanner implements java.io.Closeable java.util.Iterator { ctor public Scanner(java.io.File) throws java.io.FileNotFoundException; ctor public Scanner(java.io.File, java.lang.String) throws java.io.FileNotFoundException; ctor public Scanner(java.lang.String); @@ -41330,7 +41335,7 @@ package java.util.zip { ctor public ZipException(java.lang.String); } - public class ZipFile { + public class ZipFile implements java.io.Closeable { ctor public ZipFile(java.io.File) throws java.io.IOException, java.util.zip.ZipException; ctor public ZipFile(java.lang.String) throws java.io.IOException; ctor public ZipFile(java.io.File, int) throws java.io.IOException; diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 0d2141f..75b8e97 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -10525,8 +10525,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * handler can be used to pump events in the UI events queue. */ public Handler getHandler() { - if (mAttachInfo != null) { - return mAttachInfo.mHandler; + final AttachInfo attachInfo = mAttachInfo; + if (attachInfo != null) { + return attachInfo.mHandler; } return null; } diff --git a/wifi/java/android/net/wifi/SupplicantStateTracker.java b/wifi/java/android/net/wifi/SupplicantStateTracker.java index d1e9b67..055bfb4 100644 --- a/wifi/java/android/net/wifi/SupplicantStateTracker.java +++ b/wifi/java/android/net/wifi/SupplicantStateTracker.java @@ -42,6 +42,7 @@ class SupplicantStateTracker extends StateMachine { private WifiStateMachine mWifiStateMachine; private WifiConfigStore mWifiConfigStore; private int mAuthenticationFailuresCount = 0; + private int mAssociationRejectCount = 0; /* Indicates authentication failure in supplicant broadcast. * TODO: enhance auth failure reporting to include notification * for all type of failures: EAP, WPS & WPA networks */ @@ -50,6 +51,9 @@ class SupplicantStateTracker extends StateMachine { /* Maximum retries on a authentication failure notification */ private static final int MAX_RETRIES_ON_AUTHENTICATION_FAILURE = 2; + /* Maximum retries on assoc rejection events */ + private static final int MAX_RETRIES_ON_ASSOCIATION_REJECT = 4; + /* Tracks if networks have been disabled during a connection */ private boolean mNetworksDisabledDuringConnect = false; @@ -85,14 +89,14 @@ class SupplicantStateTracker extends StateMachine { start(); } - private void handleNetworkConnectionFailure(int netId) { + private void handleNetworkConnectionFailure(int netId, int disableReason) { /* If other networks disabled during connection, enable them */ if (mNetworksDisabledDuringConnect) { mWifiConfigStore.enableAllNetworks(); mNetworksDisabledDuringConnect = false; } /* Disable failed network */ - mWifiConfigStore.disableNetwork(netId, WifiConfiguration.DISABLED_AUTH_FAILURE); + mWifiConfigStore.disableNetwork(netId, disableReason); } private void transitionOnSupplicantStateChange(StateChangeResult stateChangeResult) { @@ -178,6 +182,10 @@ class SupplicantStateTracker extends StateMachine { break; case WifiManager.CONNECT_NETWORK: mNetworksDisabledDuringConnect = true; + mAssociationRejectCount = 0; + break; + case WifiMonitor.ASSOCIATION_REJECTION_EVENT: + mAssociationRejectCount++; break; default: Log.e(TAG, "Ignoring " + message); @@ -222,9 +230,17 @@ class SupplicantStateTracker extends StateMachine { if (mAuthenticationFailuresCount >= MAX_RETRIES_ON_AUTHENTICATION_FAILURE) { Log.d(TAG, "Failed to authenticate, disabling network " + stateChangeResult.networkId); - handleNetworkConnectionFailure(stateChangeResult.networkId); + handleNetworkConnectionFailure(stateChangeResult.networkId, + WifiConfiguration.DISABLED_AUTH_FAILURE); mAuthenticationFailuresCount = 0; } + else if (mAssociationRejectCount >= MAX_RETRIES_ON_ASSOCIATION_REJECT) { + Log.d(TAG, "Association getting rejected, disabling network " + + stateChangeResult.networkId); + handleNetworkConnectionFailure(stateChangeResult.networkId, + WifiConfiguration.DISABLED_ASSOCIATION_REJECT); + mAssociationRejectCount = 0; + } } } @@ -264,7 +280,8 @@ class SupplicantStateTracker extends StateMachine { if (mLoopDetectCount > MAX_SUPPLICANT_LOOP_ITERATIONS) { Log.d(TAG, "Supplicant loop detected, disabling network " + stateChangeResult.networkId); - handleNetworkConnectionFailure(stateChangeResult.networkId); + handleNetworkConnectionFailure(stateChangeResult.networkId, + WifiConfiguration.DISABLED_AUTH_FAILURE); } mLoopDetectIndex = state.ordinal(); sendSupplicantStateChangedBroadcast(state, @@ -287,6 +304,7 @@ class SupplicantStateTracker extends StateMachine { if (DBG) Log.d(TAG, getName() + "\n"); /* Reset authentication failure count */ mAuthenticationFailuresCount = 0; + mAssociationRejectCount = 0; if (mNetworksDisabledDuringConnect) { mWifiConfigStore.enableAllNetworks(); mNetworksDisabledDuringConnect = false; diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java index bf82792..f1542e9 100644 --- a/wifi/java/android/net/wifi/WifiConfiguration.java +++ b/wifi/java/android/net/wifi/WifiConfiguration.java @@ -173,6 +173,8 @@ public class WifiConfiguration implements Parcelable { public static final int DISABLED_DHCP_FAILURE = 2; /** @hide */ public static final int DISABLED_AUTH_FAILURE = 3; + /** @hide */ + public static final int DISABLED_ASSOCIATION_REJECT = 4; /** * The ID number that the supplicant uses to identify this diff --git a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java index 7313e7e..25272b9 100644 --- a/wifi/java/android/net/wifi/WifiEnterpriseConfig.java +++ b/wifi/java/android/net/wifi/WifiEnterpriseConfig.java @@ -87,6 +87,7 @@ public class WifiEnterpriseConfig implements Parcelable { private static final String ENGINE_KEY = "engine"; private static final String ENGINE_ID_KEY = "engine_id"; private static final String PRIVATE_KEY_ID_KEY = "key_id"; + private static final String OPP_KEY_CACHING = "proactive_key_caching"; private HashMap<String, String> mFields = new HashMap<String, String>(); private X509Certificate mCaCert; @@ -258,6 +259,7 @@ public class WifiEnterpriseConfig implements Parcelable { case Eap.TLS: case Eap.TTLS: mFields.put(EAP_KEY, Eap.strings[eapMethod]); + mFields.put(OPP_KEY_CACHING, "1"); break; default: throw new IllegalArgumentException("Unknown EAP method"); diff --git a/wifi/java/android/net/wifi/WifiMonitor.java b/wifi/java/android/net/wifi/WifiMonitor.java index 0b0d738..fe3c709 100644 --- a/wifi/java/android/net/wifi/WifiMonitor.java +++ b/wifi/java/android/net/wifi/WifiMonitor.java @@ -56,7 +56,8 @@ public class WifiMonitor { private static final int TERMINATING = 6; private static final int DRIVER_STATE = 7; private static final int EAP_FAILURE = 8; - private static final int UNKNOWN = 9; + private static final int ASSOC_REJECT = 9; + private static final int UNKNOWN = 10; /** All events coming from the supplicant start with this prefix */ private static final String EVENT_PREFIX_STR = "CTRL-EVENT-"; @@ -153,6 +154,11 @@ public class WifiMonitor { private static final String EAP_AUTH_FAILURE_STR = "EAP authentication failed"; /** + * This indicates an assoc reject event + */ + private static final String ASSOC_REJECT_STR = "ASSOC-REJECT"; + + /** * Regex pattern for extracting an Ethernet-style MAC address from a string. * Matches a strings like the following:<pre> * CTRL-EVENT-CONNECTED - Connection to 00:1e:58:ec:d5:6d completed (reauth) [id=1 id_str=]</pre> @@ -328,6 +334,8 @@ public class WifiMonitor { public static final int AP_STA_DISCONNECTED_EVENT = BASE + 41; public static final int AP_STA_CONNECTED_EVENT = BASE + 42; + /* Indicates assoc reject event */ + public static final int ASSOCIATION_REJECTION_EVENT = BASE + 43; /** * This indicates the supplicant connection for the monitor is closed */ @@ -429,6 +437,8 @@ public class WifiMonitor { event = DRIVER_STATE; else if (eventName.equals(EAP_FAILURE_STR)) event = EAP_FAILURE; + else if (eventName.equals(ASSOC_REJECT_STR)) + event = ASSOC_REJECT; else event = UNKNOWN; @@ -473,6 +483,8 @@ public class WifiMonitor { if (eventData.startsWith(EAP_AUTH_FAILURE_STR)) { mStateMachine.sendMessage(AUTHENTICATION_FAILURE_EVENT); } + } else if (event == ASSOC_REJECT) { + mStateMachine.sendMessage(ASSOCIATION_REJECTION_EVENT); } else { handleEvent(event, eventData); } diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index 2ab59e3..880040b 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -1962,6 +1962,7 @@ public class WifiStateMachine extends StateMachine { case WifiMonitor.SCAN_RESULTS_EVENT: case WifiMonitor.SUPPLICANT_STATE_CHANGE_EVENT: case WifiMonitor.AUTHENTICATION_FAILURE_EVENT: + case WifiMonitor.ASSOCIATION_REJECTION_EVENT: case WifiMonitor.WPS_OVERLAP_EVENT: case CMD_BLACKLIST_NETWORK: case CMD_CLEAR_BLACKLIST: @@ -2698,6 +2699,7 @@ public class WifiStateMachine extends StateMachine { case WifiMonitor.NETWORK_CONNECTION_EVENT: case WifiMonitor.NETWORK_DISCONNECTION_EVENT: case WifiMonitor.AUTHENTICATION_FAILURE_EVENT: + case WifiMonitor.ASSOCIATION_REJECTION_EVENT: case WifiMonitor.WPS_OVERLAP_EVENT: case CMD_SET_SCAN_TYPE: case CMD_SET_COUNTRY_CODE: @@ -3092,6 +3094,9 @@ public class WifiStateMachine extends StateMachine { if (DBG) log(getName() + message.toString() + "\n"); StateChangeResult stateChangeResult; switch(message.what) { + case WifiMonitor.ASSOCIATION_REJECTION_EVENT: + mSupplicantStateTracker.sendMessage(WifiMonitor.ASSOCIATION_REJECTION_EVENT); + break; case WifiMonitor.AUTHENTICATION_FAILURE_EVENT: mSupplicantStateTracker.sendMessage(WifiMonitor.AUTHENTICATION_FAILURE_EVENT); break; @@ -3786,6 +3791,9 @@ public class WifiStateMachine extends StateMachine { if (DBG) log("Network connection lost"); handleNetworkDisconnect(); break; + case WifiMonitor.ASSOCIATION_REJECTION_EVENT: + if (DBG) log("Ignore Assoc reject event during WPS Connection"); + break; case WifiMonitor.AUTHENTICATION_FAILURE_EVENT: // Disregard auth failure events during WPS connection. The // EAP sequence is retried several times, and there might be diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java index 532148e..3325b2b 100644 --- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java +++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java @@ -1312,6 +1312,11 @@ public class WifiP2pService extends IWifiP2pManager.Stub { * TODO: Verify multi-channel scenarios and supplicant behavior are * better before adding a time out in future */ + //Set group idle timeout of 10 sec, to avoid GO beaconing incase of any + //failure during 4-way Handshake. + if (!mAutonomousGroup) { + mWifiNative.setP2pGroupIdle(mGroup.getInterface(), GROUP_IDLE_TIME_S); + } startDhcpServer(mGroup.getInterface()); } else { mWifiNative.setP2pGroupIdle(mGroup.getInterface(), GROUP_IDLE_TIME_S); @@ -1507,6 +1512,8 @@ public class WifiP2pService extends IWifiP2pManager.Stub { case WifiMonitor.AP_STA_CONNECTED_EVENT: WifiP2pDevice device = (WifiP2pDevice) message.obj; String deviceAddress = device.deviceAddress; + // Clear timeout that was set when group was started. + mWifiNative.setP2pGroupIdle(mGroup.getInterface(), 0); if (deviceAddress != null) { if (mSavedProvDiscDevice != null && deviceAddress.equals(mSavedProvDiscDevice.deviceAddress)) { |