Merge "Move allowGeneratedReplies to Action" into nyc-dev

This commit is contained in:
TreeHugger Robot
2016-04-28 13:41:47 +00:00
committed by Android (Google) Code Review
4 changed files with 39 additions and 44 deletions

View File

@@ -4924,7 +4924,6 @@ package android.app {
field public static final int DEFAULT_LIGHTS = 4; // 0x4 field public static final int DEFAULT_LIGHTS = 4; // 0x4
field public static final int DEFAULT_SOUND = 1; // 0x1 field public static final int DEFAULT_SOUND = 1; // 0x1
field public static final int DEFAULT_VIBRATE = 2; // 0x2 field public static final int DEFAULT_VIBRATE = 2; // 0x2
field public static final java.lang.String EXTRA_ALLOW_GENERATED_REPLIES = "android.allowGeneratedReplies";
field public static final java.lang.String EXTRA_BACKGROUND_IMAGE_URI = "android.backgroundImageUri"; field public static final java.lang.String EXTRA_BACKGROUND_IMAGE_URI = "android.backgroundImageUri";
field public static final java.lang.String EXTRA_BIG_TEXT = "android.bigText"; field public static final java.lang.String EXTRA_BIG_TEXT = "android.bigText";
field public static final java.lang.String EXTRA_CHRONOMETER_COUNTS_DOWN = "android.chronometerCountsDown"; field public static final java.lang.String EXTRA_CHRONOMETER_COUNTS_DOWN = "android.chronometerCountsDown";
@@ -5007,6 +5006,7 @@ package android.app {
ctor public deprecated Notification.Action(int, java.lang.CharSequence, android.app.PendingIntent); ctor public deprecated Notification.Action(int, java.lang.CharSequence, android.app.PendingIntent);
method public android.app.Notification.Action clone(); method public android.app.Notification.Action clone();
method public int describeContents(); method public int describeContents();
method public boolean getAllowGeneratedReplies();
method public android.os.Bundle getExtras(); method public android.os.Bundle getExtras();
method public android.graphics.drawable.Icon getIcon(); method public android.graphics.drawable.Icon getIcon();
method public android.app.RemoteInput[] getRemoteInputs(); method public android.app.RemoteInput[] getRemoteInputs();
@@ -5026,6 +5026,7 @@ package android.app {
method public android.app.Notification.Action build(); method public android.app.Notification.Action build();
method public android.app.Notification.Action.Builder extend(android.app.Notification.Action.Extender); method public android.app.Notification.Action.Builder extend(android.app.Notification.Action.Extender);
method public android.os.Bundle getExtras(); method public android.os.Bundle getExtras();
method public android.app.Notification.Action.Builder setAllowGeneratedReplies(boolean);
} }
public static abstract interface Notification.Action.Extender { public static abstract interface Notification.Action.Extender {
@@ -5193,11 +5194,9 @@ package android.app {
ctor public Notification.MessagingStyle(java.lang.CharSequence); ctor public Notification.MessagingStyle(java.lang.CharSequence);
method public android.app.Notification.MessagingStyle addMessage(java.lang.CharSequence, long, java.lang.CharSequence); method public android.app.Notification.MessagingStyle addMessage(java.lang.CharSequence, long, java.lang.CharSequence);
method public android.app.Notification.MessagingStyle addMessage(android.app.Notification.MessagingStyle.Message); method public android.app.Notification.MessagingStyle addMessage(android.app.Notification.MessagingStyle.Message);
method public boolean getAllowGeneratedReplies();
method public java.lang.CharSequence getConversationTitle(); method public java.lang.CharSequence getConversationTitle();
method public java.util.List<android.app.Notification.MessagingStyle.Message> getMessages(); method public java.util.List<android.app.Notification.MessagingStyle.Message> getMessages();
method public java.lang.CharSequence getUserDisplayName(); method public java.lang.CharSequence getUserDisplayName();
method public android.app.Notification.MessagingStyle setAllowGeneratedReplies(boolean);
method public android.app.Notification.MessagingStyle setConversationTitle(java.lang.CharSequence); method public android.app.Notification.MessagingStyle setConversationTitle(java.lang.CharSequence);
field public static final int MAXIMUM_RETAINED_MESSAGES = 25; // 0x19 field public static final int MAXIMUM_RETAINED_MESSAGES = 25; // 0x19
} }

View File

@@ -5067,7 +5067,6 @@ package android.app {
field public static final int DEFAULT_LIGHTS = 4; // 0x4 field public static final int DEFAULT_LIGHTS = 4; // 0x4
field public static final int DEFAULT_SOUND = 1; // 0x1 field public static final int DEFAULT_SOUND = 1; // 0x1
field public static final int DEFAULT_VIBRATE = 2; // 0x2 field public static final int DEFAULT_VIBRATE = 2; // 0x2
field public static final java.lang.String EXTRA_ALLOW_GENERATED_REPLIES = "android.allowGeneratedReplies";
field public static final java.lang.String EXTRA_BACKGROUND_IMAGE_URI = "android.backgroundImageUri"; field public static final java.lang.String EXTRA_BACKGROUND_IMAGE_URI = "android.backgroundImageUri";
field public static final java.lang.String EXTRA_BIG_TEXT = "android.bigText"; field public static final java.lang.String EXTRA_BIG_TEXT = "android.bigText";
field public static final java.lang.String EXTRA_CHRONOMETER_COUNTS_DOWN = "android.chronometerCountsDown"; field public static final java.lang.String EXTRA_CHRONOMETER_COUNTS_DOWN = "android.chronometerCountsDown";
@@ -5152,6 +5151,7 @@ package android.app {
ctor public deprecated Notification.Action(int, java.lang.CharSequence, android.app.PendingIntent); ctor public deprecated Notification.Action(int, java.lang.CharSequence, android.app.PendingIntent);
method public android.app.Notification.Action clone(); method public android.app.Notification.Action clone();
method public int describeContents(); method public int describeContents();
method public boolean getAllowGeneratedReplies();
method public android.os.Bundle getExtras(); method public android.os.Bundle getExtras();
method public android.graphics.drawable.Icon getIcon(); method public android.graphics.drawable.Icon getIcon();
method public android.app.RemoteInput[] getRemoteInputs(); method public android.app.RemoteInput[] getRemoteInputs();
@@ -5171,6 +5171,7 @@ package android.app {
method public android.app.Notification.Action build(); method public android.app.Notification.Action build();
method public android.app.Notification.Action.Builder extend(android.app.Notification.Action.Extender); method public android.app.Notification.Action.Builder extend(android.app.Notification.Action.Extender);
method public android.os.Bundle getExtras(); method public android.os.Bundle getExtras();
method public android.app.Notification.Action.Builder setAllowGeneratedReplies(boolean);
} }
public static abstract interface Notification.Action.Extender { public static abstract interface Notification.Action.Extender {
@@ -5338,11 +5339,9 @@ package android.app {
ctor public Notification.MessagingStyle(java.lang.CharSequence); ctor public Notification.MessagingStyle(java.lang.CharSequence);
method public android.app.Notification.MessagingStyle addMessage(java.lang.CharSequence, long, java.lang.CharSequence); method public android.app.Notification.MessagingStyle addMessage(java.lang.CharSequence, long, java.lang.CharSequence);
method public android.app.Notification.MessagingStyle addMessage(android.app.Notification.MessagingStyle.Message); method public android.app.Notification.MessagingStyle addMessage(android.app.Notification.MessagingStyle.Message);
method public boolean getAllowGeneratedReplies();
method public java.lang.CharSequence getConversationTitle(); method public java.lang.CharSequence getConversationTitle();
method public java.util.List<android.app.Notification.MessagingStyle.Message> getMessages(); method public java.util.List<android.app.Notification.MessagingStyle.Message> getMessages();
method public java.lang.CharSequence getUserDisplayName(); method public java.lang.CharSequence getUserDisplayName();
method public android.app.Notification.MessagingStyle setAllowGeneratedReplies(boolean);
method public android.app.Notification.MessagingStyle setConversationTitle(java.lang.CharSequence); method public android.app.Notification.MessagingStyle setConversationTitle(java.lang.CharSequence);
field public static final int MAXIMUM_RETAINED_MESSAGES = 25; // 0x19 field public static final int MAXIMUM_RETAINED_MESSAGES = 25; // 0x19
} }

View File

@@ -4924,7 +4924,6 @@ package android.app {
field public static final int DEFAULT_LIGHTS = 4; // 0x4 field public static final int DEFAULT_LIGHTS = 4; // 0x4
field public static final int DEFAULT_SOUND = 1; // 0x1 field public static final int DEFAULT_SOUND = 1; // 0x1
field public static final int DEFAULT_VIBRATE = 2; // 0x2 field public static final int DEFAULT_VIBRATE = 2; // 0x2
field public static final java.lang.String EXTRA_ALLOW_GENERATED_REPLIES = "android.allowGeneratedReplies";
field public static final java.lang.String EXTRA_BACKGROUND_IMAGE_URI = "android.backgroundImageUri"; field public static final java.lang.String EXTRA_BACKGROUND_IMAGE_URI = "android.backgroundImageUri";
field public static final java.lang.String EXTRA_BIG_TEXT = "android.bigText"; field public static final java.lang.String EXTRA_BIG_TEXT = "android.bigText";
field public static final java.lang.String EXTRA_CHRONOMETER_COUNTS_DOWN = "android.chronometerCountsDown"; field public static final java.lang.String EXTRA_CHRONOMETER_COUNTS_DOWN = "android.chronometerCountsDown";
@@ -5007,6 +5006,7 @@ package android.app {
ctor public deprecated Notification.Action(int, java.lang.CharSequence, android.app.PendingIntent); ctor public deprecated Notification.Action(int, java.lang.CharSequence, android.app.PendingIntent);
method public android.app.Notification.Action clone(); method public android.app.Notification.Action clone();
method public int describeContents(); method public int describeContents();
method public boolean getAllowGeneratedReplies();
method public android.os.Bundle getExtras(); method public android.os.Bundle getExtras();
method public android.graphics.drawable.Icon getIcon(); method public android.graphics.drawable.Icon getIcon();
method public android.app.RemoteInput[] getRemoteInputs(); method public android.app.RemoteInput[] getRemoteInputs();
@@ -5026,6 +5026,7 @@ package android.app {
method public android.app.Notification.Action build(); method public android.app.Notification.Action build();
method public android.app.Notification.Action.Builder extend(android.app.Notification.Action.Extender); method public android.app.Notification.Action.Builder extend(android.app.Notification.Action.Extender);
method public android.os.Bundle getExtras(); method public android.os.Bundle getExtras();
method public android.app.Notification.Action.Builder setAllowGeneratedReplies(boolean);
} }
public static abstract interface Notification.Action.Extender { public static abstract interface Notification.Action.Extender {
@@ -5193,11 +5194,9 @@ package android.app {
ctor public Notification.MessagingStyle(java.lang.CharSequence); ctor public Notification.MessagingStyle(java.lang.CharSequence);
method public android.app.Notification.MessagingStyle addMessage(java.lang.CharSequence, long, java.lang.CharSequence); method public android.app.Notification.MessagingStyle addMessage(java.lang.CharSequence, long, java.lang.CharSequence);
method public android.app.Notification.MessagingStyle addMessage(android.app.Notification.MessagingStyle.Message); method public android.app.Notification.MessagingStyle addMessage(android.app.Notification.MessagingStyle.Message);
method public boolean getAllowGeneratedReplies();
method public java.lang.CharSequence getConversationTitle(); method public java.lang.CharSequence getConversationTitle();
method public java.util.List<android.app.Notification.MessagingStyle.Message> getMessages(); method public java.util.List<android.app.Notification.MessagingStyle.Message> getMessages();
method public java.lang.CharSequence getUserDisplayName(); method public java.lang.CharSequence getUserDisplayName();
method public android.app.Notification.MessagingStyle setAllowGeneratedReplies(boolean);
method public android.app.Notification.MessagingStyle setConversationTitle(java.lang.CharSequence); method public android.app.Notification.MessagingStyle setConversationTitle(java.lang.CharSequence);
field public static final int MAXIMUM_RETAINED_MESSAGES = 25; // 0x19 field public static final int MAXIMUM_RETAINED_MESSAGES = 25; // 0x19
} }

View File

@@ -938,14 +938,6 @@ public class Notification implements Parcelable
*/ */
public static final String EXTRA_SELF_DISPLAY_NAME = "android.selfDisplayName"; public static final String EXTRA_SELF_DISPLAY_NAME = "android.selfDisplayName";
/**
* {@link #extras} key: a boolean describing whether the platform should automatically
* generate possible replies to
* {@link android.app.Notification.MessagingStyle.Message} objects provided by a
* {@link android.app.Notification.MessagingStyle} notification.
*/
public static final String EXTRA_ALLOW_GENERATED_REPLIES = "android.allowGeneratedReplies";
/** /**
* {@link #extras} key: a {@link String} to be displayed as the title to a conversation * {@link #extras} key: a {@link String} to be displayed as the title to a conversation
* represented by a {@link android.app.Notification.MessagingStyle} * represented by a {@link android.app.Notification.MessagingStyle}
@@ -996,6 +988,7 @@ public class Notification implements Parcelable
private final Bundle mExtras; private final Bundle mExtras;
private Icon mIcon; private Icon mIcon;
private final RemoteInput[] mRemoteInputs; private final RemoteInput[] mRemoteInputs;
private boolean mAllowGeneratedReplies = false;
/** /**
* Small icon representing the action. * Small icon representing the action.
@@ -1029,6 +1022,7 @@ public class Notification implements Parcelable
} }
mExtras = Bundle.setDefusable(in.readBundle(), true); mExtras = Bundle.setDefusable(in.readBundle(), true);
mRemoteInputs = in.createTypedArray(RemoteInput.CREATOR); mRemoteInputs = in.createTypedArray(RemoteInput.CREATOR);
mAllowGeneratedReplies = in.readInt() == 1;
} }
/** /**
@@ -1036,11 +1030,11 @@ public class Notification implements Parcelable
*/ */
@Deprecated @Deprecated
public Action(int icon, CharSequence title, PendingIntent intent) { public Action(int icon, CharSequence title, PendingIntent intent) {
this(Icon.createWithResource("", icon), title, intent, new Bundle(), null); this(Icon.createWithResource("", icon), title, intent, new Bundle(), null, false);
} }
private Action(Icon icon, CharSequence title, PendingIntent intent, Bundle extras, private Action(Icon icon, CharSequence title, PendingIntent intent, Bundle extras,
RemoteInput[] remoteInputs) { RemoteInput[] remoteInputs, boolean allowGeneratedReplies) {
this.mIcon = icon; this.mIcon = icon;
if (icon != null && icon.getType() == Icon.TYPE_RESOURCE) { if (icon != null && icon.getType() == Icon.TYPE_RESOURCE) {
this.icon = icon.getResId(); this.icon = icon.getResId();
@@ -1049,6 +1043,7 @@ public class Notification implements Parcelable
this.actionIntent = intent; this.actionIntent = intent;
this.mExtras = extras != null ? extras : new Bundle(); this.mExtras = extras != null ? extras : new Bundle();
this.mRemoteInputs = remoteInputs; this.mRemoteInputs = remoteInputs;
this.mAllowGeneratedReplies = allowGeneratedReplies;
} }
/** /**
@@ -1069,6 +1064,14 @@ public class Notification implements Parcelable
return mExtras; return mExtras;
} }
/**
* Return whether the platform should automatically generate possible replies for this
* {@link Action}
*/
public boolean getAllowGeneratedReplies() {
return mAllowGeneratedReplies;
}
/** /**
* Get the list of inputs to be collected from the user when this action is sent. * Get the list of inputs to be collected from the user when this action is sent.
* May return null if no remote inputs were added. * May return null if no remote inputs were added.
@@ -1084,6 +1087,7 @@ public class Notification implements Parcelable
private final Icon mIcon; private final Icon mIcon;
private final CharSequence mTitle; private final CharSequence mTitle;
private final PendingIntent mIntent; private final PendingIntent mIntent;
private boolean mAllowGeneratedReplies;
private final Bundle mExtras; private final Bundle mExtras;
private ArrayList<RemoteInput> mRemoteInputs; private ArrayList<RemoteInput> mRemoteInputs;
@@ -1168,6 +1172,20 @@ public class Notification implements Parcelable
return this; return this;
} }
/**
* Set whether the platform should automatically generate possible replies to add to
* {@link RemoteInput#getChoices()}. If the {@link Action} doesn't have a
* {@link RemoteInput}, this has no effect.
* @param allowGeneratedReplies {@code true} to allow generated replies, {@code false}
* otherwise
* @return this object for method chaining
* The default value is {@code false}
*/
public Builder setAllowGeneratedReplies(boolean allowGeneratedReplies) {
mAllowGeneratedReplies = allowGeneratedReplies;
return this;
}
/** /**
* Apply an extender to this action builder. Extenders may be used to add * Apply an extender to this action builder. Extenders may be used to add
* metadata or change options on this builder. * metadata or change options on this builder.
@@ -1185,7 +1203,8 @@ public class Notification implements Parcelable
public Action build() { public Action build() {
RemoteInput[] remoteInputs = mRemoteInputs != null RemoteInput[] remoteInputs = mRemoteInputs != null
? mRemoteInputs.toArray(new RemoteInput[mRemoteInputs.size()]) : null; ? mRemoteInputs.toArray(new RemoteInput[mRemoteInputs.size()]) : null;
return new Action(mIcon, mTitle, mIntent, mExtras, remoteInputs); return new Action(mIcon, mTitle, mIntent, mExtras, remoteInputs,
mAllowGeneratedReplies);
} }
} }
@@ -1196,7 +1215,8 @@ public class Notification implements Parcelable
title, title,
actionIntent, // safe to alias actionIntent, // safe to alias
new Bundle(mExtras), new Bundle(mExtras),
getRemoteInputs()); getRemoteInputs(),
getAllowGeneratedReplies());
} }
@Override @Override
public int describeContents() { public int describeContents() {
@@ -1220,6 +1240,7 @@ public class Notification implements Parcelable
} }
out.writeBundle(mExtras); out.writeBundle(mExtras);
out.writeTypedArray(mRemoteInputs, flags); out.writeTypedArray(mRemoteInputs, flags);
out.writeInt(mAllowGeneratedReplies ? 1 : 0);
} }
public static final Parcelable.Creator<Action> CREATOR = public static final Parcelable.Creator<Action> CREATOR =
new Parcelable.Creator<Action>() { new Parcelable.Creator<Action>() {
@@ -4333,7 +4354,6 @@ public class Notification implements Parcelable
CharSequence mUserDisplayName; CharSequence mUserDisplayName;
CharSequence mConversationTitle; CharSequence mConversationTitle;
boolean mAllowGeneratedReplies = true;
List<Message> mMessages = new ArrayList<>(); List<Message> mMessages = new ArrayList<>();
MessagingStyle() { MessagingStyle() {
@@ -4356,25 +4376,6 @@ public class Notification implements Parcelable
return mUserDisplayName; return mUserDisplayName;
} }
/**
* Set whether the platform should automatically generate possible replies from messages.
* @param allowGeneratedReplies {@code true} to allow generated replies, {@code false}
* otherwise
* @return this object for method chaining
* The default value is {@code true}
*/
public MessagingStyle setAllowGeneratedReplies(boolean allowGeneratedReplies) {
mAllowGeneratedReplies = allowGeneratedReplies;
return this;
}
/**
* Return whether the platform should automatically generate possible replies from messages.
*/
public boolean getAllowGeneratedReplies() {
return mAllowGeneratedReplies;
}
/** /**
* Sets the title to be displayed on this conversation. This should only be used for * Sets the title to be displayed on this conversation. This should only be used for
* group messaging and left unset for one-on-one conversations. * group messaging and left unset for one-on-one conversations.
@@ -4449,7 +4450,6 @@ public class Notification implements Parcelable
if (mConversationTitle != null) { if (mConversationTitle != null) {
extras.putCharSequence(EXTRA_CONVERSATION_TITLE, mConversationTitle); extras.putCharSequence(EXTRA_CONVERSATION_TITLE, mConversationTitle);
} }
extras.putBoolean(EXTRA_ALLOW_GENERATED_REPLIES, mAllowGeneratedReplies);
if (!mMessages.isEmpty()) { extras.putParcelableArray(EXTRA_MESSAGES, if (!mMessages.isEmpty()) { extras.putParcelableArray(EXTRA_MESSAGES,
Message.getBundleArrayForMessages(mMessages)); Message.getBundleArrayForMessages(mMessages));
} }
@@ -4465,8 +4465,6 @@ public class Notification implements Parcelable
mMessages.clear(); mMessages.clear();
mUserDisplayName = extras.getString(EXTRA_SELF_DISPLAY_NAME); mUserDisplayName = extras.getString(EXTRA_SELF_DISPLAY_NAME);
mConversationTitle = extras.getString(EXTRA_CONVERSATION_TITLE); mConversationTitle = extras.getString(EXTRA_CONVERSATION_TITLE);
mAllowGeneratedReplies = extras.getBoolean(EXTRA_ALLOW_GENERATED_REPLIES,
mAllowGeneratedReplies);
Parcelable[] parcelables = extras.getParcelableArray(EXTRA_MESSAGES); Parcelable[] parcelables = extras.getParcelableArray(EXTRA_MESSAGES);
if (parcelables != null && parcelables instanceof Parcelable[]) { if (parcelables != null && parcelables instanceof Parcelable[]) {
mMessages = Message.getMessagesFromBundleArray(parcelables); mMessages = Message.getMessagesFromBundleArray(parcelables);