Upstream allowing multiple toasts for focused app

Test:The topic contains CTS tests that pass

Change-Id: I60515845f7c9be23887764bb1c59bf2b3301adc8
This commit is contained in:
Svet Ganov
2017-01-21 17:40:40 -08:00
committed by Svetoslav Ganov
parent 8e737ef842
commit daca8ee6a5

View File

@@ -1488,6 +1488,13 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
boolean canAddToastWindowForUid(int uid) {
// We allow one toast window per UID being shown at a time.
// Also if the app is focused adding more than one toast at
// a time for better backwards compatibility.
final WindowState focusedWindowForUid = getWindow(w ->
w.mOwnerUid == uid && w.isFocused());
if (focusedWindowForUid != null) {
return true;
}
final WindowState win = getWindow(w ->
w.mAttrs.type == TYPE_TOAST && w.mOwnerUid == uid && !w.mPermanentlyHidden
&& !w.mWindowRemovalAllowed);