remove usage of deprecated method setLatestEventInfo

Bug: 18510449
Change-Id: I56a77991c729990e501f402e007dfa79ee57621e
This commit is contained in:
Chris Wren
2015-06-11 10:19:43 -04:00
parent ddb3d3aacc
commit cb43350ffd

View File

@@ -3289,7 +3289,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
CharSequence title; CharSequence title;
CharSequence details; CharSequence details;
int icon; int icon;
Notification notification = new Notification();
if (notifyType == NotificationType.NO_INTERNET && if (notifyType == NotificationType.NO_INTERNET &&
networkType == ConnectivityManager.TYPE_WIFI) { networkType == ConnectivityManager.TYPE_WIFI) {
title = r.getString(R.string.wifi_no_internet, 0); title = r.getString(R.string.wifi_no_internet, 0);
@@ -3324,14 +3323,17 @@ public class ConnectivityService extends IConnectivityManager.Stub
return; return;
} }
notification.when = 0; Notification notification = new Notification.Builder(mContext)
notification.icon = icon; .setWhen(0)
notification.flags = Notification.FLAG_AUTO_CANCEL; .setSmallIcon(icon)
notification.tickerText = title; .setAutoCancel(true)
notification.color = mContext.getColor( .setTicker(title)
com.android.internal.R.color.system_notification_accent_color); .setColor(mContext.getColor(
notification.setLatestEventInfo(mContext, title, details, notification.contentIntent); com.android.internal.R.color.system_notification_accent_color))
notification.contentIntent = intent; .setContentTitle(title)
.setContentText(details)
.setContentIntent(intent)
.build();
try { try {
notificationManager.notify(NOTIFICATION_ID, id, notification); notificationManager.notify(NOTIFICATION_ID, id, notification);