summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxshu <xshu@google.com>2020-05-07 18:32:45 -0700
committerxshu <xshu@google.com>2020-05-07 20:11:52 -0700
commitb9d21ca1a2968c331a1b6d82a6e5f1e246787ed0 (patch)
treeb781f210600d45303598e82fc4bde90b4492015e
parentb980e07ab21af7d26a046729202606d1ff9fcab9 (diff)
Metrics for num devices with wifi wake enabled
Updated-PDD: TRUE Bug: 129418401 Test: atest com.android.server.wifi Change-Id: I2f1386976a2a8ff4b01297b90b8a15c49e7fc532
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java10
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java1
-rw-r--r--service/proto/src/metrics.proto3
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java3
4 files changed, 17 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java
index f61723643..b4531932a 100644
--- a/service/java/com/android/server/wifi/WifiMetrics.java
+++ b/service/java/com/android/server/wifi/WifiMetrics.java
@@ -1695,6 +1695,15 @@ public class WifiMetrics {
}
/**
+ * Wifi wake feature toggle.
+ */
+ public void setWifiWakeEnabled(boolean enabled) {
+ synchronized (mLock) {
+ mWifiLogProto.isWifiWakeEnabled = enabled;
+ }
+ }
+
+ /**
* Increment Non Empty Scan Results count
*/
public void incrementNonEmptyScanResultCount() {
@@ -3062,6 +3071,7 @@ public class WifiMetrics {
+ mWifiLogProto.isVerboseLoggingEnabled);
pw.println("mWifiLogProto.isEnhancedMacRandomizationForceEnabled="
+ mWifiLogProto.isEnhancedMacRandomizationForceEnabled);
+ pw.println("mWifiLogProto.isWifiWakeEnabled=" + mWifiLogProto.isWifiWakeEnabled);
pw.println("mWifiLogProto.numNetworksAddedByUser="
+ mWifiLogProto.numNetworksAddedByUser);
pw.println("mWifiLogProto.numNetworksAddedByApps="
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index 73fb306f9..c04e98cbd 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -3202,6 +3202,7 @@ public class WifiServiceImpl extends BaseWifiService {
mWifiMetrics.setEnhancedMacRandomizationForceEnabled(isEnhancedMacRandEnabled);
mWifiMetrics.setIsScanningAlwaysEnabled(isScanAlwaysAvailable());
mWifiMetrics.setVerboseLoggingEnabled(mVerboseLoggingEnabled);
+ mWifiMetrics.setWifiWakeEnabled(mWifiInjector.getWakeupController().isEnabled());
}
@Override
diff --git a/service/proto/src/metrics.proto b/service/proto/src/metrics.proto
index 9a33aafcc..ce8dc5dd0 100644
--- a/service/proto/src/metrics.proto
+++ b/service/proto/src/metrics.proto
@@ -700,6 +700,9 @@ message WifiLog {
// Metered stats for suggestion networks.
optional MeteredNetworkStats metered_network_stats_suggestion = 196;
+
+ // Does the user have wifi wake enabled.
+ optional bool is_wifi_wake_enabled = 197;
}
// Information that gets logged for every WiFi connection.
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index 6506bd8d2..24e34cf9f 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -318,6 +318,7 @@ public class WifiMetricsTest extends WifiBaseTest {
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 boolean IS_WIFI_WAKE_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;
@@ -677,6 +678,7 @@ public class WifiMetricsTest extends WifiBaseTest {
mWifiMetrics.setVerboseLoggingEnabled(IS_VERBOSE_LOGGING_ENABLED);
mWifiMetrics.setEnhancedMacRandomizationForceEnabled(
IS_ENHANCED_MAC_RANDOMIZATION_FORCE_ENABLED);
+ mWifiMetrics.setWifiWakeEnabled(IS_WIFI_WAKE_ENABLED);
for (int i = 0; i < NUM_EMPTY_SCAN_RESULTS; i++) {
mWifiMetrics.incrementEmptyScanResultCount();
@@ -1127,6 +1129,7 @@ public class WifiMetricsTest extends WifiBaseTest {
assertEquals(IS_VERBOSE_LOGGING_ENABLED, mDecodedProto.isVerboseLoggingEnabled);
assertEquals(IS_ENHANCED_MAC_RANDOMIZATION_FORCE_ENABLED,
mDecodedProto.isEnhancedMacRandomizationForceEnabled);
+ assertEquals(IS_WIFI_WAKE_ENABLED, mDecodedProto.isWifiWakeEnabled);
assertEquals("mDecodedProto.numEmptyScanResults == NUM_EMPTY_SCAN_RESULTS",
NUM_EMPTY_SCAN_RESULTS, mDecodedProto.numEmptyScanResults);
assertEquals("mDecodedProto.numNonEmptyScanResults == NUM_NON_EMPTY_SCAN_RESULTS",