Loading api/current.txt +3 −1 Original line number Diff line number Diff line Loading @@ -5471,11 +5471,13 @@ package android.app { method public boolean canBypassDnd(); method public boolean canShowBadge(); method public int describeContents(); method public void enableLights(boolean); method public void enableVibration(boolean); method public android.media.AudioAttributes getAudioAttributes(); method public java.lang.String getGroup(); method public java.lang.String getId(); method public int getImportance(); method public int getLightColor(); method public int getLockscreenVisibility(); method public java.lang.CharSequence getName(); method public android.net.Uri getSound(); Loading @@ -5483,7 +5485,7 @@ package android.app { method public void setBypassDnd(boolean); method public void setGroup(java.lang.String); method public void setImportance(int); method public void setLights(boolean); method public void setLightColor(int); method public void setLockscreenVisibility(int); method public void setShowBadge(boolean); method public void setSound(android.net.Uri, android.media.AudioAttributes); api/system-current.txt +3 −1 Original line number Diff line number Diff line Loading @@ -5647,11 +5647,13 @@ package android.app { method public boolean canBypassDnd(); method public boolean canShowBadge(); method public int describeContents(); method public void enableLights(boolean); method public void enableVibration(boolean); method public android.media.AudioAttributes getAudioAttributes(); method public java.lang.String getGroup(); method public java.lang.String getId(); method public int getImportance(); method public int getLightColor(); method public int getLockscreenVisibility(); method public java.lang.CharSequence getName(); method public android.net.Uri getSound(); Loading @@ -5664,7 +5666,7 @@ package android.app { method public void setDeleted(boolean); method public void setGroup(java.lang.String); method public void setImportance(int); method public void setLights(boolean); method public void setLightColor(int); method public void setLockscreenVisibility(int); method public void setShowBadge(boolean); method public void setSound(android.net.Uri, android.media.AudioAttributes); api/test-current.txt +3 −1 Original line number Diff line number Diff line Loading @@ -5481,11 +5481,13 @@ package android.app { method public boolean canBypassDnd(); method public boolean canShowBadge(); method public int describeContents(); method public void enableLights(boolean); method public void enableVibration(boolean); method public android.media.AudioAttributes getAudioAttributes(); method public java.lang.String getGroup(); method public java.lang.String getId(); method public int getImportance(); method public int getLightColor(); method public int getLockscreenVisibility(); method public java.lang.CharSequence getName(); method public android.net.Uri getSound(); Loading @@ -5493,7 +5495,7 @@ package android.app { method public void setBypassDnd(boolean); method public void setGroup(java.lang.String); method public void setImportance(int); method public void setLights(boolean); method public void setLightColor(int); method public void setLockscreenVisibility(int); method public void setShowBadge(boolean); method public void setSound(android.net.Uri, android.media.AudioAttributes); core/java/android/app/Notification.java +2 −3 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ import android.os.Parcelable; import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserHandle; import android.service.notification.StatusBarNotification; import android.text.BidiFormatter; import android.text.SpannableStringBuilder; import android.text.Spanned; Loading Loading @@ -3128,7 +3127,7 @@ public class Notification implements Parcelable * Not all devices will honor all (or even any) of these values. * * @deprecated use {@link NotificationChannel#setLights(boolean)} instead. * @deprecated use {@link NotificationChannel#enableLights(boolean)} instead. * @see Notification#ledARGB * @see Notification#ledOnMS * @see Notification#ledOffMS Loading Loading @@ -3227,7 +3226,7 @@ public class Notification implements Parcelable * For all default values, use {@link #DEFAULT_ALL}. * * @deprecated use {@link NotificationChannel#enableVibration(boolean)} and * {@link NotificationChannel#setLights(boolean)} and * {@link NotificationChannel#enableLights(boolean)} and * {@link NotificationChannel#setSound(Uri, AudioAttributes)} instead. */ @Deprecated Loading core/java/android/app/NotificationChannel.java +34 −5 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlSerializer; import android.annotation.SystemApi; import android.app.NotificationManager; import android.graphics.Color; import android.media.AudioAttributes; import android.net.Uri; import android.os.Parcel; Loading Loading @@ -51,7 +51,6 @@ public final class NotificationChannel implements Parcelable { private static final String ATT_VISIBILITY = "visibility"; private static final String ATT_IMPORTANCE = "importance"; private static final String ATT_LIGHTS = "lights"; //TODO: add support for light colors private static final String ATT_LIGHT_COLOR = "light_color"; private static final String ATT_VIBRATION = "vibration"; private static final String ATT_VIBRATION_ENABLED = "vibration_enabled"; Loading Loading @@ -129,7 +128,7 @@ public final class NotificationChannel implements Parcelable { USER_LOCKED_AUDIO_ATTRIBUTES }; private static final int DEFAULT_LIGHT_COLOR = 0; private static final int DEFAULT_VISIBILITY = NotificationManager.VISIBILITY_NO_OVERRIDE; private static final int DEFAULT_IMPORTANCE = Loading @@ -144,6 +143,7 @@ public final class NotificationChannel implements Parcelable { private int mLockscreenVisibility = DEFAULT_VISIBILITY; private Uri mSound; private boolean mLights; private int mLightColor = DEFAULT_LIGHT_COLOR; private long[] mVibration; private int mUserLockedFields; private boolean mVibrationEnabled; Loading Loading @@ -194,6 +194,7 @@ public final class NotificationChannel implements Parcelable { mGroup = null; } mAudioAttributes = in.readInt() > 0 ? AudioAttributes.CREATOR.createFromParcel(in) : null; mLightColor = in.readInt(); } @Override Loading Loading @@ -232,6 +233,7 @@ public final class NotificationChannel implements Parcelable { } else { dest.writeInt(0); } dest.writeInt(mLightColor); } /** Loading Loading @@ -331,10 +333,21 @@ public final class NotificationChannel implements Parcelable { * Only modifiable before the channel is submitted to * {@link NotificationManager#notify(String, int, Notification)}. */ public void setLights(boolean lights) { public void enableLights(boolean lights) { this.mLights = lights; } /** * Sets the notification light color for notifications posted to this channel, if lights are * {@link #enableLights(boolean) enabled} on this channel and the device supports that feature. * * Only modifiable before the channel is submitted to * {@link NotificationManager#notify(String, int, Notification)}. */ public void setLightColor(int argb) { this.mLightColor = argb; } /** * Sets whether notification posted to this channel should vibrate. The vibration pattern can * be set with {@link #setVibrationPattern(long[])}. Loading Loading @@ -410,6 +423,14 @@ public final class NotificationChannel implements Parcelable { return mLights; } /** * Returns the notification light color for notifications posted to this channel. Irrelevant * unless {@link #shouldShowLights()}. */ public int getLightColor() { return mLightColor; } /** * Returns whether notifications posted to this channel always vibrate. */ Loading Loading @@ -478,7 +499,8 @@ public final class NotificationChannel implements Parcelable { != safeInt(parser, ATT_PRIORITY, Notification.PRIORITY_DEFAULT)); setLockscreenVisibility(safeInt(parser, ATT_VISIBILITY, DEFAULT_VISIBILITY)); setSound(safeUri(parser, ATT_SOUND), safeAudioAttributes(parser)); setLights(safeBool(parser, ATT_LIGHTS, false)); enableLights(safeBool(parser, ATT_LIGHTS, false)); setLightColor(safeInt(parser, ATT_LIGHT_COLOR, DEFAULT_LIGHT_COLOR)); enableVibration(safeBool(parser, ATT_VIBRATION_ENABLED, false)); setVibrationPattern(safeLongArray(parser, ATT_VIBRATION, null)); setShowBadge(safeBool(parser, ATT_SHOW_BADGE, false)); Loading Loading @@ -519,6 +541,9 @@ public final class NotificationChannel implements Parcelable { if (shouldShowLights()) { out.attribute(null, ATT_LIGHTS, Boolean.toString(shouldShowLights())); } if (getLightColor() != DEFAULT_LIGHT_COLOR) { out.attribute(null, ATT_LIGHT_COLOR, Integer.toString(getLightColor())); } if (shouldVibrate()) { out.attribute(null, ATT_VIBRATION_ENABLED, Boolean.toString(shouldVibrate())); } Loading Loading @@ -569,6 +594,7 @@ public final class NotificationChannel implements Parcelable { record.put(ATT_FLAGS, Integer.toString(getAudioAttributes().getFlags())); } record.put(ATT_LIGHTS, Boolean.toString(shouldShowLights())); record.put(ATT_LIGHT_COLOR, Integer.toString(getLightColor())); record.put(ATT_VIBRATION_ENABLED, Boolean.toString(shouldVibrate())); record.put(ATT_USER_LOCKED, Integer.toString(getUserLockedFields())); record.put(ATT_VIBRATION, longArrayToString(getVibrationPattern())); Loading Loading @@ -669,6 +695,7 @@ public final class NotificationChannel implements Parcelable { if (mBypassDnd != that.mBypassDnd) return false; if (getLockscreenVisibility() != that.getLockscreenVisibility()) return false; if (mLights != that.mLights) return false; if (getLightColor() != that.getLightColor()) return false; if (getUserLockedFields() != that.getUserLockedFields()) return false; if (mVibrationEnabled != that.mVibrationEnabled) return false; if (mShowBadge != that.mShowBadge) return false; Loading Loading @@ -698,6 +725,7 @@ public final class NotificationChannel implements Parcelable { result = 31 * result + getLockscreenVisibility(); result = 31 * result + (getSound() != null ? getSound().hashCode() : 0); result = 31 * result + (mLights ? 1 : 0); result = 31 * result + getLightColor(); result = 31 * result + Arrays.hashCode(mVibration); result = 31 * result + getUserLockedFields(); result = 31 * result + (mVibrationEnabled ? 1 : 0); Loading @@ -718,6 +746,7 @@ public final class NotificationChannel implements Parcelable { ", mLockscreenVisibility=" + mLockscreenVisibility + ", mSound=" + mSound + ", mLights=" + mLights + ", mLightColor=" + mLightColor + ", mVibration=" + Arrays.toString(mVibration) + ", mUserLockedFields=" + mUserLockedFields + ", mVibrationEnabled=" + mVibrationEnabled + Loading Loading
api/current.txt +3 −1 Original line number Diff line number Diff line Loading @@ -5471,11 +5471,13 @@ package android.app { method public boolean canBypassDnd(); method public boolean canShowBadge(); method public int describeContents(); method public void enableLights(boolean); method public void enableVibration(boolean); method public android.media.AudioAttributes getAudioAttributes(); method public java.lang.String getGroup(); method public java.lang.String getId(); method public int getImportance(); method public int getLightColor(); method public int getLockscreenVisibility(); method public java.lang.CharSequence getName(); method public android.net.Uri getSound(); Loading @@ -5483,7 +5485,7 @@ package android.app { method public void setBypassDnd(boolean); method public void setGroup(java.lang.String); method public void setImportance(int); method public void setLights(boolean); method public void setLightColor(int); method public void setLockscreenVisibility(int); method public void setShowBadge(boolean); method public void setSound(android.net.Uri, android.media.AudioAttributes);
api/system-current.txt +3 −1 Original line number Diff line number Diff line Loading @@ -5647,11 +5647,13 @@ package android.app { method public boolean canBypassDnd(); method public boolean canShowBadge(); method public int describeContents(); method public void enableLights(boolean); method public void enableVibration(boolean); method public android.media.AudioAttributes getAudioAttributes(); method public java.lang.String getGroup(); method public java.lang.String getId(); method public int getImportance(); method public int getLightColor(); method public int getLockscreenVisibility(); method public java.lang.CharSequence getName(); method public android.net.Uri getSound(); Loading @@ -5664,7 +5666,7 @@ package android.app { method public void setDeleted(boolean); method public void setGroup(java.lang.String); method public void setImportance(int); method public void setLights(boolean); method public void setLightColor(int); method public void setLockscreenVisibility(int); method public void setShowBadge(boolean); method public void setSound(android.net.Uri, android.media.AudioAttributes);
api/test-current.txt +3 −1 Original line number Diff line number Diff line Loading @@ -5481,11 +5481,13 @@ package android.app { method public boolean canBypassDnd(); method public boolean canShowBadge(); method public int describeContents(); method public void enableLights(boolean); method public void enableVibration(boolean); method public android.media.AudioAttributes getAudioAttributes(); method public java.lang.String getGroup(); method public java.lang.String getId(); method public int getImportance(); method public int getLightColor(); method public int getLockscreenVisibility(); method public java.lang.CharSequence getName(); method public android.net.Uri getSound(); Loading @@ -5493,7 +5495,7 @@ package android.app { method public void setBypassDnd(boolean); method public void setGroup(java.lang.String); method public void setImportance(int); method public void setLights(boolean); method public void setLightColor(int); method public void setLockscreenVisibility(int); method public void setShowBadge(boolean); method public void setSound(android.net.Uri, android.media.AudioAttributes);
core/java/android/app/Notification.java +2 −3 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ import android.os.Parcelable; import android.os.SystemClock; import android.os.SystemProperties; import android.os.UserHandle; import android.service.notification.StatusBarNotification; import android.text.BidiFormatter; import android.text.SpannableStringBuilder; import android.text.Spanned; Loading Loading @@ -3128,7 +3127,7 @@ public class Notification implements Parcelable * Not all devices will honor all (or even any) of these values. * * @deprecated use {@link NotificationChannel#setLights(boolean)} instead. * @deprecated use {@link NotificationChannel#enableLights(boolean)} instead. * @see Notification#ledARGB * @see Notification#ledOnMS * @see Notification#ledOffMS Loading Loading @@ -3227,7 +3226,7 @@ public class Notification implements Parcelable * For all default values, use {@link #DEFAULT_ALL}. * * @deprecated use {@link NotificationChannel#enableVibration(boolean)} and * {@link NotificationChannel#setLights(boolean)} and * {@link NotificationChannel#enableLights(boolean)} and * {@link NotificationChannel#setSound(Uri, AudioAttributes)} instead. */ @Deprecated Loading
core/java/android/app/NotificationChannel.java +34 −5 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlSerializer; import android.annotation.SystemApi; import android.app.NotificationManager; import android.graphics.Color; import android.media.AudioAttributes; import android.net.Uri; import android.os.Parcel; Loading Loading @@ -51,7 +51,6 @@ public final class NotificationChannel implements Parcelable { private static final String ATT_VISIBILITY = "visibility"; private static final String ATT_IMPORTANCE = "importance"; private static final String ATT_LIGHTS = "lights"; //TODO: add support for light colors private static final String ATT_LIGHT_COLOR = "light_color"; private static final String ATT_VIBRATION = "vibration"; private static final String ATT_VIBRATION_ENABLED = "vibration_enabled"; Loading Loading @@ -129,7 +128,7 @@ public final class NotificationChannel implements Parcelable { USER_LOCKED_AUDIO_ATTRIBUTES }; private static final int DEFAULT_LIGHT_COLOR = 0; private static final int DEFAULT_VISIBILITY = NotificationManager.VISIBILITY_NO_OVERRIDE; private static final int DEFAULT_IMPORTANCE = Loading @@ -144,6 +143,7 @@ public final class NotificationChannel implements Parcelable { private int mLockscreenVisibility = DEFAULT_VISIBILITY; private Uri mSound; private boolean mLights; private int mLightColor = DEFAULT_LIGHT_COLOR; private long[] mVibration; private int mUserLockedFields; private boolean mVibrationEnabled; Loading Loading @@ -194,6 +194,7 @@ public final class NotificationChannel implements Parcelable { mGroup = null; } mAudioAttributes = in.readInt() > 0 ? AudioAttributes.CREATOR.createFromParcel(in) : null; mLightColor = in.readInt(); } @Override Loading Loading @@ -232,6 +233,7 @@ public final class NotificationChannel implements Parcelable { } else { dest.writeInt(0); } dest.writeInt(mLightColor); } /** Loading Loading @@ -331,10 +333,21 @@ public final class NotificationChannel implements Parcelable { * Only modifiable before the channel is submitted to * {@link NotificationManager#notify(String, int, Notification)}. */ public void setLights(boolean lights) { public void enableLights(boolean lights) { this.mLights = lights; } /** * Sets the notification light color for notifications posted to this channel, if lights are * {@link #enableLights(boolean) enabled} on this channel and the device supports that feature. * * Only modifiable before the channel is submitted to * {@link NotificationManager#notify(String, int, Notification)}. */ public void setLightColor(int argb) { this.mLightColor = argb; } /** * Sets whether notification posted to this channel should vibrate. The vibration pattern can * be set with {@link #setVibrationPattern(long[])}. Loading Loading @@ -410,6 +423,14 @@ public final class NotificationChannel implements Parcelable { return mLights; } /** * Returns the notification light color for notifications posted to this channel. Irrelevant * unless {@link #shouldShowLights()}. */ public int getLightColor() { return mLightColor; } /** * Returns whether notifications posted to this channel always vibrate. */ Loading Loading @@ -478,7 +499,8 @@ public final class NotificationChannel implements Parcelable { != safeInt(parser, ATT_PRIORITY, Notification.PRIORITY_DEFAULT)); setLockscreenVisibility(safeInt(parser, ATT_VISIBILITY, DEFAULT_VISIBILITY)); setSound(safeUri(parser, ATT_SOUND), safeAudioAttributes(parser)); setLights(safeBool(parser, ATT_LIGHTS, false)); enableLights(safeBool(parser, ATT_LIGHTS, false)); setLightColor(safeInt(parser, ATT_LIGHT_COLOR, DEFAULT_LIGHT_COLOR)); enableVibration(safeBool(parser, ATT_VIBRATION_ENABLED, false)); setVibrationPattern(safeLongArray(parser, ATT_VIBRATION, null)); setShowBadge(safeBool(parser, ATT_SHOW_BADGE, false)); Loading Loading @@ -519,6 +541,9 @@ public final class NotificationChannel implements Parcelable { if (shouldShowLights()) { out.attribute(null, ATT_LIGHTS, Boolean.toString(shouldShowLights())); } if (getLightColor() != DEFAULT_LIGHT_COLOR) { out.attribute(null, ATT_LIGHT_COLOR, Integer.toString(getLightColor())); } if (shouldVibrate()) { out.attribute(null, ATT_VIBRATION_ENABLED, Boolean.toString(shouldVibrate())); } Loading Loading @@ -569,6 +594,7 @@ public final class NotificationChannel implements Parcelable { record.put(ATT_FLAGS, Integer.toString(getAudioAttributes().getFlags())); } record.put(ATT_LIGHTS, Boolean.toString(shouldShowLights())); record.put(ATT_LIGHT_COLOR, Integer.toString(getLightColor())); record.put(ATT_VIBRATION_ENABLED, Boolean.toString(shouldVibrate())); record.put(ATT_USER_LOCKED, Integer.toString(getUserLockedFields())); record.put(ATT_VIBRATION, longArrayToString(getVibrationPattern())); Loading Loading @@ -669,6 +695,7 @@ public final class NotificationChannel implements Parcelable { if (mBypassDnd != that.mBypassDnd) return false; if (getLockscreenVisibility() != that.getLockscreenVisibility()) return false; if (mLights != that.mLights) return false; if (getLightColor() != that.getLightColor()) return false; if (getUserLockedFields() != that.getUserLockedFields()) return false; if (mVibrationEnabled != that.mVibrationEnabled) return false; if (mShowBadge != that.mShowBadge) return false; Loading Loading @@ -698,6 +725,7 @@ public final class NotificationChannel implements Parcelable { result = 31 * result + getLockscreenVisibility(); result = 31 * result + (getSound() != null ? getSound().hashCode() : 0); result = 31 * result + (mLights ? 1 : 0); result = 31 * result + getLightColor(); result = 31 * result + Arrays.hashCode(mVibration); result = 31 * result + getUserLockedFields(); result = 31 * result + (mVibrationEnabled ? 1 : 0); Loading @@ -718,6 +746,7 @@ public final class NotificationChannel implements Parcelable { ", mLockscreenVisibility=" + mLockscreenVisibility + ", mSound=" + mSound + ", mLights=" + mLights + ", mLightColor=" + mLightColor + ", mVibration=" + Arrays.toString(mVibration) + ", mUserLockedFields=" + mUserLockedFields + ", mVibrationEnabled=" + mVibrationEnabled + Loading