diff options
| author | 2023-08-25 00:09:49 +0000 | |
|---|---|---|
| committer | 2023-08-25 00:09:49 +0000 | |
| commit | e2d9193486dc0907f52492bbf910fde817c7644e (patch) | |
| tree | 54c84ae18d451fbce7480a99c6377fe9b1963716 | |
| parent | 92cc6761d7626cb3275257b261feeb8e0076b72f (diff) | |
| parent | 8250368811d60c296da6ff1074ee74734e8efca7 (diff) | |
Merge "Fix crash when attempting to show toast on recently removed display." into main
| -rw-r--r-- | core/java/android/widget/ToastPresenter.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/java/android/widget/ToastPresenter.java b/core/java/android/widget/ToastPresenter.java index 7cb61fe597db..89271b5cc51f 100644 --- a/core/java/android/widget/ToastPresenter.java +++ b/core/java/android/widget/ToastPresenter.java @@ -342,7 +342,10 @@ public class ToastPresenter { // to cancel the toast there is an inherent race and we may attempt to add a window // after the token has been invalidated. Let us hedge against that. Log.w(TAG, "Error while attempting to show toast from " + mPackageName, e); - return; + } catch (WindowManager.InvalidDisplayException e) { + // Display the toast was scheduled on might have been meanwhile removed. + Log.w(TAG, "Cannot show toast from " + mPackageName + + " on display it was scheduled on.", e); } } } |