Merge "Don't let toasting throw a runtime exception." into oc-dev

This commit is contained in:
Geoffrey Pitsch
2017-04-18 17:41:50 +00:00
committed by Android (Google) Code Review

View File

@@ -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);
}
}
}