diff options
author | Roshan Pius <rpius@google.com> | 2017-03-21 14:10:56 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2017-03-27 10:15:21 -0700 |
commit | 8aebfed96d10c3ef93ece3974e602b36c3e81f4a (patch) | |
tree | 692cd110b1c22df10608d3139523d653cb9af26b /service | |
parent | f06fd7eebff96a7d0cacfc72a1c01ca34b129755 (diff) |
WifiStateMachine: Remove unused code
Remove the deprecated events/API handling in WSM:
1. WifiMonitor.SSID_TEMP_DISABLED
2. WifiMonitor.SSID_RENABLED
3. WifiMonitor.DRIVER_HUNG
Also, Removed the pingSupplicant handling as that API has now been
removed.
Bug: 36404409
Test: Compiles
Change-Id: I3762bea36f682eac0694e667addc919e7db6fcaa
Diffstat (limited to 'service')
3 files changed, 3 insertions, 139 deletions
diff --git a/service/java/com/android/server/wifi/WifiMonitor.java b/service/java/com/android/server/wifi/WifiMonitor.java index c4f0bdedb..6c8ac813f 100644 --- a/service/java/com/android/server/wifi/WifiMonitor.java +++ b/service/java/com/android/server/wifi/WifiMonitor.java @@ -72,13 +72,6 @@ public class WifiMonitor { public static final int WPS_OVERLAP_EVENT = BASE + 10; /* WPS timeout detected */ public static final int WPS_TIMEOUT_EVENT = BASE + 11; - /* Driver was hung */ - public static final int DRIVER_HUNG_EVENT = BASE + 12; - /* SSID was disabled due to auth failure or excessive - * connection failures */ - public static final int SSID_TEMP_DISABLED = BASE + 13; - /* SSID reenabled by supplicant */ - public static final int SSID_REENABLED = BASE + 14; /* Request Identity */ public static final int SUP_REQUEST_IDENTITY = BASE + 15; diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java index a95ddabc8..757be2dac 100644 --- a/service/java/com/android/server/wifi/WifiServiceImpl.java +++ b/service/java/com/android/server/wifi/WifiServiceImpl.java @@ -441,22 +441,6 @@ public class WifiServiceImpl extends IWifiManager.Stub { } /** - * see {@link android.net.wifi.WifiManager#pingSupplicant()} - * @return {@code true} if the operation succeeds, {@code false} otherwise - */ - @Override - public boolean pingSupplicant() { - enforceAccessPermission(); - mLog.trace("pingSupplicant uid=%").c(Binder.getCallingUid()).flush(); - if (mWifiStateMachineChannel != null) { - return mWifiStateMachine.syncPingSupplicant(mWifiStateMachineChannel); - } else { - Slog.e(TAG, "mWifiStateMachineChannel is not initialized"); - return false; - } - } - - /** * see {@link android.net.wifi.WifiManager#startScan} * and {@link android.net.wifi.WifiManager#startCustomizedScan} * diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index 50c8f4ef8..835e97c25 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -483,8 +483,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss static final int CMD_BLUETOOTH_ADAPTER_STATE_CHANGE = BASE + 31; /* Supplicant commands */ - /* Is supplicant alive ? */ - static final int CMD_PING_SUPPLICANT = BASE + 51; /* Add/update a network configuration */ static final int CMD_ADD_OR_UPDATE_NETWORK = BASE + 52; /* Delete a network */ @@ -1041,7 +1039,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss getHandler()); mWifiMonitor.registerHandler(mInterfaceName, WifiMonitor.AUTHENTICATION_FAILURE_EVENT, getHandler()); - mWifiMonitor.registerHandler(mInterfaceName, WifiMonitor.DRIVER_HUNG_EVENT, getHandler()); mWifiMonitor.registerHandler(mInterfaceName, WifiMonitor.GAS_QUERY_DONE_EVENT, getHandler()); mWifiMonitor.registerHandler(mInterfaceName, WifiMonitor.GAS_QUERY_START_EVENT, getHandler()); @@ -1055,8 +1052,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss getHandler()); mWifiMonitor.registerHandler(mInterfaceName, WifiMonitor.SCAN_FAILED_EVENT, getHandler()); mWifiMonitor.registerHandler(mInterfaceName, WifiMonitor.SCAN_RESULTS_EVENT, getHandler()); - mWifiMonitor.registerHandler(mInterfaceName, WifiMonitor.SSID_REENABLED, getHandler()); - mWifiMonitor.registerHandler(mInterfaceName, WifiMonitor.SSID_TEMP_DISABLED, getHandler()); mWifiMonitor.registerHandler(mInterfaceName, WifiMonitor.SUP_CONNECTION_EVENT, getHandler()); mWifiMonitor.registerHandler(mInterfaceName, WifiMonitor.SUP_DISCONNECTION_EVENT, getHandler()); @@ -1294,16 +1289,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss } /** - * TODO: doc - */ - public boolean syncPingSupplicant(AsyncChannel channel) { - Message resultMsg = channel.sendMessageSynchronously(CMD_PING_SUPPLICANT); - boolean result = (resultMsg.arg1 != FAILURE); - resultMsg.recycle(); - return result; - } - - /** * Initiate a wifi scan. If workSource is not null, blame is given to it, otherwise blame is * given to callingUid. * @@ -2394,40 +2379,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss sb.append(" debounce"); } break; - case WifiMonitor.SSID_TEMP_DISABLED: - case WifiMonitor.SSID_REENABLED: - sb.append(" nid=").append(msg.arg1); - if (msg.obj != null) { - sb.append(" ").append((String) msg.obj); - } - config = getCurrentWifiConfiguration(); - if (config != null) { - WifiConfiguration.NetworkSelectionStatus netWorkSelectionStatus = - config.getNetworkSelectionStatus(); - sb.append(" cur=").append(config.configKey()); - sb.append(" ajst=").append(netWorkSelectionStatus.getNetworkStatusString()); - if (config.selfAdded) { - sb.append(" selfAdded"); - } - if (config.status != 0) { - sb.append(" st=").append(config.status); - sb.append(" rs=").append( - netWorkSelectionStatus.getNetworkDisableReasonString()); - } - if (config.lastConnected != 0) { - now = mClock.getWallClockMillis(); - sb.append(" lastconn=").append(now - config.lastConnected).append("(ms)"); - } - if (mLastBssid != null) { - sb.append(" lastbssid=").append(mLastBssid); - } - if (mWifiInfo.getFrequency() != -1) { - sb.append(" freq=").append(mWifiInfo.getFrequency()); - sb.append(" rssi=").append(mWifiInfo.getRssi()); - sb.append(" bssid=").append(mWifiInfo.getBSSID()); - } - } - break; case CMD_RSSI_POLL: case CMD_UNWANTED_NETWORK: case WifiManager.RSSI_PKTCNT_FETCH: @@ -3701,8 +3652,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss mBluetoothConnectionActive = (message.arg1 != BluetoothAdapter.STATE_DISCONNECTED); break; - /* Synchronous call returns */ - case CMD_PING_SUPPLICANT: case CMD_ENABLE_NETWORK: case CMD_ADD_OR_UPDATE_NETWORK: case CMD_SAVE_CONFIG: @@ -3799,10 +3748,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss setSuspendOptimizations(SUSPEND_DUE_TO_SCREEN, false); } break; - case WifiMonitor.DRIVER_HUNG_EVENT: - setSupplicantRunning(false); - setSupplicantRunning(true); - break; case WifiManager.CONNECT_NETWORK: replyToMessage(message, WifiManager.CONNECT_NETWORK_FAILED, WifiManager.BUSY); @@ -4254,10 +4199,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss if (mBufferedScanMsg.size() > 0) sendMessage(mBufferedScanMsg.remove()); break; - case CMD_PING_SUPPLICANT: - // TODO (b/35620640): Remove this command since the API is deprecated. - replyToMessage(message, message.what, FAILURE); - break; case CMD_START_AP: /* Cannot start soft AP while in client mode */ loge("Failed to start soft AP with a running supplicant"); @@ -4492,9 +4433,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss return s; } switch (what) { - case WifiMonitor.DRIVER_HUNG_EVENT: - s = "DRIVER_HUNG_EVENT"; - break; case AsyncChannel.CMD_CHANNEL_HALF_CONNECTED: s = "AsyncChannel.CMD_CHANNEL_HALF_CONNECTED"; break; @@ -4534,12 +4472,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss case WifiMonitor.AUTHENTICATION_FAILURE_EVENT: s = "AUTHENTICATION_FAILURE_EVENT"; break; - case WifiMonitor.SSID_TEMP_DISABLED: - s = "SSID_TEMP_DISABLED"; - break; - case WifiMonitor.SSID_REENABLED: - s = "SSID_REENABLED"; - break; case WifiMonitor.WPS_SUCCESS_EVENT: s = "WPS_SUCCESS_EVENT"; break; @@ -4771,14 +4703,9 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss mWifiDiagnostics.captureBugReportData( WifiDiagnostics.REPORT_REASON_AUTH_FAILURE); mSupplicantStateTracker.sendMessage(WifiMonitor.AUTHENTICATION_FAILURE_EVENT); - // In case of wrong password, rely on SSID_TEMP_DISABLE event to update - // the WifiConfigManager - if ((message.arg2 != WifiMonitor.AUTHENTICATION_FAILURE_REASON_WRONG_PSWD) - && (mTargetNetworkId != WifiConfiguration.INVALID_NETWORK_ID)) { - mWifiConfigManager.updateNetworkSelectionStatus(mTargetNetworkId, - WifiConfiguration.NetworkSelectionStatus - .DISABLED_AUTHENTICATION_FAILURE); - } + mWifiConfigManager.updateNetworkSelectionStatus(mTargetNetworkId, + WifiConfiguration.NetworkSelectionStatus + .DISABLED_AUTHENTICATION_FAILURE); //If failure occurred while Metrics is tracking a ConnnectionEvent, end it. reportConnectionAttemptEnd( WifiMetrics.ConnectionEvent.FAILURE_AUTHENTICATION_FAILURE, @@ -4788,29 +4715,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss getTargetSsid(), mTargetRoamBSSID, WifiLastResortWatchdog.FAILURE_CODE_AUTHENTICATION); break; - case WifiMonitor.SSID_TEMP_DISABLED: - netId = lookupFrameworkNetworkId(message.arg1); - Log.e(TAG, "Supplicant SSID temporary disabled:" - + mWifiConfigManager.getConfiguredNetwork(netId)); - mWifiConfigManager.updateNetworkSelectionStatus( - netId, - WifiConfiguration.NetworkSelectionStatus - .DISABLED_AUTHENTICATION_FAILURE); - reportConnectionAttemptEnd( - WifiMetrics.ConnectionEvent.FAILURE_SSID_TEMP_DISABLED, - WifiMetricsProto.ConnectionEvent.HLF_NONE); - mWifiInjector.getWifiLastResortWatchdog() - .noteConnectionFailureAndTriggerIfNeeded( - getTargetSsid(), mTargetRoamBSSID, - WifiLastResortWatchdog.FAILURE_CODE_AUTHENTICATION); - break; - case WifiMonitor.SSID_REENABLED: - netId = lookupFrameworkNetworkId(message.arg1); - Log.d(TAG, "Supplicant SSID reenable:" - + mWifiConfigManager.getConfiguredNetwork(netId)); - // Do not re-enable it in Quality Network Selection since framework has its own - // Algorithm of disable/enable - break; case WifiMonitor.SUPPLICANT_STATE_CHANGE_EVENT: SupplicantState state = handleSupplicantStateChange(message); // A driver/firmware hang can now put the interface in a down state. @@ -6019,23 +5923,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss transitionTo(mDisconnectedState); } break; - case WifiMonitor.SSID_TEMP_DISABLED: - // Auth error while roaming - int netId = lookupFrameworkNetworkId(message.arg1); - logd("SSID_TEMP_DISABLED nid=" + Integer.toString(mLastNetworkId) - + " id=" + netId - + " isRoaming=" + isRoaming() - + " roam=" + mAutoRoaming); - if (netId == mLastNetworkId) { - config = getCurrentWifiConfiguration(); - if (config != null) { - mWifiDiagnostics.captureBugReportData( - WifiDiagnostics.REPORT_REASON_AUTOROAM_FAILURE); - } - handleNetworkDisconnect(); - transitionTo(mDisconnectingState); - } - return NOT_HANDLED; case CMD_START_SCAN: deferMessage(message); break; |