From 6d8e413a63c6ab054557f81d53bb8b35f0816679 Mon Sep 17 00:00:00 2001 From: Chris Wren Date: Fri, 12 Jun 2015 17:09:08 -0400 Subject: remove setLatestEventInfo from USB Bug: 18510449 Change-Id: I6b9ccaa0537c8044c5fa900ae4ea68b2676e1365 --- .../com/android/server/usb/UsbDeviceManager.java | 58 +++++++++++----------- 1 file changed, 30 insertions(+), 28 deletions(-) (limited to 'services/usb') diff --git a/services/usb/java/com/android/server/usb/UsbDeviceManager.java b/services/usb/java/com/android/server/usb/UsbDeviceManager.java index 588f8c6..f082be0 100644 --- a/services/usb/java/com/android/server/usb/UsbDeviceManager.java +++ b/services/usb/java/com/android/server/usb/UsbDeviceManager.java @@ -727,25 +727,26 @@ public class UsbDeviceManager { com.android.internal.R.string.usb_notification_message); CharSequence title = r.getText(id); - Notification notification = new Notification(); - notification.icon = com.android.internal.R.drawable.stat_sys_data_usb; - notification.when = 0; - notification.flags = Notification.FLAG_ONGOING_EVENT; - notification.tickerText = title; - notification.defaults = 0; // please be quiet - notification.sound = null; - notification.vibrate = null; - notification.priority = Notification.PRIORITY_MIN; - Intent intent = Intent.makeRestartActivityTask( new ComponentName("com.android.settings", "com.android.settings.deviceinfo.UsbModeChooserActivity")); PendingIntent pi = PendingIntent.getActivityAsUser(mContext, 0, intent, 0, null, UserHandle.CURRENT); - notification.color = mContext.getColor( - com.android.internal.R.color.system_notification_accent_color); - notification.setLatestEventInfo(mContext, title, message, pi); - notification.visibility = Notification.VISIBILITY_PUBLIC; + + Notification notification = new Notification.Builder(mContext) + .setSmallIcon(com.android.internal.R.drawable.stat_sys_adb) + .setWhen(0) + .setOngoing(true) + .setTicker(title) + .setDefaults(0) // please be quiet + .setPriority(Notification.PRIORITY_MIN) + .setColor(mContext.getColor( + com.android.internal.R.color.system_notification_accent_color)) + .setContentTitle(title) + .setContentText(message) + .setContentIntent(pi) + .setVisibility(Notification.VISIBILITY_PUBLIC) + .build(); mNotificationManager.notifyAsUser(null, id, notification, UserHandle.ALL); mUsbNotificationId = id; @@ -765,25 +766,26 @@ public class UsbDeviceManager { CharSequence message = r.getText( com.android.internal.R.string.adb_active_notification_message); - Notification notification = new Notification(); - notification.icon = com.android.internal.R.drawable.stat_sys_adb; - notification.when = 0; - notification.flags = Notification.FLAG_ONGOING_EVENT; - notification.tickerText = title; - notification.defaults = 0; // please be quiet - notification.sound = null; - notification.vibrate = null; - notification.priority = Notification.PRIORITY_LOW; - Intent intent = Intent.makeRestartActivityTask( new ComponentName("com.android.settings", "com.android.settings.DevelopmentSettings")); PendingIntent pi = PendingIntent.getActivityAsUser(mContext, 0, intent, 0, null, UserHandle.CURRENT); - notification.color = mContext.getColor( - com.android.internal.R.color.system_notification_accent_color); - notification.setLatestEventInfo(mContext, title, message, pi); - notification.visibility = Notification.VISIBILITY_PUBLIC; + + Notification notification = new Notification.Builder(mContext) + .setSmallIcon(com.android.internal.R.drawable.stat_sys_adb) + .setWhen(0) + .setOngoing(true) + .setTicker(title) + .setDefaults(0) // please be quiet + .setPriority(Notification.PRIORITY_LOW) + .setColor(mContext.getColor( + com.android.internal.R.color.system_notification_accent_color)) + .setContentTitle(title) + .setContentText(message) + .setContentIntent(pi) + .setVisibility(Notification.VISIBILITY_PUBLIC) + .build(); mAdbNotificationShown = true; mNotificationManager.notifyAsUser(null, id, notification, UserHandle.ALL); -- cgit v1.1