Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenGestureLogger.java +8 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.phone; import android.metrics.LogMaker; import android.util.ArrayMap; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.systemui.EventLogConstants; Loading @@ -32,6 +33,7 @@ public class LockscreenGestureLogger { private ArrayMap<Integer, Integer> mLegacyMap; private LogMaker mLogMaker = new LogMaker(MetricsEvent.VIEW_UNKNOWN) .setType(MetricsEvent.TYPE_ACTION); private MetricsLogger mMetricsLogger = new MetricsLogger(); public LockscreenGestureLogger() { mLegacyMap = new ArrayMap<>(EventLogConstants.METRICS_GESTURE_TYPE_MAP.length); Loading @@ -41,7 +43,7 @@ public class LockscreenGestureLogger { } public void write(int gesture, int length, int velocity) { MetricsLogger.action(mLogMaker.setCategory(gesture) mMetricsLogger.write(mLogMaker.setCategory(gesture) .setType(MetricsEvent.TYPE_ACTION) .addTaggedData(MetricsEvent.FIELD_GESTURE_LENGTH, length) .addTaggedData(MetricsEvent.FIELD_GESTURE_VELOCITY, velocity)); Loading @@ -56,4 +58,9 @@ public class LockscreenGestureLogger { } return value; } @VisibleForTesting void setMetricsLogger(MetricsLogger metricsLogger) { mMetricsLogger = metricsLogger; } } packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +7 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ import android.os.Vibrator; import android.provider.Settings; import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.StatusBarNotification; import android.support.annotation.VisibleForTesting; import android.util.ArraySet; import android.util.DisplayMetrics; import android.util.EventLog; Loading Loading @@ -751,6 +752,12 @@ public class StatusBar extends SystemUI implements DemoMode, private NavigationBarFragment mNavigationBar; private View mNavigationBarView; @VisibleForTesting void setMetricsLogger(MetricsLogger metricsLogger) { mMetricsLogger = metricsLogger; mLockscreenGestureLogger.setMetricsLogger(metricsLogger); } @Override public void start() { mNetworkController = Dependency.get(NetworkController.class); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java +3 −17 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import android.metrics.LogMaker; import android.support.test.filters.FlakyTest; import android.support.test.filters.SmallTest; import android.support.test.metricshelper.MetricsAsserts; import android.support.test.runner.AndroidJUnit4; Loading @@ -40,7 +39,6 @@ import com.android.systemui.statusbar.NotificationData; import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; Loading @@ -65,7 +63,8 @@ public class StatusBarTest extends SysuiTestCase { mStackScroller = mock(NotificationStackScrollLayout.class); mMetricsLogger = new FakeMetricsLogger(); mStatusBar = new TestableStatusBar(mStatusBarKeyguardViewManager, mUnlockMethodCache, mKeyguardIndicationController, mStackScroller, mMetricsLogger); mKeyguardIndicationController, mStackScroller); mStatusBar.setMetricsLogger(mMetricsLogger); doAnswer(invocation -> { OnDismissAction onDismissAction = (OnDismissAction) invocation.getArguments()[0]; Loading Loading @@ -106,8 +105,6 @@ public class StatusBarTest extends SysuiTestCase { mStatusBar.executeRunnableDismissingKeyguard(null, null, false, false, false); } @Ignore("flaky test") @FlakyTest @Test public void lockscreenStateMetrics_notShowing() { // uninteresting state, except that fingerprint must be non-zero Loading @@ -126,8 +123,6 @@ public class StatusBarTest extends SysuiTestCase { .setSubtype(0)); } @Ignore("flaky test") @FlakyTest @Test public void lockscreenStateMetrics_notShowing_secure() { // uninteresting state, except that fingerprint must be non-zero Loading @@ -147,8 +142,6 @@ public class StatusBarTest extends SysuiTestCase { .setSubtype(1)); } @Ignore("flaky test") @FlakyTest @Test public void lockscreenStateMetrics_isShowing() { // uninteresting state, except that fingerprint must be non-zero Loading @@ -168,8 +161,6 @@ public class StatusBarTest extends SysuiTestCase { .setSubtype(0)); } @Ignore("flaky test") @FlakyTest @Test public void lockscreenStateMetrics_isShowing_secure() { // uninteresting state, except that fingerprint must be non-zero Loading @@ -189,8 +180,6 @@ public class StatusBarTest extends SysuiTestCase { .setSubtype(1)); } @Ignore("flaky test") @FlakyTest @Test public void lockscreenStateMetrics_isShowingBouncer() { // uninteresting state, except that fingerprint must be non-zero Loading @@ -210,8 +199,6 @@ public class StatusBarTest extends SysuiTestCase { .setSubtype(1)); } @Ignore("flaky test") @FlakyTest @Test public void onActivatedMetrics() { ActivatableNotificationView view = mock(ActivatableNotificationView.class); Loading @@ -226,12 +213,11 @@ public class StatusBarTest extends SysuiTestCase { static class TestableStatusBar extends StatusBar { public TestableStatusBar(StatusBarKeyguardViewManager man, UnlockMethodCache unlock, KeyguardIndicationController key, NotificationStackScrollLayout stack, MetricsLogger logger) { NotificationStackScrollLayout stack) { mStatusBarKeyguardViewManager = man; mUnlockMethodCache = unlock; mKeyguardIndicationController = key; mStackScroller = stack; mMetricsLogger = logger; } @Override Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenGestureLogger.java +8 −1 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.phone; import android.metrics.LogMaker; import android.util.ArrayMap; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.systemui.EventLogConstants; Loading @@ -32,6 +33,7 @@ public class LockscreenGestureLogger { private ArrayMap<Integer, Integer> mLegacyMap; private LogMaker mLogMaker = new LogMaker(MetricsEvent.VIEW_UNKNOWN) .setType(MetricsEvent.TYPE_ACTION); private MetricsLogger mMetricsLogger = new MetricsLogger(); public LockscreenGestureLogger() { mLegacyMap = new ArrayMap<>(EventLogConstants.METRICS_GESTURE_TYPE_MAP.length); Loading @@ -41,7 +43,7 @@ public class LockscreenGestureLogger { } public void write(int gesture, int length, int velocity) { MetricsLogger.action(mLogMaker.setCategory(gesture) mMetricsLogger.write(mLogMaker.setCategory(gesture) .setType(MetricsEvent.TYPE_ACTION) .addTaggedData(MetricsEvent.FIELD_GESTURE_LENGTH, length) .addTaggedData(MetricsEvent.FIELD_GESTURE_VELOCITY, velocity)); Loading @@ -56,4 +58,9 @@ public class LockscreenGestureLogger { } return value; } @VisibleForTesting void setMetricsLogger(MetricsLogger metricsLogger) { mMetricsLogger = metricsLogger; } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +7 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,7 @@ import android.os.Vibrator; import android.provider.Settings; import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.StatusBarNotification; import android.support.annotation.VisibleForTesting; import android.util.ArraySet; import android.util.DisplayMetrics; import android.util.EventLog; Loading Loading @@ -751,6 +752,12 @@ public class StatusBar extends SystemUI implements DemoMode, private NavigationBarFragment mNavigationBar; private View mNavigationBarView; @VisibleForTesting void setMetricsLogger(MetricsLogger metricsLogger) { mMetricsLogger = metricsLogger; mLockscreenGestureLogger.setMetricsLogger(metricsLogger); } @Override public void start() { mNetworkController = Dependency.get(NetworkController.class); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarTest.java +3 −17 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import android.metrics.LogMaker; import android.support.test.filters.FlakyTest; import android.support.test.filters.SmallTest; import android.support.test.metricshelper.MetricsAsserts; import android.support.test.runner.AndroidJUnit4; Loading @@ -40,7 +39,6 @@ import com.android.systemui.statusbar.NotificationData; import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; Loading @@ -65,7 +63,8 @@ public class StatusBarTest extends SysuiTestCase { mStackScroller = mock(NotificationStackScrollLayout.class); mMetricsLogger = new FakeMetricsLogger(); mStatusBar = new TestableStatusBar(mStatusBarKeyguardViewManager, mUnlockMethodCache, mKeyguardIndicationController, mStackScroller, mMetricsLogger); mKeyguardIndicationController, mStackScroller); mStatusBar.setMetricsLogger(mMetricsLogger); doAnswer(invocation -> { OnDismissAction onDismissAction = (OnDismissAction) invocation.getArguments()[0]; Loading Loading @@ -106,8 +105,6 @@ public class StatusBarTest extends SysuiTestCase { mStatusBar.executeRunnableDismissingKeyguard(null, null, false, false, false); } @Ignore("flaky test") @FlakyTest @Test public void lockscreenStateMetrics_notShowing() { // uninteresting state, except that fingerprint must be non-zero Loading @@ -126,8 +123,6 @@ public class StatusBarTest extends SysuiTestCase { .setSubtype(0)); } @Ignore("flaky test") @FlakyTest @Test public void lockscreenStateMetrics_notShowing_secure() { // uninteresting state, except that fingerprint must be non-zero Loading @@ -147,8 +142,6 @@ public class StatusBarTest extends SysuiTestCase { .setSubtype(1)); } @Ignore("flaky test") @FlakyTest @Test public void lockscreenStateMetrics_isShowing() { // uninteresting state, except that fingerprint must be non-zero Loading @@ -168,8 +161,6 @@ public class StatusBarTest extends SysuiTestCase { .setSubtype(0)); } @Ignore("flaky test") @FlakyTest @Test public void lockscreenStateMetrics_isShowing_secure() { // uninteresting state, except that fingerprint must be non-zero Loading @@ -189,8 +180,6 @@ public class StatusBarTest extends SysuiTestCase { .setSubtype(1)); } @Ignore("flaky test") @FlakyTest @Test public void lockscreenStateMetrics_isShowingBouncer() { // uninteresting state, except that fingerprint must be non-zero Loading @@ -210,8 +199,6 @@ public class StatusBarTest extends SysuiTestCase { .setSubtype(1)); } @Ignore("flaky test") @FlakyTest @Test public void onActivatedMetrics() { ActivatableNotificationView view = mock(ActivatableNotificationView.class); Loading @@ -226,12 +213,11 @@ public class StatusBarTest extends SysuiTestCase { static class TestableStatusBar extends StatusBar { public TestableStatusBar(StatusBarKeyguardViewManager man, UnlockMethodCache unlock, KeyguardIndicationController key, NotificationStackScrollLayout stack, MetricsLogger logger) { NotificationStackScrollLayout stack) { mStatusBarKeyguardViewManager = man; mUnlockMethodCache = unlock; mKeyguardIndicationController = key; mStackScroller = stack; mMetricsLogger = logger; } @Override Loading