diff options
author | Chris Wren <cwren@android.com> | 2015-06-12 17:09:08 -0400 |
---|---|---|
committer | Chris Wren <cwren@android.com> | 2015-06-12 17:10:01 -0400 |
commit | 6d8e413a63c6ab054557f81d53bb8b35f0816679 (patch) | |
tree | a3d5d3871c6027d4c379ccd120ff552b99b8fe49 /services/usb | |
parent | bc9b1024535a21ce8d73fa1ca7deb86ea4d1338b (diff) | |
download | frameworks_base-6d8e413a63c6ab054557f81d53bb8b35f0816679.zip frameworks_base-6d8e413a63c6ab054557f81d53bb8b35f0816679.tar.gz frameworks_base-6d8e413a63c6ab054557f81d53bb8b35f0816679.tar.bz2 |
remove setLatestEventInfo from USB
Bug: 18510449
Change-Id: I6b9ccaa0537c8044c5fa900ae4ea68b2676e1365
Diffstat (limited to 'services/usb')
-rw-r--r-- | services/usb/java/com/android/server/usb/UsbDeviceManager.java | 58 |
1 files changed, 30 insertions, 28 deletions
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); |