From 00355555f01550d6564908b503bc45daab3b47cb Mon Sep 17 00:00:00 2001 From: xshu Date: Thu, 23 Apr 2020 02:31:03 -0700 Subject: Settings toggle value metrics Collects metrics on status of the following toggles: - wifi verbose logging (developer option) - wifi scanning - enhanced MAC randomization (developer option) Bug: 153925826 Test: atest com.android.server.wifi Change-Id: I4538f4c4535b0c68a2234f60ecb5a4d9a860f9d4 --- tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java | 8 ++++++++ .../src/com/android/server/wifi/WifiServiceImplTest.java | 3 +++ 2 files changed, 11 insertions(+) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java index 191f81cee..0b9885c93 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java @@ -317,6 +317,8 @@ public class WifiMetricsTest extends WifiBaseTest { - NUM_NETWORKS_ADDED_BY_USER; private static final boolean TEST_VAL_IS_LOCATION_ENABLED = true; private static final boolean IS_SCANNING_ALWAYS_ENABLED = true; + private static final boolean IS_VERBOSE_LOGGING_ENABLED = true; + private static final boolean IS_ENHANCED_MAC_RANDOMIZATION_FORCE_ENABLED = true; private static final int NUM_EMPTY_SCAN_RESULTS = 19; private static final int NUM_NON_EMPTY_SCAN_RESULTS = 23; private static final int NUM_SCAN_UNKNOWN = 1; @@ -681,6 +683,9 @@ public class WifiMetricsTest extends WifiBaseTest { mWifiMetrics.setIsLocationEnabled(TEST_VAL_IS_LOCATION_ENABLED); mWifiMetrics.setIsScanningAlwaysEnabled(IS_SCANNING_ALWAYS_ENABLED); + mWifiMetrics.setVerboseLoggingEnabled(IS_VERBOSE_LOGGING_ENABLED); + mWifiMetrics.setEnhancedMacRandomizationForceEnabled( + IS_ENHANCED_MAC_RANDOMIZATION_FORCE_ENABLED); for (int i = 0; i < NUM_EMPTY_SCAN_RESULTS; i++) { mWifiMetrics.incrementEmptyScanResultCount(); @@ -1153,6 +1158,9 @@ public class WifiMetricsTest extends WifiBaseTest { TEST_VAL_IS_LOCATION_ENABLED, mDecodedProto.isLocationEnabled); assertEquals("mDecodedProto.isScanningAlwaysEnabled == IS_SCANNING_ALWAYS_ENABLED", IS_SCANNING_ALWAYS_ENABLED, mDecodedProto.isScanningAlwaysEnabled); + assertEquals(IS_VERBOSE_LOGGING_ENABLED, mDecodedProto.isVerboseLoggingEnabled); + assertEquals(IS_ENHANCED_MAC_RANDOMIZATION_FORCE_ENABLED, + mDecodedProto.isEnhancedMacRandomizationForceEnabled); assertEquals("mDecodedProto.numEmptyScanResults == NUM_EMPTY_SCAN_RESULTS", NUM_EMPTY_SCAN_RESULTS, mDecodedProto.numEmptyScanResults); assertEquals("mDecodedProto.numNonEmptyScanResults == NUM_NON_EMPTY_SCAN_RESULTS", diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java index 814cfc756..9caac1ff8 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java @@ -510,6 +510,9 @@ public class WifiServiceImplTest extends WifiBaseTest { public void testWifiMetricsDump() { mWifiServiceImpl.dump(new FileDescriptor(), new PrintWriter(new StringWriter()), new String[]{mWifiMetrics.PROTO_DUMP_ARG}); + verify(mWifiMetrics).setEnhancedMacRandomizationForceEnabled(anyBoolean()); + verify(mWifiMetrics).setIsScanningAlwaysEnabled(anyBoolean()); + verify(mWifiMetrics).setVerboseLoggingEnabled(anyBoolean()); verify(mWifiMetrics) .dump(any(FileDescriptor.class), any(PrintWriter.class), any(String[].class)); verify(mClientModeImpl, never()) -- cgit v1.2.3