summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNate Jiang <qiangjiang@google.com>2020-05-06 15:38:17 -0700
committerNate Jiang <qiangjiang@google.com>2020-05-07 16:49:09 -0700
commitb33fae243570a1934a03ca37ed6293120b4daf54 (patch)
tree46969179b7a8ba59957f715bbcb9ee9e49cff818
parent431a8ab0ac838e332d43d4264b58d97cae3b7732 (diff)
Add metrics for user revoke permission
Revoke permission can happen when user disable in settings or user disallowed from UI. Updated-PDD: TRUE Bug: 154546365 Test: atest com.android.server.wifi Change-Id: I76f0935867dc8a58ede0e1967b1629861e97a6ea
-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();
}
/**