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
(cherry picked from commit 1d063a1b775389e5f11291fbf86765b1c026ea2c)
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index cc3948e..f6addc0 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 @@
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);
+ }
}
}