diff options
author | Mike Lockwood <lockwood@android.com> | 2011-07-27 09:50:06 -0400 |
---|---|---|
committer | Mike Lockwood <lockwood@android.com> | 2011-07-27 09:56:06 -0400 |
commit | a5010431bfcdff88ac9d96e68d8308071c13472b (patch) | |
tree | 926949085a1bc7687883fef0b55fd44acb6c8167 /services/java/com/android/server/usb/UsbDeviceManager.java | |
parent | 83e32904eb0b65fa6d0c13f3d576a46031fefda0 (diff) | |
download | frameworks_base-a5010431bfcdff88ac9d96e68d8308071c13472b.zip frameworks_base-a5010431bfcdff88ac9d96e68d8308071c13472b.tar.gz frameworks_base-a5010431bfcdff88ac9d96e68d8308071c13472b.tar.bz2 |
UsbDeviceManager: Don't show USB notification for RNDIS
since USB tethering already has a notification.
Bug: 4988511
Change-Id: I928cb1e1d191c77340f7f05edfa80a74cdabe6ed
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'services/java/com/android/server/usb/UsbDeviceManager.java')
-rw-r--r-- | services/java/com/android/server/usb/UsbDeviceManager.java | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/services/java/com/android/server/usb/UsbDeviceManager.java b/services/java/com/android/server/usb/UsbDeviceManager.java index f183f83..11cb555 100644 --- a/services/java/com/android/server/usb/UsbDeviceManager.java +++ b/services/java/com/android/server/usb/UsbDeviceManager.java @@ -528,10 +528,10 @@ public class UsbDeviceManager { private void updateUsbNotification() { if (mNotificationManager == null || !mUseUsbNotification) return; + int id = NOTIFICATION_NONE; + Resources r = mContext.getResources(); + CharSequence title = null; if (mConnected) { - Resources r = mContext.getResources(); - CharSequence title = null; - int id = NOTIFICATION_NONE; if (containsFunction(mCurrentFunctions, UsbManager.USB_FUNCTION_MTP)) { title = r.getText( com.android.internal.R.string.usb_mtp_notification_title); @@ -550,16 +550,19 @@ public class UsbDeviceManager { com.android.internal.R.string.usb_accessory_notification_title); id = NOTIFICATION_ACCESSORY; } else { - Slog.e(TAG, "No known USB function in updateUsbNotification"); - } - if (id != mUsbNotificationId) { - // clear notification if title needs changing - if (mUsbNotificationId != NOTIFICATION_NONE) { - mNotificationManager.cancel(mUsbNotificationId); - mUsbNotificationId = NOTIFICATION_NONE; + // There is a different notification for USB tethering so we don't need one here + if (!containsFunction(mCurrentFunctions, UsbManager.USB_FUNCTION_RNDIS)) { + Slog.e(TAG, "No known USB function in updateUsbNotification"); } } - if (mUsbNotificationId == NOTIFICATION_NONE) { + } + if (id != mUsbNotificationId) { + // clear notification if title needs changing + if (mUsbNotificationId != NOTIFICATION_NONE) { + mNotificationManager.cancel(mUsbNotificationId); + mUsbNotificationId = NOTIFICATION_NONE; + } + if (id != NOTIFICATION_NONE) { CharSequence message = r.getText( com.android.internal.R.string.usb_notification_message); @@ -584,10 +587,6 @@ public class UsbDeviceManager { mNotificationManager.notify(id, notification); mUsbNotificationId = id; } - - } else if (mUsbNotificationId != NOTIFICATION_NONE) { - mNotificationManager.cancel(mUsbNotificationId); - mUsbNotificationId = NOTIFICATION_NONE; } } |