diff options
author | Chris Wren <cwren@android.com> | 2015-06-15 12:23:23 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-15 12:23:26 +0000 |
commit | b3c8564314a4ce05b722e33409f2c15bcdac6666 (patch) | |
tree | ff1a9c97fda37d9ca8668fe905a8f55f4998f11f /services/usb | |
parent | 0463cad783e78381f390855d1cc9d7d8d803b634 (diff) | |
parent | 6d8e413a63c6ab054557f81d53bb8b35f0816679 (diff) | |
download | frameworks_base-b3c8564314a4ce05b722e33409f2c15bcdac6666.zip frameworks_base-b3c8564314a4ce05b722e33409f2c15bcdac6666.tar.gz frameworks_base-b3c8564314a4ce05b722e33409f2c15bcdac6666.tar.bz2 |
Merge "remove setLatestEventInfo from USB" into mnc-dev
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 3d610b2..934ff52 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); |