Add blocking helper logging
The added logging events are: blocking helper view displayed or
dismissed, any button click within the view, undo clicks and
system suggests of blocking helper.
* Move some of the getLogMaker logic of server's NotificationRecord
class to the common StatusBarNotification class.
* Use the StatusBarNotification.getLogMaker to produce blocking helper
logging.
* Add logging in the NotificationInfo for interaction and display of
the blocking helper view.
* Add logging in the NotificationBlockingHelperManager for system
suggests of blocking helper.
Bug: 112482290
Test: unittests and manual - viewed produced logs.
Change-Id: I3a5267d55faba21f6668d35ff8aa12deb0dc5921
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java
index ecb0cf8..f6791dd5 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java
@@ -45,7 +45,6 @@
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
import android.app.INotificationManager;
@@ -73,6 +72,7 @@
import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto;
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.SysuiTestCase;
@@ -498,12 +498,15 @@
}
@Test
- public void testLogBlockingHelperCounter_doesntLogForNormalGutsView() throws Exception {
+ public void testLogBlockingHelperCounter_logGutsViewDisplayed() throws Exception {
mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager,
TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, true, false,
IMPORTANCE_DEFAULT);
mNotificationInfo.logBlockingHelperCounter("HowCanNotifsBeRealIfAppsArent");
- verifyZeroInteractions(mMetricsLogger);
+ verify(mMetricsLogger).write(argThat(logMaker ->
+ logMaker.getType() == MetricsEvent.NOTIFICATION_BLOCKING_HELPER
+ && logMaker.getSubtype() == MetricsEvent.BLOCKING_HELPER_DISPLAY
+ ));
}
@Test