summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Geoffrey Pitsch <gpitsch@google.com> 2017-04-18 13:19:48 -0400
committer Daniel Sandler <dsandler@android.com> 2017-04-18 17:37:49 +0000
commit1d063a1b775389e5f11291fbf86765b1c026ea2c (patch)
tree52bb4e474312f1bf0d1c3409644cf2e12e6184f7
parent2ed861d560defda9d43081f2cb35f3112cce2092 (diff)
Don't let toasting throw a runtime exception.
Not sure why is complaining about the Looper. (The toast is debug code that will be removed for ship.) Change-Id: I5e2ecbe40687cd626b235e248fe6d12fea14204a Fixes: 37455183 Test: runtest systemui-notification
-rw-r--r--services/core/java/com/android/server/notification/NotificationManagerService.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index cc3948ed1a59..f6addc0d87e8 100644
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -3229,8 +3229,12 @@ public class NotificationManagerService extends SystemService {
private void doDebugOnlyToast(CharSequence toastText) {
if (Build.IS_DEBUGGABLE) {
- Toast toast = Toast.makeText(getContext(), toastText, Toast.LENGTH_LONG);
- toast.show();
+ try {
+ Toast toast = Toast.makeText(getContext(), toastText, Toast.LENGTH_LONG);
+ toast.show();
+ } catch (RuntimeException e) {
+ Slog.w(TAG, "Unable to toast with text: " + toastText, e);
+ }
}
}