diff options
author | Jimmy Chen <jimmycmchen@google.com> | 2018-10-30 12:00:37 +0800 |
---|---|---|
committer | Jimmy Chen <jimmycmchen@google.com> | 2018-11-05 11:30:22 +0800 |
commit | 6d9d62a0edf91ec72639556e0d3a36be4b4ba501 (patch) | |
tree | bd3af8ff286109fb5c04a7fe11d4f3f4e3d4c9fb | |
parent | 01d1d200d69e83238f44aa5a0e43051125730ecf (diff) |
ClientModeImpl: Remove CMD_ENABLE_P2P & CMD_DISABLE_P2P with P2P service
The interactions being removed are:
Enable/Disable P2P - This was a message sent by wifi service to p2p
service when wpa_supplicant is brought up/down (i.e client mode). In P,
we added a mechanism for p2p service to directly listen for the public
WIFI_STATE_CHANGED broadcast to shut itself down.
Bug: 76031270
Test: Unit tests - atest frameworks/opt/net/wifi/tests/wifitests
Test: CtsVerifier - WiFi Direct category
Test: Device boots up & connects to networks.
Change-Id: If7fd794b0e3685f7a4d8bbac23bb7cb49c34c76f
-rw-r--r-- | service/java/com/android/server/wifi/ClientModeImpl.java | 48 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java | 15 |
2 files changed, 0 insertions, 63 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index 7781805b2..4e6d7c5dd 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -512,20 +512,6 @@ public class ClientModeImpl extends StateMachine { int mDisconnectingWatchdogCount = 0; static final int DISCONNECTING_GUARD_TIMER_MSEC = 5000; - /* Disable p2p watchdog */ - static final int CMD_DISABLE_P2P_WATCHDOG_TIMER = BASE + 112; - - int mDisableP2pWatchdogCount = 0; - static final int DISABLE_P2P_GUARD_TIMER_MSEC = 2000; - - /* P2p commands */ - /* We are ok with no response here since we wont do much with it anyway */ - public static final int CMD_ENABLE_P2P = BASE + 131; - /* In order to shut down supplicant cleanly, we wait till p2p has - * been disabled */ - public static final int CMD_DISABLE_P2P_REQ = BASE + 132; - public static final int CMD_DISABLE_P2P_RSP = BASE + 133; - /** * Indicates the end of boot process, should be used to trigger load from config store, * initiate connection attempt, etc. @@ -2351,13 +2337,6 @@ public class ClientModeImpl extends StateMachine { sb.append(Integer.toString(msg.arg2)); sb.append(" cur=").append(mDisconnectingWatchdogCount); break; - case CMD_DISABLE_P2P_WATCHDOG_TIMER: - sb.append(" "); - sb.append(Integer.toString(msg.arg1)); - sb.append(" "); - sb.append(Integer.toString(msg.arg2)); - sb.append(" cur=").append(mDisableP2pWatchdogCount); - break; case CMD_START_RSSI_MONITORING_OFFLOAD: case CMD_STOP_RSSI_MONITORING_OFFLOAD: case CMD_RSSI_THRESHOLD_BREACHED: @@ -3305,15 +3284,6 @@ public class ClientModeImpl extends StateMachine { if (ac == mWifiP2pChannel) { if (message.arg1 == AsyncChannel.STATUS_SUCCESSFUL) { p2pSendMessage(AsyncChannel.CMD_CHANNEL_FULL_CONNECTION); - // since the p2p channel is connected, we should enable p2p if we are in - // connect mode. We may not be in connect mode yet, we may have just - // set the operational mode and started to set up for connect mode. - if (mOperationalMode == CONNECT_MODE) { - // This message will only be handled if we are in Connect mode. - // If we are not in connect mode yet, this will be dropped and the - // ConnectMode.enter method will call to enable p2p. - sendMessage(CMD_ENABLE_P2P); - } } else { // TODO: We should probably do some cleanup or attempt a retry // b/34283611 @@ -3406,8 +3376,6 @@ public class ClientModeImpl extends StateMachine { case DhcpClient.CMD_PRE_DHCP_ACTION: case DhcpClient.CMD_PRE_DHCP_ACTION_COMPLETE: case DhcpClient.CMD_POST_DHCP_ACTION: - case CMD_ENABLE_P2P: - case CMD_DISABLE_P2P_RSP: case WifiMonitor.SUP_REQUEST_IDENTITY: case WifiMonitor.SUP_REQUEST_SIM_AUTH: case CMD_TARGET_BSSID: @@ -3417,7 +3385,6 @@ public class ClientModeImpl extends StateMachine { case CMD_UNWANTED_NETWORK: case CMD_DISCONNECTING_WATCHDOG_TIMER: case CMD_ROAM_WATCHDOG_TIMER: - case CMD_DISABLE_P2P_WATCHDOG_TIMER: case CMD_DISABLE_EPHEMERAL_NETWORK: mMessageHandlingStatus = MESSAGE_HANDLING_STATUS_DISCARD; break; @@ -3747,10 +3714,6 @@ public class ClientModeImpl extends StateMachine { mWifiNative.setPowerSave(mInterfaceName, true); - if (mP2pSupported) { - p2pSendMessage(ClientModeImpl.CMD_ENABLE_P2P); - } - // Disable wpa_supplicant from auto reconnecting. mWifiNative.enableStaAutoReconnect(mInterfaceName, false); // STA has higher priority over P2P @@ -3764,12 +3727,6 @@ public class ClientModeImpl extends StateMachine { // exiting supplicant started state is now only applicable to client mode mWifiDiagnostics.stopLogging(); - if (mP2pSupported) { - // we are not going to wait for a response - will still temporarily send the - // disable command until p2p can detect the interface up/down on its own. - p2pSendMessage(ClientModeImpl.CMD_DISABLE_P2P_REQ); - } - mIsRunning = false; updateBatteryWorkSource(null); @@ -3866,8 +3823,6 @@ public class ClientModeImpl extends StateMachine { // Inform metrics that Wifi is Enabled (but not yet connected) mWifiMetrics.setWifiState(WifiMetricsProto.WifiLog.WIFI_DISCONNECTED); mWifiMetrics.logStaEvent(StaEvent.TYPE_WIFI_ENABLED); - // Inform p2p service that wifi is up and ready when applicable - p2pSendMessage(ClientModeImpl.CMD_ENABLE_P2P); // Inform sar manager that wifi is Enabled mSarManager.setClientWifiState(WifiManager.WIFI_STATE_ENABLED); } @@ -4411,9 +4366,6 @@ public class ClientModeImpl extends StateMachine { replyToMessage(message, message.what, FAILURE); } break; - case CMD_ENABLE_P2P: - p2pSendMessage(ClientModeImpl.CMD_ENABLE_P2P); - break; case CMD_GET_ALL_MATCHING_CONFIGS: replyToMessage(message, message.what, mPasspointManager.getAllMatchingWifiConfigs((ScanResult) message.obj)); diff --git a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java index e7f3bc979..1a1ec8c4e 100644 --- a/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java +++ b/service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java @@ -79,7 +79,6 @@ import com.android.internal.util.AsyncChannel; import com.android.internal.util.Protocol; import com.android.internal.util.State; import com.android.internal.util.StateMachine; -import com.android.server.wifi.ClientModeImpl; import com.android.server.wifi.WifiInjector; import com.android.server.wifi.util.WifiAsyncChannel; import com.android.server.wifi.util.WifiHandler; @@ -978,11 +977,6 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub { break; case DISABLE_P2P: // If we end up handling in default, p2p is not enabled - if (mWifiChannel != null) { - mWifiChannel.sendMessage(ClientModeImpl.CMD_DISABLE_P2P_RSP); - } else { - loge("Unexpected disable request when WifiChannel is null"); - } break; case WifiP2pMonitor.P2P_GROUP_STARTED_EVENT: // unexpected group created, remove @@ -1133,15 +1127,6 @@ public class WifiP2pServiceImpl extends IWifiP2pManager.Stub { } return HANDLED; } - - @Override - public void exit() { - if (mWifiChannel != null) { - mWifiChannel.sendMessage(ClientModeImpl.CMD_DISABLE_P2P_RSP); - } else { - loge("P2pDisablingState exit(): WifiChannel is null"); - } - } } class P2pDisabledState extends State { |