Merge "measure snooze UI use more precisely" into oc-mr1-dev
am: 72826c99fa
Change-Id: I1304ace99258426667059dd98c51ea7d4e10b00c
This commit is contained in:
@@ -18,8 +18,11 @@ package com.android.systemui.statusbar;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper;
|
||||
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption;
|
||||
|
||||
@@ -30,6 +33,7 @@ import android.animation.ObjectAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Typeface;
|
||||
import android.metrics.LogMaker;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.service.notification.SnoozeCriterion;
|
||||
@@ -63,6 +67,15 @@ public class NotificationSnooze extends LinearLayout
|
||||
private static final int MAX_ASSISTANT_SUGGESTIONS = 1;
|
||||
private static final String KEY_DEFAULT_SNOOZE = "default";
|
||||
private static final String KEY_OPTIONS = "options_array";
|
||||
private static final LogMaker OPTIONS_OPEN_LOG =
|
||||
new LogMaker(MetricsEvent.NOTIFICATION_SNOOZE_OPTIONS)
|
||||
.setType(MetricsEvent.TYPE_OPEN);
|
||||
private static final LogMaker OPTIONS_CLOSE_LOG =
|
||||
new LogMaker(MetricsEvent.NOTIFICATION_SNOOZE_OPTIONS)
|
||||
.setType(MetricsEvent.TYPE_CLOSE);
|
||||
private static final LogMaker UNDO_LOG =
|
||||
new LogMaker(MetricsEvent.NOTIFICATION_UNDO_SNOOZE)
|
||||
.setType(MetricsEvent.TYPE_ACTION);
|
||||
private NotificationGuts mGutsContainer;
|
||||
private NotificationSwipeActionHelper mSnoozeListener;
|
||||
private StatusBarNotification mSbn;
|
||||
@@ -88,6 +101,8 @@ public class NotificationSnooze extends LinearLayout
|
||||
R.id.action_snooze_longer,
|
||||
};
|
||||
|
||||
private MetricsLogger mMetricsLogger = new MetricsLogger();
|
||||
|
||||
public NotificationSnooze(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mParser = new KeyValueListParser(',');
|
||||
@@ -123,7 +138,13 @@ public class NotificationSnooze extends LinearLayout
|
||||
mSnoozeOptions = getDefaultSnoozeOptions();
|
||||
createOptionViews();
|
||||
|
||||
setSelected(mDefaultOption);
|
||||
setSelected(mDefaultOption, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
logOptionSelection(MetricsEvent.NOTIFICATION_SNOOZE_CLICKED, mDefaultOption);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -163,7 +184,7 @@ public class NotificationSnooze extends LinearLayout
|
||||
SnoozeOption so = mSnoozeOptions.get(i);
|
||||
if (so.getAccessibilityAction() != null
|
||||
&& so.getAccessibilityAction().getId() == action) {
|
||||
setSelected(so);
|
||||
setSelected(so, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -327,12 +348,24 @@ public class NotificationSnooze extends LinearLayout
|
||||
mExpandAnimation.start();
|
||||
}
|
||||
|
||||
private void setSelected(SnoozeOption option) {
|
||||
private void setSelected(SnoozeOption option, boolean userAction) {
|
||||
mSelectedOption = option;
|
||||
mSelectedOptionText.setText(option.getConfirmation());
|
||||
showSnoozeOptions(false);
|
||||
hideSelectedOption();
|
||||
sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
|
||||
if (userAction) {
|
||||
logOptionSelection(MetricsEvent.NOTIFICATION_SELECT_SNOOZE, option);
|
||||
}
|
||||
}
|
||||
|
||||
private void logOptionSelection(int category, SnoozeOption option) {
|
||||
int index = mSnoozeOptions.indexOf(option);
|
||||
long duration = TimeUnit.MINUTES.toMillis(option.getMinutesToSnoozeFor());
|
||||
mMetricsLogger.write(new LogMaker(category)
|
||||
.setType(MetricsEvent.TYPE_ACTION)
|
||||
.addTaggedData(MetricsEvent.FIELD_NOTIFICATION_SNOOZE_INDEX, index)
|
||||
.addTaggedData(MetricsEvent.FIELD_NOTIFICATION_SNOOZE_DURATION_MS, duration));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -343,13 +376,15 @@ public class NotificationSnooze extends LinearLayout
|
||||
final int id = v.getId();
|
||||
final SnoozeOption tag = (SnoozeOption) v.getTag();
|
||||
if (tag != null) {
|
||||
setSelected(tag);
|
||||
setSelected(tag, true);
|
||||
} else if (id == R.id.notification_snooze) {
|
||||
// Toggle snooze options
|
||||
showSnoozeOptions(!mExpanded);
|
||||
mMetricsLogger.write(!mExpanded ? OPTIONS_OPEN_LOG : OPTIONS_CLOSE_LOG);
|
||||
} else {
|
||||
// Undo snooze was selected
|
||||
undoSnooze(v);
|
||||
mMetricsLogger.write(UNDO_LOG);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,7 +415,7 @@ public class NotificationSnooze extends LinearLayout
|
||||
@Override
|
||||
public View getContentView() {
|
||||
// Reset the view before use
|
||||
setSelected(mDefaultOption);
|
||||
setSelected(mDefaultOption, false);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -402,7 +437,7 @@ public class NotificationSnooze extends LinearLayout
|
||||
return true;
|
||||
} else {
|
||||
// The view should actually be closed
|
||||
setSelected(mSnoozeOptions.get(0));
|
||||
setSelected(mSnoozeOptions.get(0), false);
|
||||
return false; // Return false here so that guts handles closing the view
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4538,6 +4538,30 @@ message MetricsEvent {
|
||||
// OS: O MR
|
||||
AUTOFILL_UI_LATENCY = 1136;
|
||||
|
||||
// Action: the snooze leave-behind was shown after the user clicked the snooze icon
|
||||
// OS: O MR
|
||||
NOTIFICATION_SNOOZE_CLICKED = 1137;
|
||||
|
||||
// Action: user selected a notification snooze duration from the drop down
|
||||
// OS: O MR
|
||||
NOTIFICATION_SELECT_SNOOZE = 1138;
|
||||
|
||||
// attached to NOTIFICATION_SNOOZED and NOTIFICATION_SELECT_SNOOZE events
|
||||
// OS: O MR
|
||||
FIELD_NOTIFICATION_SNOOZE_DURATION_MS = 1139;
|
||||
|
||||
// attached to NOTIFICATION_SELECT_SNOOZE events to indicate the option selected
|
||||
// OS: O MR
|
||||
FIELD_NOTIFICATION_SNOOZE_INDEX = 1140;
|
||||
|
||||
// Action: user tapped undo on the notification snooze leave-behind
|
||||
// OS: O MR
|
||||
NOTIFICATION_UNDO_SNOOZE = 1141;
|
||||
|
||||
// Action: user togged the visibility of the notification snooze options drop down
|
||||
// OS: O MR
|
||||
NOTIFICATION_SNOOZE_OPTIONS = 1142;
|
||||
|
||||
// ---- End O-MR1 Constants, all O-MR1 constants go above this line ----
|
||||
|
||||
// Add new aosp constants above this line.
|
||||
|
||||
@@ -3741,6 +3741,8 @@ public class NotificationManagerService extends SystemService {
|
||||
MetricsLogger.action(r.getLogMaker()
|
||||
.setCategory(MetricsEvent.NOTIFICATION_SNOOZED)
|
||||
.setType(MetricsEvent.TYPE_CLOSE)
|
||||
.addTaggedData(MetricsEvent.FIELD_NOTIFICATION_SNOOZE_DURATION_MS,
|
||||
mDuration)
|
||||
.addTaggedData(MetricsEvent.NOTIFICATION_SNOOZED_CRITERIA,
|
||||
mSnoozeCriterionId == null ? 0 : 1));
|
||||
boolean wasPosted = removeFromNotificationListsLocked(r);
|
||||
|
||||
Reference in New Issue
Block a user