Block adding toast windows to non-empty tokens.

When adding a window of TYPE_TOAST, if addToastWindowRequiresToken is enabled, prevent the addition if the provided WindowToken is not empty. This enforces the constraint that a WindowToken for toasts should only contain a single toast window.

Bug: 389950114
Flag: EXEMPT BUGFIX
Test: atest WindowManagerServiceTests
(cherry picked from commit 352e98e9ed8ab9a0c63a499665b09d2ab2769f7e)
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:3f2374710e901570dd42f9a43643a07ac8744005
Merged-In: I9f693bb0a28a08d53ad162c1e305e17170185680
Change-Id: I9f693bb0a28a08d53ad162c1e305e17170185680
2 files changed