summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2015-06-11 10:19:43 -0400
committerChris Wren <cwren@android.com>2015-06-12 10:16:04 -0400
commit1ce4b6d3c6cb5b2eb9c9d00472be12245db92427 (patch)
treed8c7d63276de0a8609ff5bb2422a2e55bad1562a /core
parent08f247fe2e073a5ec62dc0469d83f514aab31c42 (diff)
downloadframeworks_base-1ce4b6d3c6cb5b2eb9c9d00472be12245db92427.zip
frameworks_base-1ce4b6d3c6cb5b2eb9c9d00472be12245db92427.tar.gz
frameworks_base-1ce4b6d3c6cb5b2eb9c9d00472be12245db92427.tar.bz2
remove usage of deprecated method setLatestEventInfo
Bug: 18510449 Change-Id: I56a77991c729990e501f402e007dfa79ee57621e
Diffstat (limited to 'core')
-rw-r--r--core/java/android/app/Notification.java13
-rw-r--r--core/tests/notificationtests/src/android/app/NotificationStressTest.java13
2 files changed, 17 insertions, 9 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 96c6878..33a47b2 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -1331,11 +1331,14 @@ public class Notification implements Parcelable
public Notification(Context context, int icon, CharSequence tickerText, long when,
CharSequence contentTitle, CharSequence contentText, Intent contentIntent)
{
- this.when = when;
- this.icon = icon;
- this.tickerText = tickerText;
- setLatestEventInfo(context, contentTitle, contentText,
- PendingIntent.getActivity(context, 0, contentIntent, 0));
+ new Builder(context)
+ .setWhen(when)
+ .setSmallIcon(icon)
+ .setTicker(tickerText)
+ .setContentTitle(contentTitle)
+ .setContentText(contentText)
+ .setContentIntent(PendingIntent.getActivity(context, 0, contentIntent, 0))
+ .buildInto(this);
}
/**
diff --git a/core/tests/notificationtests/src/android/app/NotificationStressTest.java b/core/tests/notificationtests/src/android/app/NotificationStressTest.java
index 52ea1c4..4cb617e 100644
--- a/core/tests/notificationtests/src/android/app/NotificationStressTest.java
+++ b/core/tests/notificationtests/src/android/app/NotificationStressTest.java
@@ -77,15 +77,20 @@ public class NotificationStressTest extends InstrumentationTestCase {
}
private void sendNotification(int id, CharSequence text) {
- // Create "typical" notification with random icon
- Notification notification = new Notification(ICONS[mRandom.nextInt(ICONS.length)], text,
- System.currentTimeMillis());
// Fill in arbitrary content
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
CharSequence title = text + " " + id;
CharSequence subtitle = String.valueOf(System.currentTimeMillis());
- notification.setLatestEventInfo(mContext, title, subtitle, pendingIntent);
+ // Create "typical" notification with random icon
+ Notification notification = new Notification.Builder(mContext)
+ .setSmallIcon(ICONS[mRandom.nextInt(ICONS.length)])
+ .setTicker(text)
+ .setWhen(System.currentTimeMillis())
+ .setContentTitle(title)
+ .setContentText(subtitle)
+ .setContentIntent(pendingIntent)
+ .build();
mNotificationManager.notify(id, notification);
SystemClock.sleep(10);
}