New constructor for Notification.Builder takes a channelId.

Deprecated old constructor to provide a compile-time warning to
use Channels when upgrading to O.

Test: runtest systemui-notification
Change-Id: Iec8bc4257b4de4f601778bf60d77704165770813
This commit is contained in:
Geoffrey Pitsch
2017-01-12 09:35:54 -05:00
parent 8f3b174d90
commit 5caa276305
4 changed files with 21 additions and 4 deletions

View File

@@ -5176,7 +5176,8 @@ package android.app {
}
public static class Notification.Builder {
ctor public Notification.Builder(android.content.Context);
ctor public Notification.Builder(android.content.Context, java.lang.String);
ctor public deprecated Notification.Builder(android.content.Context);
method public deprecated android.app.Notification.Builder addAction(int, java.lang.CharSequence, android.app.PendingIntent);
method public android.app.Notification.Builder addAction(android.app.Notification.Action);
method public android.app.Notification.Builder addExtras(android.os.Bundle);

View File

@@ -5336,7 +5336,8 @@ package android.app {
}
public static class Notification.Builder {
ctor public Notification.Builder(android.content.Context);
ctor public Notification.Builder(android.content.Context, java.lang.String);
ctor public deprecated Notification.Builder(android.content.Context);
method public deprecated android.app.Notification.Builder addAction(int, java.lang.CharSequence, android.app.PendingIntent);
method public android.app.Notification.Builder addAction(android.app.Notification.Action);
method public android.app.Notification.Builder addExtras(android.os.Bundle);

View File

@@ -5186,7 +5186,8 @@ package android.app {
}
public static class Notification.Builder {
ctor public Notification.Builder(android.content.Context);
ctor public Notification.Builder(android.content.Context, java.lang.String);
ctor public deprecated Notification.Builder(android.content.Context);
method public deprecated android.app.Notification.Builder addAction(int, java.lang.CharSequence, android.app.PendingIntent);
method public android.app.Notification.Builder addAction(android.app.Notification.Action);
method public android.app.Notification.Builder addExtras(android.os.Bundle);

View File

@@ -2451,9 +2451,23 @@ public class Notification implements Parcelable
* A {@link Context} that will be used by the Builder to construct the
* RemoteViews. The Context will not be held past the lifetime of this Builder
* object.
* @param channelId
* The constructed Notification will be posted on this
* {@link NotificationChannel}. To use a NotificationChannel, it must first be
* created using {@link NotificationManager#createNotificationChannel}.
*/
public Builder(Context context, String channelId) {
this(context, (Notification) null);
mN.mChannelId = channelId;
}
/**
* @deprecated use {@link Notification.Builder#Notification.Builder(Context, String)}
* instead. All posted Notifications must specify a NotificationChannel Id.
*/
@Deprecated
public Builder(Context context) {
this(context, null);
this(context, (Notification) null);
}
/**