summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2019-03-22 22:33:31 +0000
committerRoshan Pius <rpius@google.com>2019-03-22 22:33:31 +0000
commitf94353bbd50b7afdcdc01bf88f532acb117db21a (patch)
tree604173a5d6f825a68d7513a83c7cb3f24197608f /service
parent0cd22728c628e51e8f259f8404a97dec49804424 (diff)
Revert "WifiConfigManager: Temporarily blacklist on disconnect"
This reverts commit 0cd22728c628e51e8f259f8404a97dec49804424. Bug: 126503889 Reason for revert: UI changes was punted to R. No rationale in making this API changing behavior now. Change-Id: Ie8cd931980d2eb0c7bf660cb0fa646848d315a71
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java49
-rw-r--r--service/java/com/android/server/wifi/WifiConfigManager.java6
-rw-r--r--service/java/com/android/server/wifi/WifiNetworkFactory.java2
-rw-r--r--service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java2
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java2
5 files changed, 24 insertions, 37 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index 1b460cb90..444219d2b 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -17,7 +17,6 @@
package com.android.server.wifi;
import static android.net.shared.LinkPropertiesParcelableUtil.toStableParcelable;
-import static android.net.wifi.WifiConfiguration.NetworkSelectionStatus.DISABLED_BY_WIFI_MANAGER_DISCONNECT;
import static android.net.wifi.WifiManager.WIFI_STATE_DISABLED;
import static android.net.wifi.WifiManager.WIFI_STATE_DISABLING;
import static android.net.wifi.WifiManager.WIFI_STATE_ENABLED;
@@ -1588,19 +1587,20 @@ public class ClientModeImpl extends StateMachine {
}
/**
- * Method to trigger a disconnect.
- * Note: To be used from within the wifi stack.
+ * Disconnect from Access Point
*/
- public void disconnectCommandInternal() {
- sendMessage(CMD_DISCONNECT, 0 /* fromExternal */);
+ public void disconnectCommand() {
+ sendMessage(CMD_DISCONNECT);
}
/**
* Method to trigger a disconnect.
- * Note: To be used from public API surface.
+ *
+ * @param uid UID of requesting caller
+ * @param reason disconnect reason
*/
- public void disconnectCommandExternal() {
- sendMessage(CMD_DISCONNECT, 1 /* fromExternal */);
+ public void disconnectCommand(int uid, int reason) {
+ sendMessage(CMD_DISCONNECT, uid, reason);
}
/**
@@ -3671,7 +3671,7 @@ public class ClientModeImpl extends StateMachine {
if (removedNetworkIds.contains(mTargetNetworkId)
|| removedNetworkIds.contains(mLastNetworkId)) {
// Disconnect and let autojoin reselect a new network
- disconnectCommandInternal();
+ sendMessage(CMD_DISCONNECT);
}
break;
case CMD_USER_UNLOCK:
@@ -4129,7 +4129,7 @@ public class ClientModeImpl extends StateMachine {
netId = message.arg1;
if (netId == mTargetNetworkId || netId == mLastNetworkId) {
// Disconnect and let autojoin reselect a new network
- disconnectCommandInternal();
+ sendMessage(CMD_DISCONNECT);
}
break;
case CMD_ENABLE_NETWORK:
@@ -4153,7 +4153,7 @@ public class ClientModeImpl extends StateMachine {
replyToMessage(message, WifiManager.DISABLE_NETWORK_SUCCEEDED);
if (netId == mTargetNetworkId || netId == mLastNetworkId) {
// Disconnect and let autojoin reselect a new network
- disconnectCommandInternal();
+ sendMessage(CMD_DISCONNECT);
}
} else {
loge("Failed to disable network");
@@ -4168,7 +4168,7 @@ public class ClientModeImpl extends StateMachine {
if (config.networkId == mTargetNetworkId
|| config.networkId == mLastNetworkId) {
// Disconnect and let autojoin reselect a new network
- disconnectCommandInternal();
+ sendMessage(CMD_DISCONNECT);
}
}
break;
@@ -4328,7 +4328,7 @@ public class ClientModeImpl extends StateMachine {
if (removedNetworkIds.contains(mTargetNetworkId)
|| removedNetworkIds.contains(mLastNetworkId)) {
// Disconnect and let autojoin reselect a new network.
- disconnectCommandInternal();
+ sendMessage(CMD_DISCONNECT);
}
break;
case CMD_REMOVE_USER_CONFIGURATIONS:
@@ -4337,7 +4337,7 @@ public class ClientModeImpl extends StateMachine {
if (removedNetworkIds.contains(mTargetNetworkId)
|| removedNetworkIds.contains(mLastNetworkId)) {
// Disconnect and let autojoin reselect a new network.
- disconnectCommandInternal();
+ sendMessage(CMD_DISCONNECT);
}
break;
case WifiManager.CONNECT_NETWORK:
@@ -4418,7 +4418,7 @@ public class ClientModeImpl extends StateMachine {
netId = message.arg1;
if (netId == mTargetNetworkId || netId == mLastNetworkId) {
// Disconnect and let autojoin reselect a new network
- disconnectCommandInternal();
+ sendMessage(CMD_DISCONNECT);
}
break;
case CMD_ASSOCIATED_BSSID:
@@ -4482,7 +4482,7 @@ public class ClientModeImpl extends StateMachine {
} else {
logw("Connected to unknown networkId " + mLastNetworkId
+ ", disconnecting...");
- disconnectCommandInternal();
+ sendMessage(CMD_DISCONNECT);
}
break;
case WifiMonitor.NETWORK_DISCONNECTION_EVENT:
@@ -4515,7 +4515,7 @@ public class ClientModeImpl extends StateMachine {
if (isProviderOwnedNetwork(mTargetNetworkId, fqdn)
|| isProviderOwnedNetwork(mLastNetworkId, fqdn)) {
logd("Disconnect from current network since its provider is updated");
- disconnectCommandInternal();
+ sendMessage(CMD_DISCONNECT);
}
replyToMessage(message, message.what, SUCCESS);
} else {
@@ -4528,7 +4528,7 @@ public class ClientModeImpl extends StateMachine {
if (isProviderOwnedNetwork(mTargetNetworkId, fqdn)
|| isProviderOwnedNetwork(mLastNetworkId, fqdn)) {
logd("Disconnect from current network since its provider is removed");
- disconnectCommandInternal();
+ sendMessage(CMD_DISCONNECT);
}
mWifiConfigManager.removePasspointConfiguredNetwork(fqdn);
replyToMessage(message, message.what, SUCCESS);
@@ -5055,17 +5055,8 @@ public class ClientModeImpl extends StateMachine {
}
break;
case CMD_DISCONNECT:
- boolean fromExternal = message.arg1 == 1;
- if (fromExternal) {
- mWifiMetrics.logStaEvent(StaEvent.TYPE_FRAMEWORK_DISCONNECT,
- StaEvent.DISCONNECT_API);
- // For external disconnect requests, temporarily disable the network.
- mWifiConfigManager.updateNetworkSelectionStatus(
- mLastNetworkId, DISABLED_BY_WIFI_MANAGER_DISCONNECT);
- } else {
- mWifiMetrics.logStaEvent(StaEvent.TYPE_FRAMEWORK_DISCONNECT,
- StaEvent.DISCONNECT_GENERIC);
- }
+ mWifiMetrics.logStaEvent(StaEvent.TYPE_FRAMEWORK_DISCONNECT,
+ StaEvent.DISCONNECT_GENERIC);
mWifiNative.disconnect(mInterfaceName);
transitionTo(mDisconnectingState);
break;
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index 92bec08a3..dfb3cd20f 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -16,8 +16,6 @@
package com.android.server.wifi;
-import static android.net.wifi.WifiConfiguration.NetworkSelectionStatus.NETWORK_SELECTION_DISABLED_PERMANENT_STARTING_INDEX;
-
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.admin.DeviceAdminInfo;
@@ -128,7 +126,6 @@ public class WifiConfigManager {
1, // threshold for DISABLED_NO_INTERNET_TEMPORARY
1, // threshold for DISABLED_WPS_START
6, // threshold for DISABLED_TLS_VERSION_MISMATCH
- 1, // threshold for DISABLED_BY_WIFI_MANAGER_DISCONNECT
1, // threshold for DISABLED_AUTHENTICATION_NO_CREDENTIALS
1, // threshold for DISABLED_NO_INTERNET_PERMANENT
1, // threshold for DISABLED_BY_WIFI_MANAGER
@@ -153,7 +150,6 @@ public class WifiConfigManager {
10 * 60 * 1000, // threshold for DISABLED_NO_INTERNET_TEMPORARY
0 * 60 * 1000, // threshold for DISABLED_WPS_START
Integer.MAX_VALUE, // threshold for DISABLED_TLS_VERSION
- 1 * 60 * 60 * 1000, // threshold for DISABLED_BY_WIFI_MANAGER_DISCONNECT
Integer.MAX_VALUE, // threshold for DISABLED_AUTHENTICATION_NO_CREDENTIALS
Integer.MAX_VALUE, // threshold for DISABLED_NO_INTERNET_PERMANENT
Integer.MAX_VALUE, // threshold for DISABLED_BY_WIFI_MANAGER
@@ -1568,7 +1564,7 @@ public class WifiConfigManager {
if (reason == NetworkSelectionStatus.NETWORK_SELECTION_ENABLE) {
setNetworkSelectionEnabled(config);
setNetworkStatus(config, WifiConfiguration.Status.ENABLED);
- } else if (reason < NETWORK_SELECTION_DISABLED_PERMANENT_STARTING_INDEX) {
+ } else if (reason < NetworkSelectionStatus.DISABLED_TLS_VERSION_MISMATCH) {
setNetworkSelectionTemporarilyDisabled(config, reason);
} else {
setNetworkSelectionPermanentlyDisabled(config, reason);
diff --git a/service/java/com/android/server/wifi/WifiNetworkFactory.java b/service/java/com/android/server/wifi/WifiNetworkFactory.java
index 98f72c2e2..057fc99ac 100644
--- a/service/java/com/android/server/wifi/WifiNetworkFactory.java
+++ b/service/java/com/android/server/wifi/WifiNetworkFactory.java
@@ -937,7 +937,7 @@ public class WifiNetworkFactory extends NetworkFactory {
// Invoked at the termination of current connected request processing.
private void teardownForConnectedNetwork() {
Log.i(TAG, "Disconnecting from network on reset");
- mWifiInjector.getClientModeImpl().disconnectCommandInternal();
+ mWifiInjector.getClientModeImpl().disconnectCommand();
mConnectedSpecificNetworkRequest = null;
mConnectedSpecificNetworkRequestSpecifier = null;
// ensure there is no active request in progress.
diff --git a/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java b/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java
index 121d1cb60..12055704e 100644
--- a/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java
+++ b/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java
@@ -504,7 +504,7 @@ public class WifiNetworkSuggestionsManager {
if (mActiveNetworkSuggestionsMatchingConnection.isEmpty()) {
Log.i(TAG, "Only network suggestion matching the connected network removed. "
+ "Disconnecting...");
- mWifiInjector.getClientModeImpl().disconnectCommandInternal();
+ mWifiInjector.getClientModeImpl().disconnectCommand();
}
}
}
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index 83e8cb0f0..728a4b4ec 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -1644,7 +1644,7 @@ public class WifiServiceImpl extends BaseWifiService {
return false;
}
mLog.info("disconnect uid=%").c(Binder.getCallingUid()).flush();
- mClientModeImpl.disconnectCommandExternal();
+ mClientModeImpl.disconnectCommand();
return true;
}