Loading core/java/android/app/NotificationChannel.java +6 −6 Original line number Diff line number Diff line Loading @@ -15,11 +15,6 @@ */ package android.app; import org.json.JSONException; import org.json.JSONObject; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlSerializer; import android.annotation.SystemApi; import android.app.NotificationManager.Importance; import android.content.Intent; Loading @@ -31,6 +26,11 @@ import android.provider.Settings; import android.service.notification.NotificationListenerService; import android.text.TextUtils; import org.json.JSONException; import org.json.JSONObject; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlSerializer; import java.io.IOException; import java.util.Arrays; Loading Loading @@ -743,7 +743,7 @@ public final class NotificationChannel implements Parcelable { private static String longArrayToString(long[] values) { StringBuffer sb = new StringBuffer(); if (values != null) { if (values != null && values.length > 0) { for (int i = 0; i < values.length - 1; i++) { sb.append(values[i]).append(DELIMITER); } Loading services/tests/notification/src/com/android/server/notification/NotificationChannelTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -25,8 +25,14 @@ import android.os.Parcel; import android.support.test.runner.AndroidJUnit4; import android.test.suitebuilder.annotation.SmallTest; import com.android.internal.util.FastXmlSerializer; import org.junit.Test; import org.junit.runner.RunWith; import org.xmlpull.v1.XmlSerializer; import java.io.BufferedOutputStream; import java.io.ByteArrayOutputStream; @SmallTest @RunWith(AndroidJUnit4.class) Loading @@ -50,4 +56,15 @@ public class NotificationChannelTest extends NotificationTestCase { channel.setBlockableSystem(true); assertEquals(true, channel.isBlockableSystem()); } @Test public void testEmptyVibration_noException() throws Exception { NotificationChannel channel = new NotificationChannel("a", "ab", IMPORTANCE_DEFAULT); channel.setVibrationPattern(new long[0]); XmlSerializer serializer = new FastXmlSerializer(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); serializer.setOutput(new BufferedOutputStream(baos), "utf-8"); channel.writeXml(serializer); } } Loading
core/java/android/app/NotificationChannel.java +6 −6 Original line number Diff line number Diff line Loading @@ -15,11 +15,6 @@ */ package android.app; import org.json.JSONException; import org.json.JSONObject; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlSerializer; import android.annotation.SystemApi; import android.app.NotificationManager.Importance; import android.content.Intent; Loading @@ -31,6 +26,11 @@ import android.provider.Settings; import android.service.notification.NotificationListenerService; import android.text.TextUtils; import org.json.JSONException; import org.json.JSONObject; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlSerializer; import java.io.IOException; import java.util.Arrays; Loading Loading @@ -743,7 +743,7 @@ public final class NotificationChannel implements Parcelable { private static String longArrayToString(long[] values) { StringBuffer sb = new StringBuffer(); if (values != null) { if (values != null && values.length > 0) { for (int i = 0; i < values.length - 1; i++) { sb.append(values[i]).append(DELIMITER); } Loading
services/tests/notification/src/com/android/server/notification/NotificationChannelTest.java +17 −0 Original line number Diff line number Diff line Loading @@ -25,8 +25,14 @@ import android.os.Parcel; import android.support.test.runner.AndroidJUnit4; import android.test.suitebuilder.annotation.SmallTest; import com.android.internal.util.FastXmlSerializer; import org.junit.Test; import org.junit.runner.RunWith; import org.xmlpull.v1.XmlSerializer; import java.io.BufferedOutputStream; import java.io.ByteArrayOutputStream; @SmallTest @RunWith(AndroidJUnit4.class) Loading @@ -50,4 +56,15 @@ public class NotificationChannelTest extends NotificationTestCase { channel.setBlockableSystem(true); assertEquals(true, channel.isBlockableSystem()); } @Test public void testEmptyVibration_noException() throws Exception { NotificationChannel channel = new NotificationChannel("a", "ab", IMPORTANCE_DEFAULT); channel.setVibrationPattern(new long[0]); XmlSerializer serializer = new FastXmlSerializer(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); serializer.setOutput(new BufferedOutputStream(baos), "utf-8"); channel.writeXml(serializer); } }