Loading wifi/java/android/net/wifi/ITxPacketCountListener.aidl +1 −0 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.net.wifi; /** /** * Interface for tx packet counter callback. * Interface for tx packet counter callback. * @deprecated no longer used, remove once removed from BaseWifiService * @hide * @hide */ */ oneway interface ITxPacketCountListener oneway interface ITxPacketCountListener Loading wifi/java/android/net/wifi/IWifiManager.aidl +0 −3 Original line number Original line Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.net.wifi.IScanResultsCallback; import android.net.wifi.ISoftApCallback; import android.net.wifi.ISoftApCallback; import android.net.wifi.ISuggestionConnectionStatusListener; import android.net.wifi.ISuggestionConnectionStatusListener; import android.net.wifi.ITrafficStateCallback; import android.net.wifi.ITrafficStateCallback; import android.net.wifi.ITxPacketCountListener; import android.net.wifi.IWifiConnectedNetworkScorer; import android.net.wifi.IWifiConnectedNetworkScorer; import android.net.wifi.ScanResult; import android.net.wifi.ScanResult; import android.net.wifi.SoftApConfiguration; import android.net.wifi.SoftApConfiguration; Loading Loading @@ -246,8 +245,6 @@ interface IWifiManager oneway void forget(int netId, in IBinder binder, in IActionListener listener, int callbackIdentifier); oneway void forget(int netId, in IBinder binder, in IActionListener listener, int callbackIdentifier); oneway void getTxPacketCount(String packageName, in IBinder binder, in ITxPacketCountListener listener, int callbackIdentifier); void registerScanResultsCallback(in IScanResultsCallback callback); void registerScanResultsCallback(in IScanResultsCallback callback); void unregisterScanResultsCallback(in IScanResultsCallback callback); void unregisterScanResultsCallback(in IScanResultsCallback callback); Loading wifi/java/android/net/wifi/WifiManager.java +0 −72 Original line number Original line Diff line number Diff line Loading @@ -2908,28 +2908,6 @@ public class WifiManager { return getWifiState() == WIFI_STATE_ENABLED; return getWifiState() == WIFI_STATE_ENABLED; } } /** * Return TX packet counter, for CTS test of WiFi watchdog. * @param listener is the interface to receive result * * @hide for CTS test only */ // TODO(b/144036594): add @TestApi public void getTxPacketCount(@NonNull TxPacketCountListener listener) { if (listener == null) throw new IllegalArgumentException("listener cannot be null"); Binder binder = new Binder(); TxPacketCountListenerProxy listenerProxy = new TxPacketCountListenerProxy(mLooper, listener); try { mService.getTxPacketCount(mContext.getOpPackageName(), binder, listenerProxy, listener.hashCode()); } catch (RemoteException e) { listenerProxy.onFailure(ERROR); } catch (SecurityException e) { listenerProxy.onFailure(NOT_AUTHORIZED); } } /** /** * Calculates the level of the signal. This should be used any time a signal * Calculates the level of the signal. This should be used any time a signal * is being shown. * is being shown. Loading Loading @@ -3582,56 +3560,6 @@ public class WifiManager { public abstract void onFailed(int reason); public abstract void onFailed(int reason); } } /** Interface for callback invocation on a TX packet count poll action {@hide} */ public interface TxPacketCountListener { /** * The operation succeeded * @param count TX packet counter */ public void onSuccess(int count); /** * The operation failed * @param reason The reason for failure could be one of * {@link #ERROR}, {@link #IN_PROGRESS} or {@link #BUSY} */ public void onFailure(int reason); } /** * Callback proxy for TxPacketCountListener objects. * * @hide */ private class TxPacketCountListenerProxy extends ITxPacketCountListener.Stub { private final Handler mHandler; private final TxPacketCountListener mCallback; TxPacketCountListenerProxy(Looper looper, TxPacketCountListener callback) { mHandler = new Handler(looper); mCallback = callback; } @Override public void onSuccess(int count) { if (mVerboseLoggingEnabled) { Log.v(TAG, "TxPacketCounterProxy: onSuccess: count=" + count); } mHandler.post(() -> { mCallback.onSuccess(count); }); } @Override public void onFailure(int reason) { if (mVerboseLoggingEnabled) { Log.v(TAG, "TxPacketCounterProxy: onFailure: reason=" + reason); } mHandler.post(() -> { mCallback.onFailure(reason); }); } } /** /** * Base class for soft AP callback. Should be extended by applications and set when calling * Base class for soft AP callback. Should be extended by applications and set when calling * {@link WifiManager#registerSoftApCallback(Executor, SoftApCallback)}. * {@link WifiManager#registerSoftApCallback(Executor, SoftApCallback)}. Loading wifi/tests/src/android/net/wifi/WifiManagerTest.java +0 −27 Original line number Original line Diff line number Diff line Loading @@ -30,7 +30,6 @@ import static android.net.wifi.WifiManager.OnWifiActivityEnergyInfoListener; import static android.net.wifi.WifiManager.SAP_START_FAILURE_GENERAL; import static android.net.wifi.WifiManager.SAP_START_FAILURE_GENERAL; import static android.net.wifi.WifiManager.STATUS_NETWORK_SUGGESTIONS_SUCCESS; import static android.net.wifi.WifiManager.STATUS_NETWORK_SUGGESTIONS_SUCCESS; import static android.net.wifi.WifiManager.STATUS_SUGGESTION_CONNECTION_FAILURE_AUTHENTICATION; import static android.net.wifi.WifiManager.STATUS_SUGGESTION_CONNECTION_FAILURE_AUTHENTICATION; import static android.net.wifi.WifiManager.TxPacketCountListener; import static android.net.wifi.WifiManager.WIFI_AP_STATE_ENABLED; import static android.net.wifi.WifiManager.WIFI_AP_STATE_ENABLED; import static android.net.wifi.WifiManager.WIFI_AP_STATE_ENABLING; import static android.net.wifi.WifiManager.WIFI_AP_STATE_ENABLING; import static android.net.wifi.WifiManager.WIFI_AP_STATE_FAILED; import static android.net.wifi.WifiManager.WIFI_AP_STATE_FAILED; Loading Loading @@ -2050,32 +2049,6 @@ public class WifiManagerTest { null, 0); null, 0); } } /** * Test behavior of {@link WifiManager#getTxPacketCount(TxPacketCountListener)} */ @Test public void testGetTxPacketCount() throws Exception { TxPacketCountListener externalListener = mock(TxPacketCountListener.class); mWifiManager.getTxPacketCount(externalListener); ArgumentCaptor<ITxPacketCountListener> binderListenerCaptor = ArgumentCaptor.forClass(ITxPacketCountListener.class); verify(mWifiService).getTxPacketCount(anyString(), any(Binder.class), binderListenerCaptor.capture(), anyInt()); assertNotNull(binderListenerCaptor.getValue()); // Trigger on success. binderListenerCaptor.getValue().onSuccess(6); mLooper.dispatchAll(); verify(externalListener).onSuccess(6); // Trigger on failure. binderListenerCaptor.getValue().onFailure(BUSY); mLooper.dispatchAll(); verify(externalListener).onFailure(BUSY); } /** /** * Verify an IllegalArgumentException is thrown if callback is not provided. * Verify an IllegalArgumentException is thrown if callback is not provided. */ */ Loading Loading
wifi/java/android/net/wifi/ITxPacketCountListener.aidl +1 −0 Original line number Original line Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.net.wifi; /** /** * Interface for tx packet counter callback. * Interface for tx packet counter callback. * @deprecated no longer used, remove once removed from BaseWifiService * @hide * @hide */ */ oneway interface ITxPacketCountListener oneway interface ITxPacketCountListener Loading
wifi/java/android/net/wifi/IWifiManager.aidl +0 −3 Original line number Original line Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.net.wifi.IScanResultsCallback; import android.net.wifi.ISoftApCallback; import android.net.wifi.ISoftApCallback; import android.net.wifi.ISuggestionConnectionStatusListener; import android.net.wifi.ISuggestionConnectionStatusListener; import android.net.wifi.ITrafficStateCallback; import android.net.wifi.ITrafficStateCallback; import android.net.wifi.ITxPacketCountListener; import android.net.wifi.IWifiConnectedNetworkScorer; import android.net.wifi.IWifiConnectedNetworkScorer; import android.net.wifi.ScanResult; import android.net.wifi.ScanResult; import android.net.wifi.SoftApConfiguration; import android.net.wifi.SoftApConfiguration; Loading Loading @@ -246,8 +245,6 @@ interface IWifiManager oneway void forget(int netId, in IBinder binder, in IActionListener listener, int callbackIdentifier); oneway void forget(int netId, in IBinder binder, in IActionListener listener, int callbackIdentifier); oneway void getTxPacketCount(String packageName, in IBinder binder, in ITxPacketCountListener listener, int callbackIdentifier); void registerScanResultsCallback(in IScanResultsCallback callback); void registerScanResultsCallback(in IScanResultsCallback callback); void unregisterScanResultsCallback(in IScanResultsCallback callback); void unregisterScanResultsCallback(in IScanResultsCallback callback); Loading
wifi/java/android/net/wifi/WifiManager.java +0 −72 Original line number Original line Diff line number Diff line Loading @@ -2908,28 +2908,6 @@ public class WifiManager { return getWifiState() == WIFI_STATE_ENABLED; return getWifiState() == WIFI_STATE_ENABLED; } } /** * Return TX packet counter, for CTS test of WiFi watchdog. * @param listener is the interface to receive result * * @hide for CTS test only */ // TODO(b/144036594): add @TestApi public void getTxPacketCount(@NonNull TxPacketCountListener listener) { if (listener == null) throw new IllegalArgumentException("listener cannot be null"); Binder binder = new Binder(); TxPacketCountListenerProxy listenerProxy = new TxPacketCountListenerProxy(mLooper, listener); try { mService.getTxPacketCount(mContext.getOpPackageName(), binder, listenerProxy, listener.hashCode()); } catch (RemoteException e) { listenerProxy.onFailure(ERROR); } catch (SecurityException e) { listenerProxy.onFailure(NOT_AUTHORIZED); } } /** /** * Calculates the level of the signal. This should be used any time a signal * Calculates the level of the signal. This should be used any time a signal * is being shown. * is being shown. Loading Loading @@ -3582,56 +3560,6 @@ public class WifiManager { public abstract void onFailed(int reason); public abstract void onFailed(int reason); } } /** Interface for callback invocation on a TX packet count poll action {@hide} */ public interface TxPacketCountListener { /** * The operation succeeded * @param count TX packet counter */ public void onSuccess(int count); /** * The operation failed * @param reason The reason for failure could be one of * {@link #ERROR}, {@link #IN_PROGRESS} or {@link #BUSY} */ public void onFailure(int reason); } /** * Callback proxy for TxPacketCountListener objects. * * @hide */ private class TxPacketCountListenerProxy extends ITxPacketCountListener.Stub { private final Handler mHandler; private final TxPacketCountListener mCallback; TxPacketCountListenerProxy(Looper looper, TxPacketCountListener callback) { mHandler = new Handler(looper); mCallback = callback; } @Override public void onSuccess(int count) { if (mVerboseLoggingEnabled) { Log.v(TAG, "TxPacketCounterProxy: onSuccess: count=" + count); } mHandler.post(() -> { mCallback.onSuccess(count); }); } @Override public void onFailure(int reason) { if (mVerboseLoggingEnabled) { Log.v(TAG, "TxPacketCounterProxy: onFailure: reason=" + reason); } mHandler.post(() -> { mCallback.onFailure(reason); }); } } /** /** * Base class for soft AP callback. Should be extended by applications and set when calling * Base class for soft AP callback. Should be extended by applications and set when calling * {@link WifiManager#registerSoftApCallback(Executor, SoftApCallback)}. * {@link WifiManager#registerSoftApCallback(Executor, SoftApCallback)}. Loading
wifi/tests/src/android/net/wifi/WifiManagerTest.java +0 −27 Original line number Original line Diff line number Diff line Loading @@ -30,7 +30,6 @@ import static android.net.wifi.WifiManager.OnWifiActivityEnergyInfoListener; import static android.net.wifi.WifiManager.SAP_START_FAILURE_GENERAL; import static android.net.wifi.WifiManager.SAP_START_FAILURE_GENERAL; import static android.net.wifi.WifiManager.STATUS_NETWORK_SUGGESTIONS_SUCCESS; import static android.net.wifi.WifiManager.STATUS_NETWORK_SUGGESTIONS_SUCCESS; import static android.net.wifi.WifiManager.STATUS_SUGGESTION_CONNECTION_FAILURE_AUTHENTICATION; import static android.net.wifi.WifiManager.STATUS_SUGGESTION_CONNECTION_FAILURE_AUTHENTICATION; import static android.net.wifi.WifiManager.TxPacketCountListener; import static android.net.wifi.WifiManager.WIFI_AP_STATE_ENABLED; import static android.net.wifi.WifiManager.WIFI_AP_STATE_ENABLED; import static android.net.wifi.WifiManager.WIFI_AP_STATE_ENABLING; import static android.net.wifi.WifiManager.WIFI_AP_STATE_ENABLING; import static android.net.wifi.WifiManager.WIFI_AP_STATE_FAILED; import static android.net.wifi.WifiManager.WIFI_AP_STATE_FAILED; Loading Loading @@ -2050,32 +2049,6 @@ public class WifiManagerTest { null, 0); null, 0); } } /** * Test behavior of {@link WifiManager#getTxPacketCount(TxPacketCountListener)} */ @Test public void testGetTxPacketCount() throws Exception { TxPacketCountListener externalListener = mock(TxPacketCountListener.class); mWifiManager.getTxPacketCount(externalListener); ArgumentCaptor<ITxPacketCountListener> binderListenerCaptor = ArgumentCaptor.forClass(ITxPacketCountListener.class); verify(mWifiService).getTxPacketCount(anyString(), any(Binder.class), binderListenerCaptor.capture(), anyInt()); assertNotNull(binderListenerCaptor.getValue()); // Trigger on success. binderListenerCaptor.getValue().onSuccess(6); mLooper.dispatchAll(); verify(externalListener).onSuccess(6); // Trigger on failure. binderListenerCaptor.getValue().onFailure(BUSY); mLooper.dispatchAll(); verify(externalListener).onFailure(BUSY); } /** /** * Verify an IllegalArgumentException is thrown if callback is not provided. * Verify an IllegalArgumentException is thrown if callback is not provided. */ */ Loading