summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-05-08 03:42:33 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-05-08 03:42:33 +0000
commit18ae05a8368df5d55b2f7ead4fd5cb862d2f46a2 (patch)
tree68ec5bf0dc0a93ecdd9988e937116e7825a5452a
parentb980e07ab21af7d26a046729202606d1ff9fcab9 (diff)
parentb33fae243570a1934a03ca37ed6293120b4daf54 (diff)
Merge "Add metrics for user revoke permission" into rvc-dev
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java9
-rw-r--r--service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java1
-rw-r--r--service/proto/src/metrics.proto3
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java6
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java1
5 files changed, 20 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..72ab4f3d8 100644
--- a/service/java/com/android/server/wifi/WifiMetrics.java
+++ b/service/java/com/android/server/wifi/WifiMetrics.java
@@ -5936,6 +5936,15 @@ public class WifiMetrics {
}
}
+ /** Increment number of user revoke suggestion permission. Including from settings or
+ * disallowed from UI.
+ */
+ public void incrementNetworkSuggestionUserRevokePermission() {
+ synchronized (mLock) {
+ mWifiNetworkSuggestionApiLog.userRevokeAppSuggestionPermission++;
+ }
+ }
+
/** Clear and set the latest network suggestion API max list size histogram */
public void noteNetworkSuggestionApiListSizeHistogram(List<Integer> listSizes) {
synchronized (mLock) {
diff --git a/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java b/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java
index 516c89ecc..c97d5881b 100644
--- a/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java
+++ b/service/java/com/android/server/wifi/WifiNetworkSuggestionsManager.java
@@ -411,6 +411,7 @@ public class WifiNetworkSuggestionsManager {
// User disabled the app, remove app from database. We want the notification
// again if the user enabled the app-op back.
removeApp(mPackageName);
+ mWifiMetrics.incrementNetworkSuggestionUserRevokePermission();
}
});
}
diff --git a/service/proto/src/metrics.proto b/service/proto/src/metrics.proto
index 9a33aafcc..55b3c2af8 100644
--- a/service/proto/src/metrics.proto
+++ b/service/proto/src/metrics.proto
@@ -2934,6 +2934,9 @@ message WifiNetworkSuggestionApiLog {
// Event of user reaction to the UI.
repeated UserReaction user_approval_app_ui_reaction = 6;
+
+ // Number of user revoke app's permission from settings or disallowed from UI.
+ optional int32 user_revoke_app_suggestion_permission = 7;
}
// WifiLock metrics
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
index 6506bd8d2..5b73f7a08 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java
@@ -4180,6 +4180,9 @@ public class WifiMetricsTest extends WifiBaseTest {
mWifiMetrics.addNetworkSuggestionUserApprovalAppUiReaction(1, true);
mWifiMetrics.addNetworkSuggestionUserApprovalAppUiReaction(2, false);
+ mWifiMetrics.incrementNetworkSuggestionUserRevokePermission();
+ mWifiMetrics.incrementNetworkSuggestionUserRevokePermission();
+
dumpProtoAndDeserialize();
assertEquals(4, mDecodedProto.wifiNetworkSuggestionApiLog.numModification);
@@ -4220,6 +4223,9 @@ public class WifiMetricsTest extends WifiBaseTest {
assertEquals(false,
mDecodedProto.wifiNetworkSuggestionApiLog.userApprovalAppUiReaction[1]
.isDialog);
+
+ assertEquals(2, mDecodedProto.wifiNetworkSuggestionApiLog
+ .userRevokeAppSuggestionPermission);
}
private NetworkSelectionExperimentDecisions findUniqueNetworkSelectionExperimentDecisions(
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java
index df729bfb1..1bfe20bfe 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiNetworkSuggestionsManagerTest.java
@@ -2040,6 +2040,7 @@ public class WifiNetworkSuggestionsManagerTest extends WifiBaseTest {
mLooper.dispatchAll();
verify(mAppOpsManager).stopWatchingMode(mAppOpChangedListenerCaptor.getValue());
assertTrue(mWifiNetworkSuggestionsManager.getAllNetworkSuggestions().isEmpty());
+ verify(mWifiMetrics).incrementNetworkSuggestionUserRevokePermission();
}
/**