Merge "Rename smart replies and actions adjustment keys"

This commit is contained in:
TreeHugger Robot
2019-01-28 15:03:43 +00:00
committed by Android (Google) Code Review
5 changed files with 14 additions and 12 deletions

View File

@@ -41406,9 +41406,9 @@ package android.service.notification {
method public int getUser();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.service.notification.Adjustment> CREATOR;
field public static final String KEY_CONTEXTUAL_ACTIONS = "key_contextual_actions";
field public static final String KEY_IMPORTANCE = "key_importance";
field public static final String KEY_SMART_ACTIONS = "key_smart_actions";
field public static final String KEY_SMART_REPLIES = "key_smart_replies";
field public static final String KEY_TEXT_REPLIES = "key_text_replies";
field public static final String KEY_USER_SENTIMENT = "key_user_sentiment";
}

View File

@@ -63,15 +63,17 @@ public final class Adjustment implements Parcelable {
/**
* Data type: ArrayList of {@link android.app.Notification.Action}.
* Used to suggest extra actions for a notification.
* Used to suggest contextual actions for a notification.
*
* @see Notification.Action.Builder#setContextual(boolean)
*/
public static final String KEY_SMART_ACTIONS = "key_smart_actions";
public static final String KEY_CONTEXTUAL_ACTIONS = "key_contextual_actions";
/**
* Data type: ArrayList of {@link CharSequence}.
* Used to suggest smart replies for a notification.
*/
public static final String KEY_SMART_REPLIES = "key_smart_replies";
public static final String KEY_TEXT_REPLIES = "key_text_replies";
/**
* Data type: int, one of importance values e.g.

View File

@@ -230,10 +230,10 @@ public class Assistant extends NotificationAssistantService {
Bundle signals = new Bundle();
if (!smartActions.isEmpty()) {
signals.putParcelableArrayList(Adjustment.KEY_SMART_ACTIONS, smartActions);
signals.putParcelableArrayList(Adjustment.KEY_CONTEXTUAL_ACTIONS, smartActions);
}
if (!smartReplies.isEmpty()) {
signals.putCharSequenceArrayList(Adjustment.KEY_SMART_REPLIES, smartReplies);
signals.putCharSequenceArrayList(Adjustment.KEY_TEXT_REPLIES, smartReplies);
}
if (mSettings.mNewInterruptionModel) {
if (mNotificationCategorizer.shouldSilence(entry)) {

View File

@@ -667,15 +667,15 @@ public final class NotificationRecord {
getUserSentiment()));
}
}
if (signals.containsKey(Adjustment.KEY_SMART_ACTIONS)) {
if (signals.containsKey(Adjustment.KEY_CONTEXTUAL_ACTIONS)) {
setSystemGeneratedSmartActions(
signals.getParcelableArrayList(Adjustment.KEY_SMART_ACTIONS));
signals.getParcelableArrayList(Adjustment.KEY_CONTEXTUAL_ACTIONS));
MetricsLogger.action(getAdjustmentLogMaker()
.addTaggedData(MetricsEvent.ADJUSTMENT_KEY_SMART_ACTIONS,
getSystemGeneratedSmartActions().size()));
}
if (signals.containsKey(Adjustment.KEY_SMART_REPLIES)) {
setSmartReplies(signals.getCharSequenceArrayList(Adjustment.KEY_SMART_REPLIES));
if (signals.containsKey(Adjustment.KEY_TEXT_REPLIES)) {
setSmartReplies(signals.getCharSequenceArrayList(Adjustment.KEY_TEXT_REPLIES));
MetricsLogger.action(getAdjustmentLogMaker()
.addTaggedData(MetricsEvent.ADJUSTMENT_KEY_SMART_REPLIES,
getSmartReplies().size()));

View File

@@ -59,7 +59,7 @@ public class NotificationAdjustmentExtractorTest extends UiServiceTestCase {
signals.putStringArrayList(Adjustment.KEY_PEOPLE, people);
ArrayList<Notification.Action> smartActions = new ArrayList<>();
smartActions.add(createAction());
signals.putParcelableArrayList(Adjustment.KEY_SMART_ACTIONS, smartActions);
signals.putParcelableArrayList(Adjustment.KEY_CONTEXTUAL_ACTIONS, smartActions);
Adjustment adjustment = new Adjustment("pkg", r.getKey(), signals, "", 0);
r.addAdjustment(adjustment);