Loading api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -5482,6 +5482,7 @@ package android.app { public final class NotificationChannel implements android.os.Parcelable { ctor public NotificationChannel(java.lang.String, java.lang.CharSequence, int); ctor public NotificationChannel(java.lang.String, int, int); ctor protected NotificationChannel(android.os.Parcel); method public boolean canBypassDnd(); method public boolean canShowBadge(); Loading @@ -5495,6 +5496,7 @@ package android.app { method public int getLightColor(); method public int getLockscreenVisibility(); method public java.lang.CharSequence getName(); method public int getNameResId(); method public android.net.Uri getSound(); method public long[] getVibrationPattern(); method public void setBypassDnd(boolean); api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -5658,6 +5658,7 @@ package android.app { public final class NotificationChannel implements android.os.Parcelable { ctor public NotificationChannel(java.lang.String, java.lang.CharSequence, int); ctor public NotificationChannel(java.lang.String, int, int); ctor protected NotificationChannel(android.os.Parcel); method public boolean canBypassDnd(); method public boolean canShowBadge(); Loading @@ -5671,6 +5672,7 @@ package android.app { method public int getLightColor(); method public int getLockscreenVisibility(); method public java.lang.CharSequence getName(); method public int getNameResId(); method public android.net.Uri getSound(); method public int getUserLockedFields(); method public long[] getVibrationPattern(); api/test-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -5492,6 +5492,7 @@ package android.app { public final class NotificationChannel implements android.os.Parcelable { ctor public NotificationChannel(java.lang.String, java.lang.CharSequence, int); ctor public NotificationChannel(java.lang.String, int, int); ctor protected NotificationChannel(android.os.Parcel); method public boolean canBypassDnd(); method public boolean canShowBadge(); Loading @@ -5505,6 +5506,7 @@ package android.app { method public int getLightColor(); method public int getLockscreenVisibility(); method public java.lang.CharSequence getName(); method public int getNameResId(); method public android.net.Uri getSound(); method public long[] getVibrationPattern(); method public void setBypassDnd(boolean); core/java/android/app/NotificationChannel.java +41 −4 Original line number Diff line number Diff line Loading @@ -20,8 +20,10 @@ import org.json.JSONObject; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlSerializer; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.StringRes; import android.annotation.SystemApi; import android.graphics.Color; import android.media.AudioAttributes; import android.net.Uri; import android.os.Parcel; Loading @@ -45,6 +47,7 @@ public final class NotificationChannel implements Parcelable { private static final String TAG_CHANNEL = "channel"; private static final String ATT_NAME = "name"; private static final String ATT_NAME_RES_ID = "name_res_id"; private static final String ATT_ID = "id"; private static final String ATT_DELETED = "deleted"; private static final String ATT_PRIORITY = "priority"; Loading Loading @@ -138,6 +141,7 @@ public final class NotificationChannel implements Parcelable { private final String mId; private CharSequence mName; private int mNameResId = 0; private int mImportance = DEFAULT_IMPORTANCE; private boolean mBypassDnd; private int mLockscreenVisibility = DEFAULT_VISIBILITY; Loading @@ -156,7 +160,9 @@ public final class NotificationChannel implements Parcelable { * Creates a notification channel. * * @param id The id of the channel. Must be unique per package. * @param name The user visible name of the channel. * @param name The user visible name of the channel. Unchangeable once created; use this * constructor if the channel represents a user-defined category that does not * need to be translated. * @param importance The importance of the channel. This controls how interruptive notifications * posted to this channel are. See e.g. * {@link NotificationManager#IMPORTANCE_DEFAULT}. Loading @@ -167,6 +173,21 @@ public final class NotificationChannel implements Parcelable { this.mImportance = importance; } /** * Creates a notification channel. * * @param id The id of the channel. Must be unique per package. * @param nameResId The resource id of the string containing the channel name. * @param importance The importance of the channel. This controls how interruptive notifications * posted to this channel are. See e.g. * {@link NotificationManager#IMPORTANCE_DEFAULT}. */ public NotificationChannel(String id, @StringRes int nameResId, int importance) { this.mId = id; this.mNameResId = nameResId; this.mImportance = importance; } protected NotificationChannel(Parcel in) { if (in.readByte() != 0) { mId = in.readString(); Loading @@ -174,6 +195,7 @@ public final class NotificationChannel implements Parcelable { mId = null; } mName = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); mNameResId = in.readInt(); mImportance = in.readInt(); mBypassDnd = in.readByte() != 0; mLockscreenVisibility = in.readInt(); Loading Loading @@ -206,6 +228,7 @@ public final class NotificationChannel implements Parcelable { dest.writeByte((byte) 0); } TextUtils.writeToParcel(mName, dest, flags); dest.writeInt(mNameResId); dest.writeInt(mImportance); dest.writeByte(mBypassDnd ? (byte) 1 : (byte) 0); dest.writeInt(mLockscreenVisibility); Loading Loading @@ -382,10 +405,17 @@ public final class NotificationChannel implements Parcelable { /** * Returns the user visible name of this channel. */ public CharSequence getName() { public @Nullable CharSequence getName() { return mName; } /** * Returns the resource id of the user visible name of this channel. */ public int getNameResId() { return mNameResId; } /** * Returns the user specified importance {e.g. @link NotificationManager#IMPORTANCE_LOW} for * notifications posted to this channel. Loading Loading @@ -516,7 +546,10 @@ public final class NotificationChannel implements Parcelable { public void writeXml(XmlSerializer out) throws IOException { out.startTag(null, TAG_CHANNEL); out.attribute(null, ATT_ID, getId()); if (getName() != null) { out.attribute(null, ATT_NAME, getName().toString()); } out.attribute(null, ATT_NAME_RES_ID, Integer.toString(getNameResId())); if (getImportance() != DEFAULT_IMPORTANCE) { out.attribute( null, ATT_IMPORTANCE, Integer.toString(getImportance())); Loading Loading @@ -574,6 +607,7 @@ public final class NotificationChannel implements Parcelable { JSONObject record = new JSONObject(); record.put(ATT_ID, getId()); record.put(ATT_NAME, getName()); record.put(ATT_NAME_RES_ID, getNameResId()); if (getImportance() != DEFAULT_IMPORTANCE) { record.put(ATT_IMPORTANCE, NotificationListenerService.Ranking.importanceToString(getImportance())); Loading Loading @@ -691,6 +725,7 @@ public final class NotificationChannel implements Parcelable { NotificationChannel that = (NotificationChannel) o; if (getNameResId() != that.getNameResId()) return false; if (getImportance() != that.getImportance()) return false; if (mBypassDnd != that.mBypassDnd) return false; if (getLockscreenVisibility() != that.getLockscreenVisibility()) return false; Loading Loading @@ -720,6 +755,7 @@ public final class NotificationChannel implements Parcelable { public int hashCode() { int result = getId() != null ? getId().hashCode() : 0; result = 31 * result + (getName() != null ? getName().hashCode() : 0); result = 31 * result + getNameResId(); result = 31 * result + getImportance(); result = 31 * result + (mBypassDnd ? 1 : 0); result = 31 * result + getLockscreenVisibility(); Loading @@ -741,6 +777,7 @@ public final class NotificationChannel implements Parcelable { return "NotificationChannel{" + "mId='" + mId + '\'' + ", mName=" + mName + ", mNameResId=" + mNameResId + ", mImportance=" + mImportance + ", mBypassDnd=" + mBypassDnd + ", mLockscreenVisibility=" + mLockscreenVisibility + Loading core/java/com/android/internal/notification/SystemNotificationChannels.java +14 −14 Original line number Diff line number Diff line Loading @@ -48,12 +48,12 @@ public class SystemNotificationChannels { List<NotificationChannel> channelsList = new ArrayList<NotificationChannel>(); channelsList.add(new NotificationChannel( VIRTUAL_KEYBOARD, context.getString(R.string.notification_channel_virtual_keyboard), R.string.notification_channel_virtual_keyboard, NotificationManager.IMPORTANCE_LOW)); final NotificationChannel physicalKeyboardChannel = new NotificationChannel( PHYSICAL_KEYBOARD, context.getString(R.string.notification_channel_physical_keyboard), R.string.notification_channel_physical_keyboard, NotificationManager.IMPORTANCE_DEFAULT); physicalKeyboardChannel.setSound(Settings.System.DEFAULT_NOTIFICATION_URI, Notification.AUDIO_ATTRIBUTES_DEFAULT); Loading @@ -61,32 +61,32 @@ public class SystemNotificationChannels { channelsList.add(new NotificationChannel( SECURITY, context.getString(R.string.notification_channel_security), R.string.notification_channel_security, NotificationManager.IMPORTANCE_LOW)); channelsList.add(new NotificationChannel( CAR_MODE, context.getString(R.string.notification_channel_car_mode), R.string.notification_channel_car_mode, NotificationManager.IMPORTANCE_LOW)); channelsList.add(new NotificationChannel( DEVELOPER, context.getString(R.string.notification_channel_developer), R.string.notification_channel_developer, NotificationManager.IMPORTANCE_LOW)); channelsList.add(new NotificationChannel( UPDATES, context.getString(R.string.notification_channel_updates), R.string.notification_channel_updates, NotificationManager.IMPORTANCE_LOW)); channelsList.add(new NotificationChannel( NETWORK_STATUS, context.getString(R.string.notification_channel_network_status), R.string.notification_channel_network_status, NotificationManager.IMPORTANCE_LOW)); final NotificationChannel networkAlertsChannel = new NotificationChannel( NETWORK_ALERTS, context.getString(R.string.notification_channel_network_alerts), R.string.notification_channel_network_alerts, NotificationManager.IMPORTANCE_HIGH); networkAlertsChannel.setSound(Settings.System.DEFAULT_NOTIFICATION_URI, Notification.AUDIO_ATTRIBUTES_DEFAULT); Loading @@ -94,17 +94,17 @@ public class SystemNotificationChannels { channelsList.add(new NotificationChannel( VPN, context.getString(R.string.notification_channel_vpn), R.string.notification_channel_vpn, NotificationManager.IMPORTANCE_LOW)); channelsList.add(new NotificationChannel( DEVICE_ADMIN, context.getString(R.string.notification_channel_device_admin), R.string.notification_channel_device_admin, NotificationManager.IMPORTANCE_LOW)); final NotificationChannel alertsChannel = new NotificationChannel( ALERTS, context.getString(R.string.notification_channel_alerts), R.string.notification_channel_alerts, NotificationManager.IMPORTANCE_DEFAULT); alertsChannel.setSound(Settings.System.DEFAULT_NOTIFICATION_URI, Notification.AUDIO_ATTRIBUTES_DEFAULT); Loading @@ -112,12 +112,12 @@ public class SystemNotificationChannels { channelsList.add(new NotificationChannel( RETAIL_MODE, context.getString(R.string.notification_channel_retail_mode), R.string.notification_channel_retail_mode, NotificationManager.IMPORTANCE_LOW)); channelsList.add(new NotificationChannel( USB, context.getString(R.string.notification_channel_usb), R.string.notification_channel_usb, NotificationManager.IMPORTANCE_MIN)); nm.createNotificationChannels(channelsList); Loading @@ -128,7 +128,7 @@ public class SystemNotificationChannels { final NotificationManager nm = context.getSystemService(NotificationManager.class); nm.createNotificationChannelsForPackage(pkg, Arrays.asList(new NotificationChannel( ACCOUNT, context.getString(R.string.notification_channel_account), R.string.notification_channel_account, NotificationManager.IMPORTANCE_LOW))); } Loading Loading
api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -5482,6 +5482,7 @@ package android.app { public final class NotificationChannel implements android.os.Parcelable { ctor public NotificationChannel(java.lang.String, java.lang.CharSequence, int); ctor public NotificationChannel(java.lang.String, int, int); ctor protected NotificationChannel(android.os.Parcel); method public boolean canBypassDnd(); method public boolean canShowBadge(); Loading @@ -5495,6 +5496,7 @@ package android.app { method public int getLightColor(); method public int getLockscreenVisibility(); method public java.lang.CharSequence getName(); method public int getNameResId(); method public android.net.Uri getSound(); method public long[] getVibrationPattern(); method public void setBypassDnd(boolean);
api/system-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -5658,6 +5658,7 @@ package android.app { public final class NotificationChannel implements android.os.Parcelable { ctor public NotificationChannel(java.lang.String, java.lang.CharSequence, int); ctor public NotificationChannel(java.lang.String, int, int); ctor protected NotificationChannel(android.os.Parcel); method public boolean canBypassDnd(); method public boolean canShowBadge(); Loading @@ -5671,6 +5672,7 @@ package android.app { method public int getLightColor(); method public int getLockscreenVisibility(); method public java.lang.CharSequence getName(); method public int getNameResId(); method public android.net.Uri getSound(); method public int getUserLockedFields(); method public long[] getVibrationPattern();
api/test-current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -5492,6 +5492,7 @@ package android.app { public final class NotificationChannel implements android.os.Parcelable { ctor public NotificationChannel(java.lang.String, java.lang.CharSequence, int); ctor public NotificationChannel(java.lang.String, int, int); ctor protected NotificationChannel(android.os.Parcel); method public boolean canBypassDnd(); method public boolean canShowBadge(); Loading @@ -5505,6 +5506,7 @@ package android.app { method public int getLightColor(); method public int getLockscreenVisibility(); method public java.lang.CharSequence getName(); method public int getNameResId(); method public android.net.Uri getSound(); method public long[] getVibrationPattern(); method public void setBypassDnd(boolean);
core/java/android/app/NotificationChannel.java +41 −4 Original line number Diff line number Diff line Loading @@ -20,8 +20,10 @@ import org.json.JSONObject; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlSerializer; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.StringRes; import android.annotation.SystemApi; import android.graphics.Color; import android.media.AudioAttributes; import android.net.Uri; import android.os.Parcel; Loading @@ -45,6 +47,7 @@ public final class NotificationChannel implements Parcelable { private static final String TAG_CHANNEL = "channel"; private static final String ATT_NAME = "name"; private static final String ATT_NAME_RES_ID = "name_res_id"; private static final String ATT_ID = "id"; private static final String ATT_DELETED = "deleted"; private static final String ATT_PRIORITY = "priority"; Loading Loading @@ -138,6 +141,7 @@ public final class NotificationChannel implements Parcelable { private final String mId; private CharSequence mName; private int mNameResId = 0; private int mImportance = DEFAULT_IMPORTANCE; private boolean mBypassDnd; private int mLockscreenVisibility = DEFAULT_VISIBILITY; Loading @@ -156,7 +160,9 @@ public final class NotificationChannel implements Parcelable { * Creates a notification channel. * * @param id The id of the channel. Must be unique per package. * @param name The user visible name of the channel. * @param name The user visible name of the channel. Unchangeable once created; use this * constructor if the channel represents a user-defined category that does not * need to be translated. * @param importance The importance of the channel. This controls how interruptive notifications * posted to this channel are. See e.g. * {@link NotificationManager#IMPORTANCE_DEFAULT}. Loading @@ -167,6 +173,21 @@ public final class NotificationChannel implements Parcelable { this.mImportance = importance; } /** * Creates a notification channel. * * @param id The id of the channel. Must be unique per package. * @param nameResId The resource id of the string containing the channel name. * @param importance The importance of the channel. This controls how interruptive notifications * posted to this channel are. See e.g. * {@link NotificationManager#IMPORTANCE_DEFAULT}. */ public NotificationChannel(String id, @StringRes int nameResId, int importance) { this.mId = id; this.mNameResId = nameResId; this.mImportance = importance; } protected NotificationChannel(Parcel in) { if (in.readByte() != 0) { mId = in.readString(); Loading @@ -174,6 +195,7 @@ public final class NotificationChannel implements Parcelable { mId = null; } mName = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in); mNameResId = in.readInt(); mImportance = in.readInt(); mBypassDnd = in.readByte() != 0; mLockscreenVisibility = in.readInt(); Loading Loading @@ -206,6 +228,7 @@ public final class NotificationChannel implements Parcelable { dest.writeByte((byte) 0); } TextUtils.writeToParcel(mName, dest, flags); dest.writeInt(mNameResId); dest.writeInt(mImportance); dest.writeByte(mBypassDnd ? (byte) 1 : (byte) 0); dest.writeInt(mLockscreenVisibility); Loading Loading @@ -382,10 +405,17 @@ public final class NotificationChannel implements Parcelable { /** * Returns the user visible name of this channel. */ public CharSequence getName() { public @Nullable CharSequence getName() { return mName; } /** * Returns the resource id of the user visible name of this channel. */ public int getNameResId() { return mNameResId; } /** * Returns the user specified importance {e.g. @link NotificationManager#IMPORTANCE_LOW} for * notifications posted to this channel. Loading Loading @@ -516,7 +546,10 @@ public final class NotificationChannel implements Parcelable { public void writeXml(XmlSerializer out) throws IOException { out.startTag(null, TAG_CHANNEL); out.attribute(null, ATT_ID, getId()); if (getName() != null) { out.attribute(null, ATT_NAME, getName().toString()); } out.attribute(null, ATT_NAME_RES_ID, Integer.toString(getNameResId())); if (getImportance() != DEFAULT_IMPORTANCE) { out.attribute( null, ATT_IMPORTANCE, Integer.toString(getImportance())); Loading Loading @@ -574,6 +607,7 @@ public final class NotificationChannel implements Parcelable { JSONObject record = new JSONObject(); record.put(ATT_ID, getId()); record.put(ATT_NAME, getName()); record.put(ATT_NAME_RES_ID, getNameResId()); if (getImportance() != DEFAULT_IMPORTANCE) { record.put(ATT_IMPORTANCE, NotificationListenerService.Ranking.importanceToString(getImportance())); Loading Loading @@ -691,6 +725,7 @@ public final class NotificationChannel implements Parcelable { NotificationChannel that = (NotificationChannel) o; if (getNameResId() != that.getNameResId()) return false; if (getImportance() != that.getImportance()) return false; if (mBypassDnd != that.mBypassDnd) return false; if (getLockscreenVisibility() != that.getLockscreenVisibility()) return false; Loading Loading @@ -720,6 +755,7 @@ public final class NotificationChannel implements Parcelable { public int hashCode() { int result = getId() != null ? getId().hashCode() : 0; result = 31 * result + (getName() != null ? getName().hashCode() : 0); result = 31 * result + getNameResId(); result = 31 * result + getImportance(); result = 31 * result + (mBypassDnd ? 1 : 0); result = 31 * result + getLockscreenVisibility(); Loading @@ -741,6 +777,7 @@ public final class NotificationChannel implements Parcelable { return "NotificationChannel{" + "mId='" + mId + '\'' + ", mName=" + mName + ", mNameResId=" + mNameResId + ", mImportance=" + mImportance + ", mBypassDnd=" + mBypassDnd + ", mLockscreenVisibility=" + mLockscreenVisibility + Loading
core/java/com/android/internal/notification/SystemNotificationChannels.java +14 −14 Original line number Diff line number Diff line Loading @@ -48,12 +48,12 @@ public class SystemNotificationChannels { List<NotificationChannel> channelsList = new ArrayList<NotificationChannel>(); channelsList.add(new NotificationChannel( VIRTUAL_KEYBOARD, context.getString(R.string.notification_channel_virtual_keyboard), R.string.notification_channel_virtual_keyboard, NotificationManager.IMPORTANCE_LOW)); final NotificationChannel physicalKeyboardChannel = new NotificationChannel( PHYSICAL_KEYBOARD, context.getString(R.string.notification_channel_physical_keyboard), R.string.notification_channel_physical_keyboard, NotificationManager.IMPORTANCE_DEFAULT); physicalKeyboardChannel.setSound(Settings.System.DEFAULT_NOTIFICATION_URI, Notification.AUDIO_ATTRIBUTES_DEFAULT); Loading @@ -61,32 +61,32 @@ public class SystemNotificationChannels { channelsList.add(new NotificationChannel( SECURITY, context.getString(R.string.notification_channel_security), R.string.notification_channel_security, NotificationManager.IMPORTANCE_LOW)); channelsList.add(new NotificationChannel( CAR_MODE, context.getString(R.string.notification_channel_car_mode), R.string.notification_channel_car_mode, NotificationManager.IMPORTANCE_LOW)); channelsList.add(new NotificationChannel( DEVELOPER, context.getString(R.string.notification_channel_developer), R.string.notification_channel_developer, NotificationManager.IMPORTANCE_LOW)); channelsList.add(new NotificationChannel( UPDATES, context.getString(R.string.notification_channel_updates), R.string.notification_channel_updates, NotificationManager.IMPORTANCE_LOW)); channelsList.add(new NotificationChannel( NETWORK_STATUS, context.getString(R.string.notification_channel_network_status), R.string.notification_channel_network_status, NotificationManager.IMPORTANCE_LOW)); final NotificationChannel networkAlertsChannel = new NotificationChannel( NETWORK_ALERTS, context.getString(R.string.notification_channel_network_alerts), R.string.notification_channel_network_alerts, NotificationManager.IMPORTANCE_HIGH); networkAlertsChannel.setSound(Settings.System.DEFAULT_NOTIFICATION_URI, Notification.AUDIO_ATTRIBUTES_DEFAULT); Loading @@ -94,17 +94,17 @@ public class SystemNotificationChannels { channelsList.add(new NotificationChannel( VPN, context.getString(R.string.notification_channel_vpn), R.string.notification_channel_vpn, NotificationManager.IMPORTANCE_LOW)); channelsList.add(new NotificationChannel( DEVICE_ADMIN, context.getString(R.string.notification_channel_device_admin), R.string.notification_channel_device_admin, NotificationManager.IMPORTANCE_LOW)); final NotificationChannel alertsChannel = new NotificationChannel( ALERTS, context.getString(R.string.notification_channel_alerts), R.string.notification_channel_alerts, NotificationManager.IMPORTANCE_DEFAULT); alertsChannel.setSound(Settings.System.DEFAULT_NOTIFICATION_URI, Notification.AUDIO_ATTRIBUTES_DEFAULT); Loading @@ -112,12 +112,12 @@ public class SystemNotificationChannels { channelsList.add(new NotificationChannel( RETAIL_MODE, context.getString(R.string.notification_channel_retail_mode), R.string.notification_channel_retail_mode, NotificationManager.IMPORTANCE_LOW)); channelsList.add(new NotificationChannel( USB, context.getString(R.string.notification_channel_usb), R.string.notification_channel_usb, NotificationManager.IMPORTANCE_MIN)); nm.createNotificationChannels(channelsList); Loading @@ -128,7 +128,7 @@ public class SystemNotificationChannels { final NotificationManager nm = context.getSystemService(NotificationManager.class); nm.createNotificationChannelsForPackage(pkg, Arrays.asList(new NotificationChannel( ACCOUNT, context.getString(R.string.notification_channel_account), R.string.notification_channel_account, NotificationManager.IMPORTANCE_LOW))); } Loading