summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/BaseWifiService.java6
-rw-r--r--service/java/com/android/server/wifi/ClientModeImpl.java67
-rw-r--r--service/java/com/android/server/wifi/WifiNative.java10
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java22
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java14
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java32
6 files changed, 6 insertions, 145 deletions
diff --git a/service/java/com/android/server/wifi/BaseWifiService.java b/service/java/com/android/server/wifi/BaseWifiService.java
index 34d902413..7614cf6eb 100644
--- a/service/java/com/android/server/wifi/BaseWifiService.java
+++ b/service/java/com/android/server/wifi/BaseWifiService.java
@@ -589,7 +589,11 @@ public class BaseWifiService extends IWifiManager.Stub {
throw new UnsupportedOperationException();
}
- @Override
+ /**
+ * @deprecated was only used by CTS test, now fully removed. Please also remove
+ * ITxPacketCountListener.aidl when removing this method.
+ */
+ @Deprecated
public void getTxPacketCount(String packageName, IBinder binder,
ITxPacketCountListener callback, int callbackIdentifier) {
throw new UnsupportedOperationException();
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java
index 7cdc8e084..2e795c749 100644
--- a/service/java/com/android/server/wifi/ClientModeImpl.java
+++ b/service/java/com/android/server/wifi/ClientModeImpl.java
@@ -68,7 +68,6 @@ import android.net.shared.ProvisioningConfiguration.ScanResultInfo;
import android.net.util.NetUtils;
import android.net.wifi.IActionListener;
import android.net.wifi.INetworkRequestMatchCallback;
-import android.net.wifi.ITxPacketCountListener;
import android.net.wifi.ScanResult;
import android.net.wifi.SupplicantState;
import android.net.wifi.WifiAnnotations.WifiStandard;
@@ -454,7 +453,6 @@ public class ClientModeImpl extends StateMachine {
private final NetworkCapabilities mNetworkCapabilitiesFilter = new NetworkCapabilities();
private final ExternalCallbackTracker<IActionListener> mProcessingActionListeners;
- private final ExternalCallbackTracker<ITxPacketCountListener> mProcessingTxPacketCountListeners;
/* The base for wifi message types */
static final int BASE = Protocol.BASE_WIFI;
@@ -627,7 +625,6 @@ public class ClientModeImpl extends StateMachine {
private static final int CMD_CONNECT_NETWORK = BASE + 258;
private static final int CMD_SAVE_NETWORK = BASE + 259;
- private static final int CMD_PKT_CNT_FETCH = BASE + 261;
/* Start connection to FILS AP*/
static final int CMD_START_FILS_CONNECTION = BASE + 262;
@@ -835,7 +832,6 @@ public class ClientModeImpl extends StateMachine {
mWifiNetworkSuggestionsManager = mWifiInjector.getWifiNetworkSuggestionsManager();
mProcessingActionListeners = new ExternalCallbackTracker<>(getHandler());
- mProcessingTxPacketCountListeners = new ExternalCallbackTracker<>(getHandler());
mWifiHealthMonitor = mWifiInjector.getWifiHealthMonitor();
IntentFilter filter = new IntentFilter();
@@ -1994,7 +1990,6 @@ public class ClientModeImpl extends StateMachine {
case CMD_RSSI_POLL:
case CMD_ONESHOT_RSSI_POLL:
case CMD_UNWANTED_NETWORK:
- case CMD_PKT_CNT_FETCH:
sb.append(" ");
sb.append(Integer.toString(msg.arg1));
sb.append(" ");
@@ -2258,9 +2253,6 @@ public class ClientModeImpl extends StateMachine {
case WifiP2pServiceImpl.BLOCK_DISCOVERY:
s = "BLOCK_DISCOVERY";
break;
- case CMD_PKT_CNT_FETCH:
- s = "CMD_PKT_CNT_FETCH";
- break;
default:
s = "what:" + Integer.toString(what);
break;
@@ -3395,10 +3387,6 @@ public class ClientModeImpl extends StateMachine {
callbackIdentifier = message.arg2;
sendActionListenerSuccess(callbackIdentifier);
break;
- case CMD_PKT_CNT_FETCH:
- callbackIdentifier = message.arg2;
- sendTxPacketCountListenerFailure(callbackIdentifier, WifiManager.BUSY);
- break;
case CMD_GET_SUPPORTED_FEATURES:
long featureSet = (mWifiNative.getSupportedFeatureSet(mInterfaceName));
replyToMessage(message, message.what, Long.valueOf(featureSet));
@@ -4847,17 +4835,6 @@ public class ClientModeImpl extends StateMachine {
getPollRssiIntervalMsecs());
}
break;
- case CMD_PKT_CNT_FETCH:
- callbackIdentifier = message.arg2;
- WifiNl80211Manager.TxPacketCounters counters =
- mWifiNative.getTxPacketCounters(mInterfaceName);
- if (counters != null) {
- sendTxPacketCountListenerSuccess(callbackIdentifier,
- counters.txPacketSucceeded + counters.txPacketFailed);
- } else {
- sendTxPacketCountListenerSuccess(callbackIdentifier, WifiManager.ERROR);
- }
- break;
case WifiMonitor.ASSOCIATED_BSSID_EVENT:
if ((String) message.obj == null) {
logw("Associated command w/o BSSID");
@@ -5978,7 +5955,7 @@ public class ClientModeImpl extends StateMachine {
private void sendActionListenerSuccess(int callbackIdentifier) {
IActionListener actionListener;
- synchronized (mProcessingTxPacketCountListeners) {
+ synchronized (mProcessingActionListeners) {
actionListener = mProcessingActionListeners.remove(callbackIdentifier);
}
if (actionListener != null) {
@@ -5990,34 +5967,6 @@ public class ClientModeImpl extends StateMachine {
}
}
- private void sendTxPacketCountListenerFailure(int callbackIdentifier, int reason) {
- ITxPacketCountListener txPacketCountListener;
- synchronized (mProcessingTxPacketCountListeners) {
- txPacketCountListener = mProcessingTxPacketCountListeners.remove(callbackIdentifier);
- }
- if (txPacketCountListener != null) {
- try {
- txPacketCountListener.onFailure(reason);
- } catch (RemoteException e) {
- // no-op (client may be dead, nothing to be done)
- }
- }
- }
-
- private void sendTxPacketCountListenerSuccess(int callbackIdentifier, int count) {
- ITxPacketCountListener txPacketCountListener;
- synchronized (mProcessingActionListeners) {
- txPacketCountListener = mProcessingTxPacketCountListeners.remove(callbackIdentifier);
- }
- if (txPacketCountListener != null) {
- try {
- txPacketCountListener.onSuccess(count);
- } catch (RemoteException e) {
- // no-op (client may be dead, nothing to be done)
- }
- }
- }
-
/**
* Trigger network connection and provide status via the provided callback.
*/
@@ -6124,20 +6073,6 @@ public class ClientModeImpl extends StateMachine {
}
/**
- * Retrieve tx packet count and provide status via the provided callback.
- */
- public void getTxPacketCount(IBinder binder, @NonNull ITxPacketCountListener callback,
- int callbackIdentifier, int callingUid) {
- mWifiInjector.getWifiThreadRunner().post(() -> {
- mProcessingTxPacketCountListeners.add(binder, callback, callbackIdentifier);
-
- Message message = obtainMessage(CMD_PKT_CNT_FETCH, -1, callbackIdentifier, null);
- message.sendingUid = callingUid;
- sendMessage(message);
- });
- }
-
- /**
* Handle BSS transition request from Connected BSS.
*
* @param frameData Data retrieved from received BTM request frame.
diff --git a/service/java/com/android/server/wifi/WifiNative.java b/service/java/com/android/server/wifi/WifiNative.java
index c5e05892b..e0c7fbc5e 100644
--- a/service/java/com/android/server/wifi/WifiNative.java
+++ b/service/java/com/android/server/wifi/WifiNative.java
@@ -1409,16 +1409,6 @@ public class WifiNative {
}
/**
- * Fetch TX packet counters on current connection from wificond.
- * @param ifaceName Name of the interface.
- * Returns an TxPacketCounters object.
- * Returns null on failure.
- */
- public WifiNl80211Manager.TxPacketCounters getTxPacketCounters(@NonNull String ifaceName) {
- return mWifiCondManager.getTxPacketCounters(ifaceName);
- }
-
- /**
* Query the list of valid frequencies for the provided band.
* The result depends on the on the country code that has been set.
*
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index bb89d3a64..c6ce36c43 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -62,7 +62,6 @@ import android.net.wifi.IScanResultsCallback;
import android.net.wifi.ISoftApCallback;
import android.net.wifi.ISuggestionConnectionStatusListener;
import android.net.wifi.ITrafficStateCallback;
-import android.net.wifi.ITxPacketCountListener;
import android.net.wifi.IWifiConnectedNetworkScorer;
import android.net.wifi.ScanResult;
import android.net.wifi.SoftApCapability;
@@ -4083,27 +4082,6 @@ public class WifiServiceImpl extends BaseWifiService {
}
/**
- * see {@link android.net.wifi.WifiManager#getTxPacketCount(WifiManager.TxPacketCountListener)}
- */
- @Override
- public void getTxPacketCount(String packageName, IBinder binder,
- @NonNull ITxPacketCountListener callback, int callbackIdentifier) {
- // verify arguments
- if (binder == null) {
- throw new IllegalArgumentException("Binder must not be null");
- }
- if (callback == null) {
- throw new IllegalArgumentException("Callback must not be null");
- }
- enforceChangePermission(packageName);
- if (mVerboseLoggingEnabled) {
- mLog.info("connect uid=%").c(Binder.getCallingUid()).flush();
- }
- mClientModeImpl.getTxPacketCount(
- binder, callback, callbackIdentifier, Binder.getCallingUid());
- }
-
- /**
* See {@link WifiManager#registerScanResultsCallback(WifiManager.ScanResultsCallback)}
*/
public void registerScanResultsCallback(@NonNull IScanResultsCallback callback) {
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java
index 3d4f33a35..f82c13f6e 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNativeTest.java
@@ -130,8 +130,6 @@ public class WifiNativeTest extends WifiBaseTest {
};
private static final WifiNl80211Manager.SignalPollResult SIGNAL_POLL_RESULT =
new WifiNl80211Manager.SignalPollResult(-60, 12, 6, 5240);
- private static final WifiNl80211Manager.TxPacketCounters PACKET_COUNTERS_RESULT =
- new WifiNl80211Manager.TxPacketCounters(2000, 120);
private static final Set<Integer> SCAN_FREQ_SET =
new HashSet<Integer>() {{
@@ -719,18 +717,6 @@ public class WifiNativeTest extends WifiBaseTest {
}
/**
- * Verifies that getTxPacketCounters() calls underlying WificondControl.
- */
- @Test
- public void testGetTxPacketCounters() throws Exception {
- when(mWificondControl.getTxPacketCounters(WIFI_IFACE_NAME))
- .thenReturn(PACKET_COUNTERS_RESULT);
-
- assertEquals(PACKET_COUNTERS_RESULT, mWifiNative.getTxPacketCounters(WIFI_IFACE_NAME));
- verify(mWificondControl).getTxPacketCounters(WIFI_IFACE_NAME);
- }
-
- /**
* Verifies that scan() calls underlying WificondControl.
*/
@Test
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
index be3924709..8286f1dc1 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java
@@ -105,7 +105,6 @@ import android.net.wifi.IScanResultsCallback;
import android.net.wifi.ISoftApCallback;
import android.net.wifi.ISuggestionConnectionStatusListener;
import android.net.wifi.ITrafficStateCallback;
-import android.net.wifi.ITxPacketCountListener;
import android.net.wifi.IWifiConnectedNetworkScorer;
import android.net.wifi.ScanResult;
import android.net.wifi.SoftApConfiguration;
@@ -3475,24 +3474,6 @@ public class WifiServiceImplTest extends WifiBaseTest {
}
/**
- * Verify that the PKT_CNT_FETCH message received from an app without
- * CHANGE_WIFI_STATE} permission is rejected with a security exception.
- */
- @Test
- public void testTxPacketCountFetchWithoutChangePermission() throws Exception {
- doThrow(new SecurityException()).when(mContext).enforceCallingOrSelfPermission(
- android.Manifest.permission.CHANGE_WIFI_STATE, "WifiService");
- try {
- mWifiServiceImpl.getTxPacketCount(TEST_PACKAGE_NAME, mock(Binder.class),
- mock(ITxPacketCountListener.class), 0);
- fail();
- } catch (SecurityException e) {
- verify(mClientModeImpl, never()).getTxPacketCount(any(Binder.class),
- any(ITxPacketCountListener.class), anyInt(), anyInt());
- }
- }
-
- /**
* Verify that the CONNECT_NETWORK message received from an app with
* one of the privileged permission is forwarded to ClientModeImpl.
*/
@@ -3536,19 +3517,6 @@ public class WifiServiceImplTest extends WifiBaseTest {
}
/**
- * Verify that the RSSI_PKTCNT_FETCH message received from an app with
- * one of the privileged permission is forwarded to ClientModeImpl.
- */
- @Test
- public void testRssiPktcntFetchWithChangePermission() throws Exception {
- mWifiServiceImpl.getTxPacketCount(TEST_PACKAGE_NAME, mock(Binder.class),
- mock(ITxPacketCountListener.class), 0);
- verify(mClientModeImpl).getTxPacketCount(any(Binder.class),
- any(ITxPacketCountListener.class), anyInt(), anyInt());
- }
-
-
- /**
* Tests the scenario when a scan request arrives while the device is idle. In this case
* the scan is done when idle mode ends.
*/