[Android] Catch IllegalArgumentException for notification
Geoffrey Métais
git at videolan.org
Wed May 4 13:10:30 CEST 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed May 4 13:09:19 2016 +0200| [7304ff2d8d4eb8aee775f68316cc211fc41a014d] | committer: Geoffrey Métais
Catch IllegalArgumentException for notification
Because some firmwares are just too crappy
> https://code.videolan.org/videolan/vlc-android/commit/7304ff2d8d4eb8aee775f68316cc211fc41a014d
---
vlc-android/src/org/videolan/vlc/PlaybackService.java | 8 +++-----
vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java | 4 +++-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 87375da..bfb21c0 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -916,11 +916,9 @@ public class PlaybackService extends Service implements IVLCVout.Callback {
stopForeground(false);
NotificationManagerCompat.from(this).notify(3, notification);
}
- }
- catch (NoSuchMethodError e){
- // Compat library is wrong on 3.2
- // http://code.google.com/p/android/issues/detail?id=36359
- // http://code.google.com/p/android/issues/detail?id=36502
+ } catch (IllegalArgumentException e){
+ // On somme crappy firmwares, shit can happen
+ Log.e(TAG, "Failed to display notification", e);
}
}
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java b/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
index 5a29cd5..df5ddd6 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
@@ -297,7 +297,9 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
builder.addAction(R.drawable.ic_popup_expand_w, mService.getString(R.string.popup_expand), piExpand);
Notification notification = builder.build();
- NotificationManagerCompat.from(mService).notify(42, notification);
+ try {
+ NotificationManagerCompat.from(mService).notify(42, notification);
+ } catch (IllegalArgumentException e) {}
}
private void hideNotification() {
More information about the Android
mailing list