diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-05-08 04:20:03 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-05-08 04:20:03 +0000 |
commit | da4808394d85ce1faf79ca6243429517e5749aed (patch) | |
tree | 4bd371bef992658111a2a3b61e063194c8bfeb85 | |
parent | 62369fee2e9d92663175cc6b4f4ed85a7cefaccc (diff) | |
parent | 8d09a0a84e9e67d723e5cd5858ca66e68e7f10ae (diff) |
Merge "Add metrics for user revoke permission" into rvc-dev am: 18ae05a836 am: 8d09a0a84e
Change-Id: I865775a4d42e0ecf1465991310473d79b4d9f656
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(); } /** |