From 4fbaf3821bd5c3056c7c4cdd1aee3e17ac7046d0 Mon Sep 17 00:00:00 2001 From: Sohani Rao Date: Tue, 29 Nov 2016 10:12:34 -0800 Subject: Log API surfaces of WifiScanningService Add logging to trace the following API surfaces in WifiScanningService - AIDL methods calls, - Async Channel messages sent to the scanning service - Use WifiHandler instead of Handler to define the client handler to trace incoming messsages - Async Channel messages sent by the service - Use WifiAsyncChannel to trace reply messages sent by the service - Fully connected Async Channel is used here, therefore, it can send messages directly to the client's messenger without using Async channel methods. Add logging in replySucceeded() and replyFailed() to trace messages sent by the service directly to the client. Bug: 33085782 Test: Unit test suite, verify logging, sanity test (power on and connect to Wifi Access Point) Change-Id: I8df4f4077801c359e11a93fde2c1ce5ea811a0e4 --- .../src/com/android/server/wifi/scanner/WifiScanningServiceTest.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java b/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java index 8e3be65cb..d99d290fa 100644 --- a/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java +++ b/tests/wifitests/src/com/android/server/wifi/scanner/WifiScanningServiceTest.java @@ -48,6 +48,7 @@ import com.android.internal.util.AsyncChannel; import com.android.internal.util.Protocol; import com.android.internal.util.test.BidirectionalAsyncChannel; import com.android.server.wifi.Clock; +import com.android.server.wifi.FakeWifiLog; import com.android.server.wifi.ScanResults; import com.android.server.wifi.TestUtil; import com.android.server.wifi.WifiInjector; @@ -62,6 +63,7 @@ import org.mockito.ArgumentCaptor; import org.mockito.InOrder; import org.mockito.Mock; import org.mockito.MockitoAnnotations; +import org.mockito.Spy; import org.mockito.internal.matchers.CapturingMatcher; import java.io.FileDescriptor; @@ -89,6 +91,7 @@ public class WifiScanningServiceTest { @Mock IBatteryStats mBatteryStats; @Mock WifiInjector mWifiInjector; @Mock Clock mClock; + @Spy FakeWifiLog mLog; WifiMetrics mWifiMetrics; TestLooper mLooper; WifiScanningServiceImpl mWifiScanningServiceImpl; @@ -114,6 +117,7 @@ public class WifiScanningServiceTest { .thenReturn(mWifiScannerImpl); when(mWifiScannerImpl.getChannelHelper()).thenReturn(channelHelper); when(mWifiInjector.getWifiMetrics()).thenReturn(mWifiMetrics); + when(mWifiInjector.makeLog(anyString())).thenReturn(mLog); mWifiScanningServiceImpl = new WifiScanningServiceImpl(mContext, mLooper.getLooper(), mWifiScannerImplFactory, mBatteryStats, mWifiInjector); } -- cgit v1.2.3