summaryrefslogtreecommitdiffstats
path: root/location
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 /location
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 'location')
-rw-r--r--location/java/com/android/internal/location/GpsNetInitiatedHandler.java30
1 files changed, 16 insertions, 14 deletions
diff --git a/location/java/com/android/internal/location/GpsNetInitiatedHandler.java b/location/java/com/android/internal/location/GpsNetInitiatedHandler.java
index 95b3eb3..260f380 100644
--- a/location/java/com/android/internal/location/GpsNetInitiatedHandler.java
+++ b/location/java/com/android/internal/location/GpsNetInitiatedHandler.java
@@ -172,7 +172,7 @@ public class GpsNetInitiatedHandler {
* <p>
* This is lazily created, so use {@link #setNINotification()}.
*/
- private Notification mNiNotification;
+ private Notification.Builder mNiNotificationBuilder;
public GpsNetInitiatedHandler(Context context,
INetInitiatedListener netInitiatedListener,
@@ -367,29 +367,31 @@ public class GpsNetInitiatedHandler {
", message: " + message);
// Construct Notification
- if (mNiNotification == null) {
- mNiNotification = new Notification();
- mNiNotification.icon = com.android.internal.R.drawable.stat_sys_gps_on; /* Change notification icon here */
- mNiNotification.when = 0;
+ if (mNiNotificationBuilder == null) {
+ mNiNotificationBuilder = new Notification.Builder(mContext)
+ .setSmallIcon(com.android.internal.R.drawable.stat_sys_gps_on)
+ .setWhen(0)
+ .setOngoing(true)
+ .setAutoCancel(true)
+ .setColor(mContext.getColor(
+ com.android.internal.R.color.system_notification_accent_color));
}
if (mPlaySounds) {
- mNiNotification.defaults |= Notification.DEFAULT_SOUND;
+ mNiNotificationBuilder.setDefaults(Notification.DEFAULT_SOUND);
} else {
- mNiNotification.defaults &= ~Notification.DEFAULT_SOUND;
+ mNiNotificationBuilder.setDefaults(0);
}
- mNiNotification.flags = Notification.FLAG_ONGOING_EVENT | Notification.FLAG_AUTO_CANCEL;
- mNiNotification.tickerText = getNotifTicker(notif, mContext);
-
// if not to popup dialog immediately, pending intent will open the dialog
Intent intent = !mPopupImmediately ? getDlgIntent(notif) : new Intent();
PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, intent, 0);
- mNiNotification.color = mContext.getColor(
- com.android.internal.R.color.system_notification_accent_color);
- mNiNotification.setLatestEventInfo(mContext, title, message, pi);
+ mNiNotificationBuilder.setTicker(getNotifTicker(notif, mContext))
+ .setContentTitle(title)
+ .setContentText(message)
+ .setContentIntent(pi);
- notificationManager.notifyAsUser(null, notif.notificationId, mNiNotification,
+ notificationManager.notifyAsUser(null, notif.notificationId, mNiNotificationBuilder.build(),
UserHandle.ALL);
}