Loading wifi/java/android/net/wifi/IWifiManager.aidl +3 −3 Original line number Diff line number Diff line Loading @@ -237,11 +237,11 @@ interface IWifiManager void updateWifiUsabilityScore(int seqNum, int score, int predictionHorizonSec); oneway void connect(in WifiConfiguration config, int netId, in IBinder binder, in IActionListener listener, int callbackIdentifier); oneway void connect(in WifiConfiguration config, int netId, in IActionListener listener); oneway void save(in WifiConfiguration config, in IBinder binder, in IActionListener listener, int callbackIdentifier); oneway void save(in WifiConfiguration config, in IActionListener listener); oneway void forget(int netId, in IBinder binder, in IActionListener listener, int callbackIdentifier); oneway void forget(int netId, in IActionListener listener); void registerScanResultsCallback(in IScanResultsCallback callback); Loading wifi/java/android/net/wifi/WifiManager.java +3 −12 Original line number Diff line number Diff line Loading @@ -4124,14 +4124,11 @@ public class WifiManager { private void connectInternal(@Nullable WifiConfiguration config, int networkId, @Nullable ActionListener listener) { ActionListenerProxy listenerProxy = null; Binder binder = null; if (listener != null) { listenerProxy = new ActionListenerProxy("connect", mLooper, listener); binder = new Binder(); } try { mService.connect(config, networkId, binder, listenerProxy, listener == null ? 0 : listener.hashCode()); mService.connect(config, networkId, listenerProxy); } catch (RemoteException e) { if (listenerProxy != null) listenerProxy.onFailure(ERROR); } catch (SecurityException e) { Loading Loading @@ -4222,14 +4219,11 @@ public class WifiManager { public void save(@NonNull WifiConfiguration config, @Nullable ActionListener listener) { if (config == null) throw new IllegalArgumentException("config cannot be null"); ActionListenerProxy listenerProxy = null; Binder binder = null; if (listener != null) { listenerProxy = new ActionListenerProxy("save", mLooper, listener); binder = new Binder(); } try { mService.save(config, binder, listenerProxy, listener == null ? 0 : listener.hashCode()); mService.save(config, listenerProxy); } catch (RemoteException e) { if (listenerProxy != null) listenerProxy.onFailure(ERROR); } catch (SecurityException e) { Loading Loading @@ -4259,14 +4253,11 @@ public class WifiManager { public void forget(int netId, @Nullable ActionListener listener) { if (netId < 0) throw new IllegalArgumentException("Network id cannot be negative"); ActionListenerProxy listenerProxy = null; Binder binder = null; if (listener != null) { listenerProxy = new ActionListenerProxy("forget", mLooper, listener); binder = new Binder(); } try { mService.forget(netId, binder, listenerProxy, listener == null ? 0 : listener.hashCode()); mService.forget(netId, listenerProxy); } catch (RemoteException e) { if (listenerProxy != null) listenerProxy.onFailure(ERROR); } catch (SecurityException e) { Loading wifi/tests/src/android/net/wifi/WifiManagerTest.java +4 −9 Original line number Diff line number Diff line Loading @@ -83,7 +83,6 @@ import android.net.wifi.WifiManager.SoftApCallback; import android.net.wifi.WifiManager.SuggestionConnectionStatusListener; import android.net.wifi.WifiManager.TrafficStateCallback; import android.net.wifi.WifiManager.WifiConnectedNetworkScorer; import android.os.Binder; import android.os.Build; import android.os.Handler; import android.os.HandlerExecutor; Loading Loading @@ -1992,8 +1991,7 @@ public class WifiManagerTest { ArgumentCaptor<IActionListener> binderListenerCaptor = ArgumentCaptor.forClass(IActionListener.class); verify(mWifiService).connect(eq(null), eq(TEST_NETWORK_ID), any(Binder.class), binderListenerCaptor.capture(), anyInt()); verify(mWifiService).connect(eq(null), eq(TEST_NETWORK_ID), binderListenerCaptor.capture()); assertNotNull(binderListenerCaptor.getValue()); // Trigger on success. Loading @@ -2013,8 +2011,7 @@ public class WifiManagerTest { @Test public void testConnectWithListenerHandleSecurityException() throws Exception { doThrow(new SecurityException()).when(mWifiService) .connect(eq(null), anyInt(), any(IBinder.class), any(IActionListener.class), anyInt()); .connect(eq(null), anyInt(), any(IActionListener.class)); ActionListener externalListener = mock(ActionListener.class); mWifiManager.connect(TEST_NETWORK_ID, externalListener); Loading @@ -2028,8 +2025,7 @@ public class WifiManagerTest { @Test public void testConnectWithListenerHandleRemoteException() throws Exception { doThrow(new RemoteException()).when(mWifiService) .connect(eq(null), anyInt(), any(IBinder.class), any(IActionListener.class), anyInt()); .connect(eq(null), anyInt(), any(IActionListener.class)); ActionListener externalListener = mock(ActionListener.class); mWifiManager.connect(TEST_NETWORK_ID, externalListener); Loading @@ -2045,8 +2041,7 @@ public class WifiManagerTest { WifiConfiguration configuration = new WifiConfiguration(); mWifiManager.connect(configuration, null); verify(mWifiService).connect(configuration, WifiConfiguration.INVALID_NETWORK_ID, null, null, 0); verify(mWifiService).connect(configuration, WifiConfiguration.INVALID_NETWORK_ID, null); } /** Loading Loading
wifi/java/android/net/wifi/IWifiManager.aidl +3 −3 Original line number Diff line number Diff line Loading @@ -237,11 +237,11 @@ interface IWifiManager void updateWifiUsabilityScore(int seqNum, int score, int predictionHorizonSec); oneway void connect(in WifiConfiguration config, int netId, in IBinder binder, in IActionListener listener, int callbackIdentifier); oneway void connect(in WifiConfiguration config, int netId, in IActionListener listener); oneway void save(in WifiConfiguration config, in IBinder binder, in IActionListener listener, int callbackIdentifier); oneway void save(in WifiConfiguration config, in IActionListener listener); oneway void forget(int netId, in IBinder binder, in IActionListener listener, int callbackIdentifier); oneway void forget(int netId, in IActionListener listener); void registerScanResultsCallback(in IScanResultsCallback callback); Loading
wifi/java/android/net/wifi/WifiManager.java +3 −12 Original line number Diff line number Diff line Loading @@ -4124,14 +4124,11 @@ public class WifiManager { private void connectInternal(@Nullable WifiConfiguration config, int networkId, @Nullable ActionListener listener) { ActionListenerProxy listenerProxy = null; Binder binder = null; if (listener != null) { listenerProxy = new ActionListenerProxy("connect", mLooper, listener); binder = new Binder(); } try { mService.connect(config, networkId, binder, listenerProxy, listener == null ? 0 : listener.hashCode()); mService.connect(config, networkId, listenerProxy); } catch (RemoteException e) { if (listenerProxy != null) listenerProxy.onFailure(ERROR); } catch (SecurityException e) { Loading Loading @@ -4222,14 +4219,11 @@ public class WifiManager { public void save(@NonNull WifiConfiguration config, @Nullable ActionListener listener) { if (config == null) throw new IllegalArgumentException("config cannot be null"); ActionListenerProxy listenerProxy = null; Binder binder = null; if (listener != null) { listenerProxy = new ActionListenerProxy("save", mLooper, listener); binder = new Binder(); } try { mService.save(config, binder, listenerProxy, listener == null ? 0 : listener.hashCode()); mService.save(config, listenerProxy); } catch (RemoteException e) { if (listenerProxy != null) listenerProxy.onFailure(ERROR); } catch (SecurityException e) { Loading Loading @@ -4259,14 +4253,11 @@ public class WifiManager { public void forget(int netId, @Nullable ActionListener listener) { if (netId < 0) throw new IllegalArgumentException("Network id cannot be negative"); ActionListenerProxy listenerProxy = null; Binder binder = null; if (listener != null) { listenerProxy = new ActionListenerProxy("forget", mLooper, listener); binder = new Binder(); } try { mService.forget(netId, binder, listenerProxy, listener == null ? 0 : listener.hashCode()); mService.forget(netId, listenerProxy); } catch (RemoteException e) { if (listenerProxy != null) listenerProxy.onFailure(ERROR); } catch (SecurityException e) { Loading
wifi/tests/src/android/net/wifi/WifiManagerTest.java +4 −9 Original line number Diff line number Diff line Loading @@ -83,7 +83,6 @@ import android.net.wifi.WifiManager.SoftApCallback; import android.net.wifi.WifiManager.SuggestionConnectionStatusListener; import android.net.wifi.WifiManager.TrafficStateCallback; import android.net.wifi.WifiManager.WifiConnectedNetworkScorer; import android.os.Binder; import android.os.Build; import android.os.Handler; import android.os.HandlerExecutor; Loading Loading @@ -1992,8 +1991,7 @@ public class WifiManagerTest { ArgumentCaptor<IActionListener> binderListenerCaptor = ArgumentCaptor.forClass(IActionListener.class); verify(mWifiService).connect(eq(null), eq(TEST_NETWORK_ID), any(Binder.class), binderListenerCaptor.capture(), anyInt()); verify(mWifiService).connect(eq(null), eq(TEST_NETWORK_ID), binderListenerCaptor.capture()); assertNotNull(binderListenerCaptor.getValue()); // Trigger on success. Loading @@ -2013,8 +2011,7 @@ public class WifiManagerTest { @Test public void testConnectWithListenerHandleSecurityException() throws Exception { doThrow(new SecurityException()).when(mWifiService) .connect(eq(null), anyInt(), any(IBinder.class), any(IActionListener.class), anyInt()); .connect(eq(null), anyInt(), any(IActionListener.class)); ActionListener externalListener = mock(ActionListener.class); mWifiManager.connect(TEST_NETWORK_ID, externalListener); Loading @@ -2028,8 +2025,7 @@ public class WifiManagerTest { @Test public void testConnectWithListenerHandleRemoteException() throws Exception { doThrow(new RemoteException()).when(mWifiService) .connect(eq(null), anyInt(), any(IBinder.class), any(IActionListener.class), anyInt()); .connect(eq(null), anyInt(), any(IActionListener.class)); ActionListener externalListener = mock(ActionListener.class); mWifiManager.connect(TEST_NETWORK_ID, externalListener); Loading @@ -2045,8 +2041,7 @@ public class WifiManagerTest { WifiConfiguration configuration = new WifiConfiguration(); mWifiManager.connect(configuration, null); verify(mWifiService).connect(configuration, WifiConfiguration.INVALID_NETWORK_ID, null, null, 0); verify(mWifiService).connect(configuration, WifiConfiguration.INVALID_NETWORK_ID, null); } /** Loading